content stringlengths 5 1.05M |
|---|
--[[
Copyright 2019 Manticore Games, Inc.
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.
--]]
-- Internal custom properties
local UI_OBJECT = script:GetCustomProperty("UIObject"):WaitForObject()
local LOCAL_PLAYER = Game.GetLocalPlayer()
-- Equipment GetWeapon()
-- Returns weapon that player is using
function GetWeapon(player)
for i,v in ipairs(player:GetEquipment()) do
if v:IsA("Weapon") then
return v
end
end
return nil
end
function Tick()
local weapon = GetWeapon(LOCAL_PLAYER)
if weapon and weapon.currentAmmo >= 0 then
local currentAmmoPercentage = weapon.currentAmmo / weapon.maxAmmo
if currentAmmoPercentage < .2 and not LOCAL_PLAYER.isDead then
UI_OBJECT.visibility = Visibility.INHERIT
else
UI_OBJECT.visibility = Visibility.FORCE_OFF
end
else
UI_OBJECT.visibility = Visibility.FORCE_OFF
end
end
-- Initialize
UI_OBJECT.visibility = Visibility.FORCE_OFF |
function love.load()
sprites = {}
sprites.background = love.graphics.newImage('sprites/background.png')
sprites.bullet = love.graphics.newImage('sprites/bullet.png')
sprites.player = love.graphics.newImage('sprites/player.png')
sprites.zombie = love.graphics.newImage('sprites/zombie.png')
player = {}
player.x = love.graphics.getWidth() / 2
player.y = love.graphics.getHeight() / 2
end
function love.update(dt)
end
function love.draw()
love.graphics.draw(sprites.background, 0, 0)
love.graphics.draw(sprites.player, player.x, player.y)
end |
return function()
local HttpService = game:GetService("HttpService")
local EncodedValue = require(script.Parent.EncodedValue)
local allValues = require(script.Parent.allValues)
local function deepEq(a, b)
if typeof(a) ~= typeof(b) then
return false
end
local ty = typeof(a)
if ty == "table" then
local visited = {}
for key, valueA in pairs(a) do
visited[key] = true
if not deepEq(valueA, b[key]) then
return false
end
end
for key, valueB in pairs(b) do
if visited[key] then
continue
end
if not deepEq(valueB, a[key]) then
return false
end
end
return true
else
return a == b
end
end
local extraAssertions = {
CFrame = function(value)
expect(value).to.equal(CFrame.new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))
end,
}
for testName, testEntry in pairs(allValues) do
it("round trip " .. testName, function()
local ok, decoded = EncodedValue.decode(testEntry.value)
assert(ok, decoded)
if extraAssertions[testName] ~= nil then
extraAssertions[testName](decoded)
end
local ok, encoded = EncodedValue.encode(decoded, testEntry.ty)
assert(ok, encoded)
if not deepEq(encoded, testEntry.value) then
local expected = HttpService:JSONEncode(testEntry.value)
local actual = HttpService:JSONEncode(encoded)
local message = string.format(
"Round-trip results did not match.\nExpected:\n%s\nActual:\n%s",
expected, actual
)
error(message)
end
end)
end
end
|
BindingsGen = {}
BindingsGen.name = "BindingsGen"
project "BindingsGen"
kind "ConsoleApp"
language "C#"
location "."
files { "**.cs", "./*.lua" }
dependson { "Bridge", "Generator", "Parser" }
links
{
"System",
path.join(depsdir, "cxxi", "build", action, "lib", "Bridge"),
path.join(depsdir, "cxxi", "build", action, "lib", "Generator"),
}
|
local selectionService = game:GetService("Selection")
local changeHistoryService = game:GetService("ChangeHistoryService")
local toolbar = plugin:CreateToolbar("Texture Randomizer")
local button1 = toolbar:CreateButton("Randomize Textures", "Randomize Texture ", "rbxassetid://7509385682")
function GetRandomizedValue(LowerBound, UpperBound)
-- returns a random decimal value between the bounds, rounded to 2 decimal places
--print("=========================================================")
--print(" Lower/Upper bounds = " .. LowerBound .. "/" .. UpperBound)
--get a random integer bewtween the two bounds
local randInt = math.random(LowerBound, UpperBound - 1)
--print(" randInt = " .. randInt)
-- get a real between 0 and 1 and add to the int
local randReal = math.random() + randInt
--print(" randReal = " .. randReal)
-- use math.floor to round to two decimal places
local value = math.floor(randReal * 100)/100
--print(" final value = " .. value)
--print("=========================================================")
--local value = math.floor((math.random(LowerBound, UpperBound) * math.random()) * 100)/100
return value
end
local ui = script:WaitForChild("ScreenGui")
local cancelButton = ui.Frame.CancelButton
local randomizeButton = ui.Frame.RandomizeButton
button1.Click:Connect(function()
ui.Parent = game:GetService("CoreGui")
ui.Enabled = true
end)
function onCancel()
ui.Enabled = false
end
function randomizeTextures()
local badInput = false
for _, child in pairs(ui.Frame:GetChildren()) do
if child.ClassName == "TextBox" then
if child.Text == "" then
badInput = true
child.BorderColor3 = Color3.new(255,0,0)
child.BorderSizePixel = 5
elseif tonumber(child.Text) == nil then
child.BorderColor3 = Color3.new(27, 42, 53)
child.BorderSizePixel = 1
end
end
end
if badInput == true then
return
end
local OffsetStudsULower = ui.Frame.OffsetStudsULower.Text
local OffsetStudsUUpper = ui.Frame.OffsetStudsUUpper.Text
local OffsetStudsVLower = ui.Frame.OffsetStudsVLower.Text
local OffsetStudsVUpper = ui.Frame.OffsetStudsVUpper.Text
local StudsPerTileULower = ui.Frame.StudsPerTileULower.Text
local StudsPerTileUUpper = ui.Frame.StudsPerTileUUpper.Text
local StudsPerTileVLower = ui.Frame.StudsPerTileVLower.Text
local StudsPerTileVUpper = ui.Frame.StudsPerTileVUpper.Text
ui.Enabled = false
print("=========================================================")
print(">> Randomization parameters:")
print(">> OffsetStudsU: " .. OffsetStudsULower .. "/" .. OffsetStudsUUpper)
print(">> OffsetStudsV: " .. OffsetStudsVLower .. "/" .. OffsetStudsVUpper)
print(">> StudsPerTileU: " .. StudsPerTileULower .. "/" .. StudsPerTileUUpper)
print(">> StudsPerTileV: " .. StudsPerTileVLower .. "/" .. StudsPerTileVUpper)
print("=========================================================")
local selected = selectionService:Get()
if #selected > 0 then
changeHistoryService:SetWaypoint("Randomizing textures")
for _, object in pairs(selected) do
local texturesFound = false
if object.ClassName == "Texture" then
object.OffsetStudsU = GetRandomizedValue(OffsetStudsULower, OffsetStudsUUpper)
object.OffsetStudsV = GetRandomizedValue(OffsetStudsVLower, OffsetStudsVUpper)
object.StudsPerTileU = GetRandomizedValue(StudsPerTileULower, StudsPerTileUUpper)
object.StudsPerTileV = GetRandomizedValue(StudsPerTileVLower, StudsPerTileVUpper)
else
print(object.Name .. " was not a Texture instance. Getting this instance's children...")
--get children and find textures
local children = object:GetChildren()
--print(" ")
--print("********************************************************")
--print("Getting children of " .. object.Name)
for _, child in pairs(children) do
if child.ClassName == "Texture" then
texturesFound = true
child.OffsetStudsU = GetRandomizedValue(OffsetStudsULower, OffsetStudsUUpper)
child.OffsetStudsV = GetRandomizedValue(OffsetStudsVLower, OffsetStudsVUpper)
child.StudsPerTileU = GetRandomizedValue(StudsPerTileULower, StudsPerTileUUpper)
child.StudsPerTileV = GetRandomizedValue(StudsPerTileVLower, StudsPerTileVUpper)
--print("New values set:")
--print("OffsetStudsU: " .. child.OffsetStudsU)
--print("OffsetStudsV: " .. child.OffsetStudsU)
--print("StudsPerTileU: " .. child.StudsPerTileU)
--print("StudsPerTileV: " .. child.StudsPerTileV)
end
--print("********************************************************")
--print(" ")
end
end
if texturesFound == false then
warn("Selected item(s) did not contain a Texture instance.")
end
end
changeHistoryService:SetWaypoint("Randomizing textures")
else
warn("Nothing was selected")
end
end
cancelButton.Activated:Connect(onCancel)
randomizeButton.Activated:Connect(randomizeTextures) |
local g = aroma.graphics
local s = 100
function r()
g.rectangle(0,0, s,s)
end
function flower()
for i = 0, 2 do
g.push()
g.translate(s/2, s/2)
g.rotate(i/10 * math.pi*2)
g.translate(-s/2, -s/2)
r()
g.pop()
end
end
function aroma.draw()
g.setColor(128,255,128)
r()
g.setColor(255,128,255)
g.push()
g.translate(20, 20)
r()
g.pop()
g.setColor(128,255,255)
g.push()
g.translate(10, 150)
for i = 0, 5 do
g.push()
g.scale(0.3, 0.3)
flower()
g.pop()
g.translate(50, 0)
end
g.pop()
end
|
sptbl["saturator"] = {
files = {
module = "saturator.c",
header = "saturator.h",
example = "ex_saturator.c",
},
func = {
create = "ut_saturator_create",
destroy = "ut_saturator_destroy",
init = "ut_saturator_init",
compute = "ut_saturator_compute",
},
params = {
optional = {
{
name = "drive",
type = "UTFLOAT",
description ="Input gain into the distortion section, in decibels. Controls overall amount of distortion.",
default = 1.0
},
{
name = "dcoffset",
type = "UTFLOAT",
description = "Constant linear offset applied to the signal. A small offset will introduce odd harmonics into the distoration spectrum, whereas a zero offset will have only even harmonics.",
default = 0.0
},
}
},
modtype = "module",
description = [[Soft clip saturating distortion, based on examples from Abel/Berners' Music 424 course at Stanford.]],
ninputs = 1,
noutputs = 1,
inputs = {
{
name = "in",
description = "input."
},
},
outputs = {
{
name = "out",
description = "output."
},
}
}
|
--***********************************************************
--** THE INDIE STONE **
--** Author: turbotutone **
--***********************************************************
require "TimedActions/ISBaseTimedAction"
---@class ISMoveablesAction : ISBaseTimedAction
ISMoveablesAction = ISBaseTimedAction:derive("ISMoveablesAction")
function ISMoveablesAction:isValid()
return true;
end
function ISMoveablesAction:waitToStart()
if self.mode and self.mode=="scrap" and self.moveProps and self.moveProps.object then
self.character:faceThisObject(self.moveProps.object)
else
self.character:faceLocation(self.square:getX(), self.square:getY())
end
return self.character:shouldBeTurning()
end
function ISMoveablesAction:update()
if self.mode and self.mode=="scrap" and self.moveProps and self.moveProps.object then
self.character:faceThisObject(self.moveProps.object);
else
self.character:faceLocation(self.square:getX(), self.square:getY());
end
if self.sound and not self.sound:isPlaying() then
self:setActionSound();
end
self.character:setMetabolicTarget(Metabolics.UsingTools);
end
function ISMoveablesAction:setActionSound()
if self.mode == "scrap" then
self.sound = self.moveProps:getScrapSound( self.character );
else
self.sound = self.moveProps:getSoundFromTool( self.square, self.character, self.mode );
end
end
function ISMoveablesAction:start()
self:setActionSound();
if self.sound then
--self.sound = sound;
self.sound:stop();
end
if self.mode and self.mode=="scrap" then
if self.character:hasEquipped("BlowTorch") then
self:setActionAnim("BlowTorch")
self:setOverrideHandModels(self.character:getPrimaryHandItem(), nil)
elseif self.character:hasEquippedTag("Hammer") then
self:setActionAnim(CharacterActionAnims.Build)
self:setOverrideHandModels(self.character:getPrimaryHandItem(), nil)
else
self:setActionAnim(CharacterActionAnims.Disassemble);
self:setOverrideHandModels("Screwdriver", nil);
end
end
end
function ISMoveablesAction:stop()
if self.sound and self.sound:isPlaying() then
self.sound:stop();
end
ISBaseTimedAction.stop(self)
end
--[[
-- The moveprops of the new facing (where applies) are always used to perform the actions, the origSpriteName is passed to retrieve the original object from tile or inventory.
]]
function ISMoveablesAction:perform()
if self.sound and self.sound:isPlaying() then
self.sound:stop();
end
if self.moveProps and self.moveProps.isMoveable and self.mode and self.mode ~= "scrap" then
self.moveProps.cursorFacing = self.cursorFacing
if self.mode == "pickup" then
self.moveProps:pickUpMoveableViaCursor( self.character, self.square, self.origSpriteName, self.moveCursor ); --OrigSpriteName currently not used in this one.
elseif self.mode == "place" then
self.moveProps:placeMoveableViaCursor( self.character, self.square, self.origSpriteName, self.moveCursor );
elseif self.mode == "rotate" then
self.moveProps:rotateMoveableViaCursor( self.character, self.square, self.origSpriteName, self.moveCursor );
end
self.moveProps.cursorFacing = nil
elseif self.mode and self.mode=="scrap" then
self.moveProps:scrapObjectViaCursor( self.character, self.square, self.origSpriteName, self.moveCursor );
end
ISBaseTimedAction.perform(self)
end
function ISMoveablesAction:new(character, _sq, _moveProps, _mode, _origSpriteName, _moveCursor )
local o = {};
setmetatable(o, self);
self.__index = self;
o.character = character;
o.square = _sq;
o.origSpriteName = _origSpriteName;
o.stopOnWalk = true;
o.stopOnRun = true;
o.maxTime = 50;
o.spriteFrame = 0;
o.mode = _mode;
o.moveProps = _moveProps;
o.moveCursor = _moveCursor;
if _moveCursor and (_mode == "place" or _mode == "rotate") and _moveProps:canRotateDirection() then
o.cursorFacing = _moveCursor.cursorFacing or _moveCursor.joypadFacing
end
if ISMoveableDefinitions.cheat then
o.maxTime = 10;
else
if o.moveProps and o.moveProps.isMoveable and _mode and _mode~="rotate" and _mode~= "scrap" then
o.maxTime = o.moveProps:getActionTime( character, _mode );
elseif o.moveProps and _mode == "scrap" then
o.maxTime = o.moveProps:getScrapActionTime( character );
end
end
return o;
end
|
minetest.register_node("twomt_tinker:fabolight", {
description = "It´s fabulous.",
light_source = 5,
tiles = {"default_stone.png^twomt_tinker_fabolight.png"},
is_ground_content = true,
groups = {cracky = 2},
drop = "twomt_tinker:fabolight_lump"
})
minetest.register_node("twomt_tinker:minevium", {
description = "sprouting from your head.",
light_source = 2,
tiles = {"default_stone.png^twomt_tinker_minevium.png"},
is_ground_content = true,
groups = {cracky = 1},
drop = "twomt_tinker:minevium_lump"
})
minetest.register_node("twomt_tinker:pumpkin", {
description = "Pumpkin",
tiles = {
"twomt_tinker_pumpkin_top.png",
"twomt_tinker_pumpkin_bottom.png",
"twomt_tinker_pumpkin_side.png",
"twomt_tinker_pumpkin_side.png",
"twomt_tinker_pumpkin_side.png",
"twomt_tinker_pumpkin_front.png",
},
fertility = {"grassland", "dirt"},
groups = {flammable = 4, },
})
minetest.register_node("twomt_tinker:burning_pumpkin", {
description = "Burning Pumpkin",
light_source = 10,
tiles = {
"twomt_tinker_pumpkin_top.png",
"twomt_tinker_pumpkin_bottom.png",
"twomt_tinker_pumpkin_side.png",
"twomt_tinker_pumpkin_side.png",
"twomt_tinker_pumpkin_side.png",
"twomt_tinker_pumpkin_front_burning.png",
},
fertility = {"grassland", "dirt"},
groups = {flammable = 4, },
})
minetest.register_node("twomt_tinker:minevium_plant", {
description = "Minevium Plant",
light_source = 3,
drawtype = "plantlike",
tiles = {"twomt_tinker_minevium_plant.png"},
fertility = {"grassland"},
groups = {snappy = 3, flammable = 1},
on_use = minetest.item_eat(20),
}) |
--- the Textadept initializer for the Moonscript module.
-- @author [Alejandro Baez](https://twitter.com/a_baez)
-- @copyright 2015-2016
-- @license MIT (see LICENSE)
-- @module init
local _snippets = require("moonscript.snippets")
textadept.file_types.extensions.moon = 'moonscript'
textadept.editing.comment_string.moonscript = '--'
textadept.run.compile_commands.moonscript = 'moonc %f'
textadept.run.run_commands.moonscript = 'moon %f'
textadept.run.build_commands["Tupfile(%.lua)?"] = "tup"
events.connect(events.LEXER_LOADED, function (lang)
if lang ~= 'moonscript' then return end
buffer.tab_width = 2
buffer.use_tabs = false
end)
if type(snippets) == 'table' then
snippets.moonscript = _snippets
end
keys.moonscript = {
[not OSX and not CURSES and 'cl' or 'ml'] = {
-- Open this module for editing: `Alt/⌘-L` `M`
s = function()
io.open_file(_USERHOME..'/modules/moonscript/snippets.lua')
end,
},
}
--- compiles automatically any moonscript file.
-- disable by changing _AUTOLINT to false.
events.connect(events.FILE_AFTER_SAVE, function()
if buffer:get_lexer() ~= 'moonscript' or not _MOONAUTOLINT then return end
buffer:annotation_clear_all()
local err = io.popen("moonc -l " .. buffer.filename .. " 2>&1"):read('*a')
local line = err:match("^.+(%d+).+>>")
if line and tonumber(line) > 0 then
line = tonumber(line) - 1
local msg = err:match(">>.+"):gsub('>>%s+','')
-- If the error line is not onscreen, annotate the current line.
if (line < buffer.first_visible_line or
line > buffer.first_visible_line + buffer.lines_on_screen) then
msg = 'line '..(line + 1)..'\n'..msg
line = buffer:line_from_position(buffer.current_pos)
end
buffer.annotation_visible = 2
buffer.annotation_text[line] = "Error: " .. msg
buffer.annotation_style[line] = 8 -- error style number
buffer:goto_line(line)
end
end)
return { }
|
solution "operating_systems"
configurations { "Debug", "Release" }
project "oscontext"
kind "SharedLib"
language "C"
location "build"
targetdir "build"
files { "src/*.h", "src/*.c" }
links { "rt" }
configuration "Debug"
defines { "DEBUG" }
flags { "Symbols" }
configuration "Release"
defines { "NDEBUG" }
flags { "Optimize" }
project "ospthread"
kind "SharedLib"
language "C"
location "build"
targetdir "build"
files { "src/*.h", "src/*.c" }
excludes { "src/thread.c" }
links { "pthread" }
configuration "Debug"
defines { "DEBUG", "USE_PTHREAD" }
flags { "Symbols" }
configuration "Release"
defines { "NDEBUG", "USE_PTHREAD" }
flags { "Optimize" }
|
lfs = require "lfs"
util = require "util.util"
fs = require "util.filesystem"
chainsaw = require "util.chainsaw" |
-- The default minetest.item_place_node from item.lua was hard to work with given some of the details
-- of how it handled pointed_thing. It also didn't work right with default:torch and seeds. It was simpler to
-- just copy it here and chop out the special cases that were causing problems, and add some special handling.
-- for nodes that define on_place
-- This specific file is therefore licensed under the LGPL 2.1
--GNU Lesser General Public License, version 2.1
--Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
--Copyright (C) 2011-2016 Various Minetest developers and contributors
--This program is free software; you can redistribute it and/or modify it under the terms
--of the GNU Lesser General Public License as published by the Free Software Foundation;
--either version 2.1 of the License, or (at your option) any later version.
--This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
--without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--See the GNU Lesser General Public License for more details:
--https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
-- Mapping from facedir value to index in facedir_to_dir.
digtron.facedir_to_dir_map = {
[0]=1, 2, 3, 4,
5, 2, 6, 4,
6, 2, 5, 4,
1, 5, 3, 6,
1, 6, 3, 5,
1, 4, 3, 2,
}
local function has_prefix(str, prefix)
return str:sub(1, string.len(prefix)) == prefix
end
digtron.whitelisted_on_place = function (item_name)
for listed_item, value in pairs(digtron.builder_on_place_items) do
if item_name == listed_item then return value end
end
for prefix, value in pairs(digtron.builder_on_place_prefixes) do
if has_prefix(item_name, prefix) then return value end
end
if minetest.get_item_group(item_name, "digtron_on_place") > 0 then return true end
return false
end
local function copy_pointed_thing(pointed_thing)
return {
type = pointed_thing.type,
above = vector.new(pointed_thing.above),
under = vector.new(pointed_thing.under),
}
end
local function check_attached_node(p, n)
local def = minetest.registered_nodes[n.name]
local d = {x = 0, y = 0, z = 0}
if def.paramtype2 == "wallmounted" then
-- The fallback vector here is in case 'wallmounted to dir' is nil due
-- to voxelmanip placing a wallmounted node without resetting a
-- pre-existing param2 value that is out-of-range for wallmounted.
-- The fallback vector corresponds to param2 = 0.
d = minetest.wallmounted_to_dir(n.param2) or {x = 0, y = 1, z = 0}
else
d.y = -1
end
local p2 = vector.add(p, d)
local nn = minetest.get_node(p2).name
local def2 = minetest.registered_nodes[nn]
if def2 and not def2.walkable then
return false
end
return true
end
digtron.item_place_node = function(itemstack, placer, place_to, param2)
local item_name = itemstack:get_name()
local def = itemstack:get_definition()
if not def then
return itemstack, false
end
local pointed_thing = {}
pointed_thing.type = "node"
pointed_thing.above = {x=place_to.x, y=place_to.y, z=place_to.z}
pointed_thing.under = {x=place_to.x, y=place_to.y - 1, z=place_to.z}
-- Handle node-specific on_place calls as best we can.
if def.on_place and def.on_place ~= minetest.nodedef_default.on_place and digtron.whitelisted_on_place(item_name) then
if def.paramtype2 == "facedir" then
pointed_thing.under = vector.add(place_to, minetest.facedir_to_dir(param2))
elseif def.paramtype2 == "wallmounted" then
pointed_thing.under = vector.add(place_to, minetest.wallmounted_to_dir(param2))
end
-- pass a copy of the item stack parameter because on_place might modify it directly and then we can't tell if we succeeded or not
-- though note that some mods do "creative_mode" handling within their own on_place methods, which makes it impossible for Digtron
-- to know what to do in that case - if you're in creative_mode Digtron will place such items but it will think it failed and not
-- deduct them from inventory no matter what Digtron's settings are. Unfortunate, but not very harmful and I have no workaround.
local returnstack, success = def.on_place(ItemStack(itemstack), placer, pointed_thing)
if returnstack and returnstack:get_count() < itemstack:get_count() then success = true end -- some mods neglect to return a success condition
if success then
-- Override the param2 value to force it to be what Digtron wants
local placed_node = minetest.get_node(place_to)
placed_node.param2 = param2
minetest.set_node(place_to, placed_node)
end
return returnstack, success
end
if minetest.registered_nodes[item_name] == nil then
-- Permitted craft items are handled by the node-specific on_place call, above.
-- if we are a craft item and we get here then we're not whitelisted and we should fail.
-- Note that builder settings should be filtering out craft items like this before we get here,
-- but this will protect us just in case.
return itemstack, false
end
local oldnode = minetest.get_node_or_nil(place_to)
--this should never happen, digtron is testing for adjacent unloaded nodes before getting here.
if not oldnode then
minetest.log("info", placer:get_player_name() .. " tried to place"
.. " node in unloaded position " .. minetest.pos_to_string(place_to)
.. " using a digtron.")
return itemstack, false
end
local newnode = {name = def.name, param1 = 0, param2 = param2}
if def.place_param2 ~= nil then
newnode.param2 = def.place_param2
end
-- Check if the node is attached and if it can be placed there
if minetest.get_item_group(def.name, "attached_node") ~= 0 and
not check_attached_node(place_to, newnode) then
minetest.log("action", "attached node " .. def.name ..
" can not be placed at " .. minetest.pos_to_string(place_to))
return itemstack, false
end
-- Add node and update
minetest.add_node(place_to, newnode)
local take_item = true
-- Run callback, using genuine player for per-node definition.
if def.after_place_node then
-- Deepcopy place_to and pointed_thing because callback can modify it
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
if def.after_place_node(place_to_copy, placer, itemstack,
pointed_thing_copy) then
take_item = false
end
end
-- Run script hook, using fake_player to take the blame.
-- Note that fake_player:update is called in the DigtronLayout class's "create" function,
-- which is called before Digtron does any of this building stuff, so it's not necessary
-- to update it here.
local _, callback
for _, callback in ipairs(minetest.registered_on_placenodes) do
-- Deepcopy pos, node and pointed_thing because callback can modify them
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
local newnode_copy = {name=newnode.name, param1=newnode.param1, param2=newnode.param2}
local oldnode_copy = {name=oldnode.name, param1=oldnode.param1, param2=oldnode.param2}
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
if callback(place_to_copy, newnode_copy, digtron.fake_player, oldnode_copy, itemstack, pointed_thing_copy) then
take_item = false
end
end
if take_item then
itemstack:take_item()
end
return itemstack, true
end |
object_tangible_furniture_jedi_frn_all_banner_dark_s01 = object_tangible_furniture_jedi_shared_frn_all_banner_dark_s01:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_jedi_frn_all_banner_dark_s01, "object/tangible/furniture/jedi/frn_all_banner_dark_s01.iff")
|
AmbientVolume = {
type = "Sound",
Properties = {
soundName = "",
--iVolume=255,
OuterRadius = 10,
bEnabled = 1,
bIgnoreCulling=0,
bIgnoreObstruction=0,
bSensitiveToBattle = 0,
bLogBattleValue = 0,
},
started = 0,
Editor={
Model="Editor/Objects/Sound.cgf",
Icon="AmbientVolume.bmp",
},
bEnabled = 1,
fFade = 1,
--bGameStarted = 0,
}
function AmbientVolume:OnSpawn()
self:SetFlags(ENTITY_FLAG_CLIENT_ONLY, 0);
--System.Log("AV: OSpawn!");
--if (self.bGameStarted == 0) then
--end;
if (System.IsEditor()) then
Sound.Precache(self.Properties.soundName, SOUND_PRECACHE_LOAD_SOUND);
end;
end
function AmbientVolume:OnSave(save)
--WriteToStream(stm,self.Properties);
save.started = self.started;
save.bEnabled = self.Properties.bEnabled;
save.bIgnoreCulling = self.Properties.bIgnoreCulling;
save.bIgnoreObstruction = self.Properties.bIgnoreObstruction;
save.bSensitiveToBattle = self.Properties.bSensitiveToBattle;
save.bLogBattleValue = self.Properties.bLogBattleValue;
--System.Log("AV: ONSAVE!"..tostring(self.soundid));
if (self.soundid ~= nil) then
save.fLastVolume = Sound.GetSoundVolume(self.soundid);
--System.Log("AV: Save LastVolume!"..tostring(save.fLastVolume));
end;
end
function AmbientVolume:OnLoad(load)
--self.Properties=ReadFromStream(stm);
--self:OnReset();
self:OnReset();
self.started = load.started;
self.Properties.bEnabled = load.bEnabled;
self.Properties.bIgnoreCulling = load.bIgnoreCulling;
self.Properties.bIgnoreObstruction = load.bIgnoreObstruction;
self.Properties.bSensitiveToBattle = load.bSensitiveToBattle
self.Properties.bLogBattleValue = load.bLogBattleValue
if ((self.started==1) and (self.Properties.bOnce~=1)) then
self:Play();
end
--System.Log("AV: LastVolume!");
if (self.soundid ~= nil) then
--System.Log("AV: Load LastVolume!"..tostring(load.fLastVolume));
Sound.SetSoundVolume(self.soundid, load.fLastVolume);
end;
--System.Log("AV: ONLOAD!");
end
--function AmbientVolume:OnStartGame()
--System.Log("AV: OnStartGame!");
--self.bGameStarted = 1;
--end
----------------------------------------------------------------------------------------
function AmbientVolume:OnPropertyChange()
--System.Log("AV: Prop change");
if (self.soundName ~= self.Properties.soundName or self.bEnabled ~= self.Properties.bEnabled) then
-- changes to Enable or Soundname require a reset
--self.bEnabled = self.Properties.bEnabled;
self:OnReset();
end
Sound.SetSoundVolume(self.soundid, 1.0*self.fFade);
--System.Log("AV: Volume changed:"..self.fFade);
--if (self.volume ~= self.Properties.iVolume) then
--Sound.SetSoundVolume(self.soundid, self.Properties.iVolume);
--self.volume = self.Properties.iVolume;
--end
--if (self.radius ~= self.Properties.OuterRadius) then
self:SetSoundEffectRadius(self.Properties.OuterRadius);
--self.radius = self.Properties.OuterRadius;
--end
--if (self.bSensitive ~= self.Properties.bSensitiveToBattle) then
--self.bSensitive = self.Properties.bSensitiveToBattle;
--end;
end
----------------------------------------------------------------------------------------
function AmbientVolume:OnReset()
-- Set basic sound params.
--System.Log("Reset AV");
--System.Log("self.Properties.bPlay:"..self.Properties.bPlay..", self.started:"..self.started);
--self.started = 0; -- [marco] fix playonce on reset for switch editor/game mode
--self.bEnabled = self.Properties.bEnabled;
--if (self.Properties.bPlay == 0 and self.soundid ~= nil) then
self:Stop();
self:SetSoundEffectRadius(self.Properties.OuterRadius);
--self.radius = self.Properties.OuterRadius;
self.bEnabled = self.Properties.bEnabled;
--System.Log("Reset AV Done"..tostring(self.bEnable));
--self:Play();
--self.started = 0; -- [marco] fix playonce on reset for switch editor/game mode
end
----------------------------------------------------------------------------------------
function AmbientVolume:UpdateBattleNoise()
--System.Log("Updating Battle Noise...");
if (self.Properties.bSensitiveToBattle == 1 and self.soundid) then
local fBattle = Game.QueryBattleStatus();
Sound.SetParameterValue(self.soundid, "battle", fBattle);
if (self.Properties.bLogBattleValue == 1) then
System.Log("AV: Current Battle Value :".. tostring(fBattle));
end;
self:SetTimer(1, 300); -- timer for updating battle parameter
--System.Log("Updating Battle Noise :".. tostring(fBattle));
else
self:KillTimer(1);
end;
end
----------------------------------------------------------------------------------------
AmbientVolume["Server"] = {
OnInit= function (self)
self.started = 0;
self:NetPresent(0);
self:SetFlags(ENTITY_FLAG_VOLUME_SOUND,0);
--self:SetSoundEffectRadius(self.Properties.OuterRadius);
end,
OnShutDown= function (self)
end,
}
----------------------------------------------------------------------------------------
AmbientVolume["Client"] = {
----------------------------------------------------------------------------------------
OnInit = function(self)
--System.Log("OnInit");
self.started = 0;
self.inside = 0;
self.soundName = "";
self.soundid = nil;
--self.bSensitive = 0;
self:NetPresent(0);
self:SetFlags(ENTITY_FLAG_VOLUME_SOUND,0);
self:SetSoundEffectRadius(self.Properties.OuterRadius);
--System.Log("Play sound"..self.Properties.soundName);
end,
--self.Client.OnMove(self);
--end,
----------------------------------------------------------------------------------------
OnShutDown = function(self)
end,
OnEnterArea = function(self, player, nAreaID, fFade)
--System.Log("OnEnterArea-Client");
--System.Log("AV: OnEnterArea-Client - Fade: "..tostring(fFade));
if (g_localActorId ~= player.id and player.class~="CameraSource") then return end;
self.inside = 1;
if (self.soundid == nil) then
self:Play();
end;
if (fFade == -1) then
fFade = 1;
end;
Sound.SetSoundVolume(self.soundid, fFade);
if (self.fFade ~= fFade) then
--self.fFade = 1;
if (fFade < 0) then
self.fFade = 0;
else
self.fFade = fFade;
end;
--System.Log("Fade now: "..tostring(self.fFade));
end;
end,
OnProceedFadeArea = function(self, player, nAreaID, fFade)
--System.Log("AV: OnMoveInsideArea-Client: "..tostring(nAreaID).."-"..tostring(fFade));
--System.Log("AV: self-Fade now: "..tostring(self.fFade));
if (g_localActorId ~= player.id and player.class~="CameraSource") then return end;
--System.Log("Sound ID now: "..tostring(self.soundid));
if (self.soundid == nil) then
self:Play();
end;
--System.Log("AV: selfFade: "..tostring(self.fFade));
--System.Log("AV: new Fade: "..tostring(fFade));
Sound.SetSoundVolume(self.soundid, fFade);
if (self.fFade ~= fFade) then
--self.fFade = 1;
if (fFade < 0) then
self.fFade = 0;
else
self.fFade = fFade;
end;
--System.Log("Fade now: "..tostring(self.fFade));
end;
end,
OnEnterNearArea = function(self, player, nAreaID, fFade)
--System.Log("OnEnterNearArea-Client");
if (g_localActorId ~= player.id and player.class~="CameraSource") then return end;
--System.Log("Is Camera or Player!");
if (self.soundid == nil) then
self:Play();
end;
end,
OnMoveNearArea = function(self, player, nAreaID, fFade)
--System.Log("OnMoveNearArea-Client");
if (g_localActorId ~= player.id and player.class~="CameraSource") then return end;
if (self.soundid == nil) then
self:Play();
end;
end,
OnLeaveNearArea = function(self, player, nAreaID, fFade)
--System.Log("OnLeaveNearArea-Client");
--System.Log(player.class);
--System.Log(tostring(player.id));
--System.Log(tostring(g_localActorId));
if (g_localActorId ~= player.id and player.class~="CameraSource") then return end;
if (self.inside ~= 1) then
self:Stop();
end;
end,
OnLeaveArea = function(self, player, nAreaID, fFade)
if (g_localActorId ~= player.id and player.class~="CameraSource") then return end;
self.inside = 0;
--System.Log("OLeaveArea-Client");
--self:Stop();
end,
OnTimer = function(self, timerid, msec)
--System.Log("------------ AB OnTimer :"..timerid);
if (timerid == 1) then
--System.Log("------------ AB OnTimer :"..timerid);
self:UpdateBattleNoise();
end;
--self:RemoveDecals();
end,
OnUnBindThis = function(self)
self:Stop();
self.inside = 0;
end,
}
----------------------------------------------------------------------------------------
function AmbientVolume:Play()
--System.Log( "...Try to Play Sound AV 1" );
if (self.Properties.bEnabled == 0 ) then
do return end;
end
if (self.soundid ~= nil) then
self:Stop();
end
local sndFlags = SOUND_DEFAULT_3D;
if (self.Properties.bIgnoreCulling == 1) then
sndFlags = band(sndFlags, bnot(SOUND_CULLING))
end;
if (self.Properties.bIgnoreObstruction == 1) then
sndFlags = band(sndFlags, bnot(SOUND_OBSTRUCTION))
end;
sndFlags = bor(sndFlags, SOUND_START_PAUSED)
--System.Log( "...Try to Play Sound AV 2a");
-- need to use *really* large max distance so a Play event does not cull the sound based on distance
-- we dont want the sound be rejected
self.soundid = self:PlaySoundEventEx(self.Properties.soundName, sndFlags, 0, g_Vectors.v000, 0, 0, SOUND_SEMANTIC_AMBIENCE );
-- helps to fade in the ambient without pops.
Sound.SetFadeTime(self.soundid, 1.0, 300);
Sound.SetSoundVolume(self.soundid, 0.0);
--Sound.SetSoundVolume(self.soundid, 1.0*self.fFade);
--System.Log( "AV Start to Play "..tostring(self.fFade));
self:UpdateBattleNoise();
Sound.SetSoundPaused(self.soundid, 0);
self.soundName = self.Properties.soundName;
--self.volume = self.Properties.iVolume;
--System.Log( "----- AV Play Sound" );
if (self.soundid ~= nil) then
self.started = 1;
end;
end
----------------------------------------------------------------------------------------
function AmbientVolume:Stop()
--System.Log( "Stop Sound AV 0" );
if (self.soundid ~= nil) then
self:StopSound(self.soundid); -- stopping through entity proxy
--System.Log( "Stop Sound AV 1" );
self.soundid = nil;
end
self.started = 0;
self:KillTimer(1);
end
------------------------------------------------------------------------------------------------------
-- Event Handlers
------------------------------------------------------------------------------------------------------
function AmbientVolume:Event_SoundName( sender, sSoundName )
self.Properties.soundName = sSoundName;
--BroadcastEvent( self,"SoundName" );
self:OnReset();
end
function AmbientVolume:Event_Deactivate(sender)
--System.Log( "AV :FG event - Deactivate");
self.Properties.bEnabled = 0;
self:Stop();
end
----------------------------------------------------------------------------------------------------
function AmbientVolume:Event_Activate(sender)
--System.Log( "AV :FG event - Active");
self.Properties.bEnabled = 1;
if (self.inside == 1) then
self:Play();
end;
--self:OnReset();
end
function AmbientVolume:Event_Radius( sender, fRadius )
--System.Log( "Ambient Volume :Enable radius");
--self:Stop();
--BroadcastEvent( self,"Radius" );
end
--function AmbientVolume:Event_Volume( fVolume )
--self.Properties.iVolume = fVolume;
--BroadcastEvent( self,"Volume" );
--end
AmbientVolume.FlowEvents =
{
Inputs =
{
sound_SoundName = { AmbientVolume.Event_SoundName, "string" },
--Enable = { AmbientVolume.Event_Enable, "bool" },
Deactivate = { AmbientVolume.Event_Deactivate, "bool" },
Activate = { AmbientVolume.Event_Activate, "bool" },
Radius = { AmbientVolume.Event_Radius, "float" },
--Volume = { AmbientVolume.Event_Volume, "float" },
},
Outputs =
{
},
}
|
--- XML utility functions
local constants = require "expadom.constants"
local ERRORS = constants.ERRORS
--local TYPES = constants.NODE_TYPES
local M = {}
--- Library for UTF-8 support.
-- This is either the stock Lua lib, on Lua 5.3 or higher. Or the one from
-- the Lua 5.3 compatibility module; "compat53.utf8".
-- @table utf8
M.utf8 = _G.utf8 or require("compat53.utf8")
--- splits a (qualified) name in a prefix + localname (without validation).
-- @tparam string name the tag/attribute name, with or without namespace prefix
-- @return localname, prefix. Prefix will be 'nil' if there was none
-- @usage
-- local name, prefix = split_name("clr:orange") --> "orange", "clr"
-- local name, prefix = split_name("orange") --> "orange", nil
function M.split_name(name)
local nsprefix, localname = name:match("^([^:]-):?([^:]+)$")
return localname, nsprefix ~= "" and nsprefix or nil
end
--- creates a qualified name (without validation).
-- if prefix is either empty or nil, the prefix is omitted
-- @tparam string localname the localname
-- @tparam string|nil prefix the prefix
-- @usage
-- local qualified = qualifiedname("orange", "clr") --> "clr:orange"
-- local qualified = qualifiedname("orange", "") --> "orange"
-- local qualified = qualifiedname("orange") --> "orange"
function M.qualifiedname(localname, prefix)
return (prefix ~= nil and prefix ~= "") and (prefix..":"..localname) or localname
end
--- validates a non-qualified name.
-- must be a string, at least 1 character
-- @tparam string name the tag/attribute name
-- @return name, or nil+err
function M.validate_name(name)
if type(name) ~= "string" then
return nil, ERRORS.INVALID_CHARACTER_ERR
end
if #name == 0 then
return nil, ERRORS.NAMESPACE_ERR
end
-- TODO: validate characters allowed in localname
return name
end
--- validates a prefix.
-- must be a string, can be 0 length
-- @tparam string name the prefix name
-- @return name or nil+err
function M.validate_prefix(name)
if type(name) ~= "string" then
return nil, ERRORS.INVALID_CHARACTER_ERR
end
-- TODO: validate characters allowed in localname
return name
end
--- validates a qualified name.
-- must be a string, localname and prefix at least 1 character
-- @tparam string qualifiedName the tag/attribute name, with or without namespace prefix
-- @return localname, prefix. Prefix will be 'nil' if there was none.
function M.validate_qualifiedname(qualifiedName)
if type(qualifiedName) ~= "string" then
return nil, ERRORS.INVALID_CHARACTER_ERR
end
local prefix, localname
local i = qualifiedName:find(":")
if i then
prefix = qualifiedName:sub(1, i-1)
localname = qualifiedName:sub(i+1, -1)
if #prefix == 0 then
return nil, ERRORS.NAMESPACE_ERR
end
-- TODO: validate characters allowed in prefix
else
localname = qualifiedName
end
if #localname == 0 then
return nil, ERRORS.NAMESPACE_ERR
end
-- TODO: validate characters allowed in localname
return localname, prefix
end
--- validates a qualified name and its URI.
-- namespaceURI can be nil, if there is no prefix in the qualified name. If the prefix
-- is `xml` then the namespace must be `http://www.w3.org/XML/1998/namespace`.
-- @tparam string qualifiedName the tag/attribute name, with or without namespace prefix
-- @tparam string|nil namespaceURI the namespace uri
-- @return localname, prefix, uri, or nil+err. Prefix will be 'nil' if there was none.
function M.validate_qualifiedName_and_uri(qualifiedName, namespaceURI)
local localname, prefix = M.validate_qualifiedname(qualifiedName)
if not localname then
return nil, prefix
end
if namespaceURI ~= nil then
if type(namespaceURI) ~= "string" then
return nil, ERRORS.INVALID_CHARACTER_ERR
end
if #namespaceURI == 0 then
return nil, ERRORS.NAMESPACE_ERR
end
-- TODO: validate characters allowed in namespaceURI
end
if prefix and not namespaceURI then
-- must specify a namesapce when using a prefix
return nil, ERRORS.NAMESPACE_ERR
end
if prefix == "xml" and namespaceURI ~= "http://www.w3.org/XML/1998/namespace" then
-- special prefix
return nil, ERRORS.NAMESPACE_ERR
end
return localname, prefix, namespaceURI
end
do
local escape_table = {
["'"] = "'",
['"'] = """,
["<"] = "<",
[">"] = ">",
["&"] = "&",
}
--- Escapes a string for safe use in xml.
-- Handles quotes(single+double), less-than, greater-than, and ampersand.
-- @tparam string str string value to escape
-- @return escaped string
-- @usage
-- local esc = xml.xml_escape([["'<>&]]) --> ""'<>&"
function M.escape(str)
return str:gsub("['&<>\"]", escape_table)
end
end
return M
|
--[[ LICENSE HEADER
MIT License
Copyright © 2017 Jordan Irwin
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.
--]]
function antum.createHostileEntity(def)
-- def must have name, visual, movement, battle,
local name = def.name
local vi = def.visual
local mo = def.movement
local ba = def.battle
local tex = def.textures
local def = {
-- Visuals
collisionbox = vi.collisionbox,
visual = vi.visual,
animation = vi.animation,
animation_speed = vi.animation_speed,
textures = tex,
-- Movement
makes_footstep_sound = mo.footsteps,
walk_speed = mo.speed,
jump_height = mo.jump,
-- Battle definitions
hp_max = ba.hp,
physical = ba.physical,
knockback_level = ba.knockback,
}
core.register_entity(name, def)
end
-- TESTING
--[[
local creeper = {
name = ':antum:creeper',
visual = antum.def.visual.creeper,
movement = antum.def.movement.creeper,
battle = antum.def.battle.creeper,
textures = {'creeper.png'},
}
antum.createHostileEntity(creeper)--]]
|
dofile("/models/testcube.lua");
data.visibles["visible/testcube"] = {
objects = {
{
mesh = "mesh/testcube",
submesh_id = 0
}
}
}
data.prototypes["prototype/testcube"] = {
visible = "visible/testcube",
world_position = true,
rotation = true
}
data.shaders["shader/imgui_vert2"] = {
shader = "/shaders/shdr_imgui_vert.spv",
stage = "vert"
};
|
--* locale config {GUI}
suiLC = function(lang)
local E, C, L, _ = SohighUI:unpack()
--// Main //--
if lang == 'suigui_main' then lang = L_GUI_MAIN end
if lang == 'suigui_mainmaxUIScale' then lang = L_GUI_MAIN_UISCALE end
if lang == 'suigui_mainrestyleUI' then lang = L_GUI_MAIN_RESTYLEUI end
if lang == 'suigui_mainspellAnnounce' then lang = L_GUI_MAIN_ANNOUNCE end
if lang == 'suigui_maindurability' then lang = L_GUI_MAIN_DURABILITY end
if lang == 'suigui_mainmisc' then lang = L_GUI_MAIN_MISC end
if lang == 'suigui_maindeclineDuel' then lang = L_GUI_MAIN_DECLINEDUEL end
if lang == 'suigui_mainautoInvite' then lang = L_GUI_MAIN_AUTOINVITE end
if lang == 'suigui_mainautoGreed' then lang = L_GUI_MAIN_AUTOGREED end
if lang == 'suigui_mainautoRelease' then lang = L_GUI_MAIN_AUTORELEASE end
if lang == 'suigui_mainautoQuest' then lang = L_GUI_MAIN_AUTOQUEST end
if lang == 'suigui_mainautoLoot' then lang = L_GUI_MAIN_AUTOLOOT end
if lang == 'suigui_mainautoMerchant' then lang = L_GUI_MAIN_AUTOMERCHANT end
if lang == 'suigui_main_dpsMeter' then lang = L_GUI_MAIN_DPSMETER end
if lang == 'suigui_main_dpsMeterLayout' then lang = L_GUI_MAIN_DPSMETERLAYOUT end
if lang == 'suigui_main_dpsMeterTitle' then lang = L_GUI_MAIN_DPSMETERTITLE end
if lang == 'suigui_main_dpsMeterFade' then lang = L_GUI_MAIN_DPSMETERFADE end
if lang == 'suigui_main_dpsMeterCombat' then lang = L_GUI_MAIN_DPSMETERCOMBAT end
if lang == 'suigui_main_dpsMeterLock' then lang = L_GUI_MAIN_DPSMETERLOCK end
if lang == 'suigui_mainfont' then lang = L_GUI_MAIN_FONT end
if lang == 'suigui_mainshadow' then lang = L_GUI_MAIN_SHADOW end
if lang == 'suigui_mainfontSize' then lang = L_GUI_MAIN_FONTSIZE end
if lang == 'suigui_mainw' then lang = L_GUI_MAIN_INFO1 end
if lang == 'suigui_mainz' then lang = L_GUI_MAIN_INFO2 end
if lang == 'suigui_mainx' then lang = L_GUI_MAIN_INFO3 end
if lang == 'suigui_mainy' then lang = L_GUI_MAIN_INFO4 end
--// Action Bar //--
if lang == 'suigui_bar' then lang = L_GUI_AB end
if lang == 'suigui_barenable' then lang = L_GUI_AB_ENABLE end
if lang == 'suigui_barscale' then lang = L_GUI_AB_SCALE end
if lang == 'suigui_barstyleAB' then lang = L_GUI_AB_STYLE end
if lang == 'suigui_barmacroName' then lang = L_GUI_AB_MACRO end
if lang == 'suigui_barbackground' then lang = L_GUI_AB_BACKGROUND end
if lang == 'suigui_barstripArts' then lang = L_GUI_AB_STRIPARTS end
if lang == 'suigui_barcaps' then lang = L_GUI_AB_ENDCAPS end
if lang == 'suigui_bar_bpackIcon' then lang = L_GUI_AB_BPACK end
if lang == 'suigui_bar_menuIcon' then lang = L_GUI_AB_MENU end
--// Bags //--
if lang == 'suigui_bags' then lang = L_GUI_BAGS end
if lang == 'suigui_bagsenable' then lang = L_GUI_BAGS_ENABLE end
if lang == 'suigui_bagsbagSize' then lang = L_GUI_BAGS_SIZE end
if lang == 'suigui_bagsbagSpace' then lang = L_GUI_BAGS_SPACE end
if lang == 'suigui_bagsbagColumns' then lang = L_GUI_BAGS_COLUMNS end
if lang == 'suigui_bagsbankColumns' then lang = L_GUI_BAGS_BANKCOLUMNS end
if lang == 'suigui_bagsw' then lang = L_GUI_BAGS_INFO1 end
--// Chat //--
if lang == 'suigui_main_chat' then lang = L_GUI_CHAT_ENABLE end
if lang == 'suigui_main_chatOrient' then lang = L_GUI_CHAT_ORIENT end
if lang == 'suigui_main_chatEmote' then lang = L_GUI_CHAT_EMOTE end
if lang == 'suigui_main_chatTime' then lang = L_GUI_CHAT_TIME end
if lang == 'suigui_main_chatTab' then lang = L_GUI_CHAT_TAB end
if lang == 'suigui_main_chatCopy' then lang = L_GUI_CHAT_COPY end
--// UF //--
if lang == 'suigui_units' then lang = L_GUI_UNITS end
if lang == 'suigui_unitsclassPortraits' then lang = L_GUI_UNITS_CLASSPORTRAIT end
if lang == 'suigui_unitsunitStyleFat' then lang = L_GUI_UNITS_FAT_STYLE end
if lang == 'suigui_unitsstatusbar' then lang = L_GUI_UNITS_STATUSBARS end
if lang == 'suigui_unitssmoothing' then lang = L_GUI_UNITS_SMOOTH end
if lang == 'suigui_unitsauraTimer' then lang = L_GUI_UNITS_AURATIMER end
if lang == 'suigui_unitsauraAnchor' then lang = L_GUI_UNITS_AURAPOS end
if lang == 'suigui_unitsauraPlayer' then lang = L_GUI_UNITS_AURASELF end
if lang == 'suigui_unitsenchantoUF' then lang = L_GUI_UNITS_ENCHANTOUF end
if lang == 'suigui_unitscombatText' then lang = L_GUI_UNITS_COMBATTEXT end
if lang == 'suigui_unitsthreatGlow' then lang = L_GUI_UNITS_THREATGLOW end
if lang == 'suigui_unitsstatusFlash' then lang = L_GUI_UNITS_STATUSFLASH end
if lang == 'suigui_unitsstatusCombat' then lang = L_GUI_UNITS_COMBAT end
if lang == 'suigui_unitscomboPoints' then lang = L_GUI_UNITS_COMBOPOINTS end
if lang == 'suigui_unitscpAsNumber' then lang = L_GUI_UNITS_CPNUMBER end
if lang == 'suigui_unitsshowParty' then lang = L_GUI_UNITS_SHOWPARTY end
if lang == 'suigui_unitspartyInRaid' then lang = L_GUI_UNITS_PARTYRAID end
if lang == 'suigui_unitscastbarTicks' then lang = L_GUI_UNITS_CBTICK end
if lang == 'suigui_unitscastbarColor' then lang = L_GUI_UNITS_CBCOLORS end
if lang == 'suigui_unitsabsorbBar' then lang = L_GUI_UNITS_ABSORB end
if lang == 'suigui_unitshealComm' then lang = L_GUI_UNITS_HEALCOMM end
if lang == 'suigui_unitsw' then lang = L_GUI_UNITS_INFO1 end
if lang == 'suigui_unitsz' then lang = L_GUI_UNITS_INFO2 end
if lang == 'suigui_unitsx' then lang = L_GUI_UNITS_INFO3 end
--// Tip //--
if lang == 'suigui_tooltip' then lang = L_GUI_TIP end
if lang == 'suigui_tooltipenable' then lang = L_GUI_TIP_ENABLE end
if lang == 'suigui_tooltipshowInCombat' then lang = L_GUI_TIP_HIDE_INCOMBAT end
if lang == 'suigui_tooltipshowUnits' then lang = L_GUI_TIP_HIDE_UNITS end
if lang == 'suigui_tooltipcursor' then lang = L_GUI_TIP_CURSOR end
if lang == 'suigui_tooltipw' then lang = L_GUI_TIP_INFO1 end
--// CombatText //--
if lang == 'suigui_ct' then lang = L_GUI_CT end
if lang == 'suigui_ctmoduleEnable' then lang = L_GUI_CT_ENABLE end
if lang == 'suigui_ctshowBlizzOut' then lang = L_GUI_CT_BLIZZNUM end
if lang == 'suigui_ctstyleDps' then lang = L_GUI_CT_DMGSTYLE end
if lang == 'suigui_ctdps' then lang = L_GUI_CT_DAMAGE end
if lang == 'suigui_cthealing' then lang = L_GUI_CT_HEALING end
if lang == 'suigui_cthealingOver' then lang = L_GUI_CT_OVERHEAL end
if lang == 'suigui_ct_petDps' then lang = L_GUI_CT_PETDMG end
if lang == 'suigui_ct_dotDps' then lang = L_GUI_CT_DOTDMG end
if lang == 'suigui_ct_hotDps' then lang = L_GUI_CT_HOTS end
if lang == 'suigui_ct_colorDps' then lang = L_GUI_CT_COLORS end
if lang == 'suigui_ctcrit_prefix' then lang = L_GUI_CT_CRITPREFIX end
if lang == 'suigui_ctcrit_postfix' then lang = L_GUI_CT_POSTFIX end
if lang == 'suigui_cticons' then lang = L_GUI_CT_ICONS end
if lang == 'suigui_cticonSize' then lang = L_GUI_CT_ICONSIZE end
if lang == 'suigui_ctthreshold' then lang = L_GUI_CT_THRESHOLD end
if lang == 'suigui_ctheal_threshold' then lang = L_GUI_CT_HEALTHRESHOLD end
if lang == 'suigui_ctscrollable' then lang = L_GUI_CT_SCROLLABLE end
if lang == 'suigui_ctmax_lines' then lang = L_GUI_CT_MAXLINE end
if lang == 'suigui_cttime_visible' then lang = L_GUI_CT_SHOWTIME end
if lang == 'suigui_ctshowKilling' then lang = L_GUI_CT_KILLINGBLOW end
if lang == 'suigui_ctmergeAoE' then lang = L_GUI_CT_AOESPAM end
if lang == 'suigui_ctmergeMelee' then lang = L_GUI_CT_MELEE end
if lang == 'suigui_ct_tellDispel' then lang = L_GUI_CT_DISPEL end
if lang == 'suigui_ct_tellInter' then lang = L_GUI_CT_INTERRUPT end
if lang == 'suigui_ctdirection' then lang = L_GUI_CT_DIRECTION end
if lang == 'suigui_ctshortNum' then lang = L_GUI_CT_SHORTNUMBERS end
if lang == 'suigui_ctw' then lang = L_GUI_CT_INFO1 end
if lang == 'suigui_ctz' then lang = L_GUI_CT_INFO2 end
if lang == 'suigui_ctx' then lang = L_GUI_CT_INFO3 end
E.option = lang
end |
--[[
Takes a table and returns the field count
]]
return function(t)
local fieldCount = 0
for _ in pairs(t) do
fieldCount = fieldCount + 1
end
return fieldCount
end |
local M = {}
-- interface: https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#binarySearch(float[],%20int,%20int,%20float)
-- (but conforming to Lua 1-based table indexes instead of Java's 0-based indexes)
-- implementation: https://stackoverflow.com/questions/19522451/binary-search-of-an-array-of-arrays-in-lua
M.binarySearch = function(a, fromIndex, toIndex, key)
fromIndex = fromIndex or 1
assert(fromIndex >= 1)
toIndex = toIndex or #a+1
while fromIndex < toIndex do
local mid = math.floor((fromIndex+toIndex) / 2)
local midVal = a[mid]
if midVal < key then
fromIndex = mid+1
elseif midVal > key then
toIndex = mid
else
return mid
end
end
return -fromIndex
end
M.head = function(a)
if #a > 0 then return a[1] end
end
M.lastOption = function(a)
if #a > 0 then return a[#a] end
end
M.tabulate = function(n, f)
local res = {}
for i = 0, n-1 do
res[#res+1] = f(i)
end
return res
end
M.tail = function(a)
local unpack = table.unpack or unpack
return {unpack(a, 2, #a)}
end
return M
|
--[[--------------------------------------------------
GUI Editor
client
item_resolution.lua
define the resolution right click menu items
--]]--------------------------------------------------
function createItem_resolution()
return MenuItem_Toggle:create(false, "Preview in resolution"):set({onClick = resolutionPreview.setup})
end
function createItem_resolutionCustomTitle()
return MenuItem_Text:create("Use Custom"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__sibling:11", "__parentItem"}})
end
function createItem_resolutionCustom()
return MenuItem_Text:create("Custom: %value"):set({onClickClose = false, clickable = false, replaceValue = "WIDTHxHEIGHT", editbox = {filter = gFilters.resolution}})
end
function createItem_resolution640x480()
return MenuItem_Text:create("640 x 480"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution800x600()
return MenuItem_Text:create("800 x 600"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1024x768()
return MenuItem_Text:create("1024 x 768"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1280x768()
return MenuItem_Text:create("1280 x 768"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1280x1024()
return MenuItem_Text:create("1280 x 1024"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1440x900()
return MenuItem_Text:create("1440 x 900"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1680x1050()
return MenuItem_Text:create("1680 x 1050"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1920x1080()
return MenuItem_Text:create("1920 x 1080"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
function createItem_resolution1920x1200()
return MenuItem_Text:create("1920 x 1200"):set({onClick = resolutionPreview.setResolution, onClickArgs = {"__self", "__parentItem"}})
end
--[[
640x480
800x600
1024x768
1280x768
1280x1024
1440x900
1680x1050
1920x1080
1920x1200
]] |
local inspect = require 'Data.lua.inspect'
print("Current SkyBox Is: ");
print(inspect(eyeGetSkyBox()));
print("List of All SkyBox:");
print(inspect(eyeGetAllSkyBox()));
print("Set SkyBox to SkyCube_Evergreen03a.dds");
eyeSetSkyBox("SkyCube_Evergreen03a.dds");
eyeDisableSkyBox();
eyeSetSkyBoxColor({0,255,0,128}); |
NMS_MOD_DEFINITION_CONTAINER =
{
["MOD_FILENAME"] = "AlwaysDay.pak",
["MOD_AUTHOR"] = "Mjjstral",
["NMS_VERSION"] = "1.77", --version on first mod release
["MOD_DESCRIPTION"] = "", --optional, not used
["MODIFICATIONS"] =
{
{
["PAK_FILE_SOURCE"] = "NMSARC.59B126E2.pak", --globals
["MBIN_CHANGE_TABLE"] =
{
{
["MBIN_FILE_SOURCE"] = "GCSKYGLOBALS.GLOBALS.MBIN",
["EXML_CHANGE_TABLE"] =
{
{
["PRECEDING_KEY_WORDS"] = "", -- use a single string or a list = {"PrecedingKeyWord1", "PrecedingKeyWord2"}, leave empty "" or {} if not necessary
["VALUE_CHANGE_TABLE"] =
{
{"MinNightFade", "1.0"}, -- Original "0.62" always leave the orig. value as a reference
{"MaxNightFade", "1.0"}, -- Original "0.68"
}
}, --for multiple EXML changes with PRECEDING_KEY_WORDS copy this chunk below and add a comma behind this line here
}
}, --for multiple MBIN sources: copy this chunk below and add a comma behind this line here
}
}, --for multiple pak sources: copy this chunk below and add a comma behind this line here
}
}
--NOTE: ANYTHING NOT in table NMS_MOD_DEFINITION_CONTAINER IS IGNORED AFTER THE SCRIPT IS LOADED
--IT IS BETTER TO ADD THINGS AT THE TOP IF YOU NEED TO
--DON'T ADD ANYTHING PASS THIS POINT HERE |
--[[
Author: Noya
Date: 9.1.2015.
Plays a looping and stops after the duration
]]
function AcidSpraySound( event )
local target = event.target
local ability = event.ability
local duration = ability:GetLevelSpecialValueFor( "duration", ability:GetLevel() - 1 )
target:EmitSound("Hero_Alchemist.AcidSpray")
-- Stops the sound after the duration, a bit early to ensure the thinker still exists
Timers:CreateTimer(duration-0.1, function()
target:StopSound("Hero_Alchemist.AcidSpray")
end)
end |
local entity = {}
entity["level"] = [[79]]
entity["spellDeck"] = {}
entity["spellDeck"][1] = [[Megidola]]
entity["spellDeck"][2] = [[]]
entity["spellDeck"][3] = [[Maragidyne]]
entity["spellDeck"][4] = [[]]
entity["spellDeck"][5] = [[]]
entity["spellDeck"][6] = [[]]
entity["heritage"] = {}
entity["heritage"][1] = [[Light]]
entity["heritage"][2] = [[Dark]]
entity["resistance"] = {}
entity["resistance"][1] = [[Normal]]
entity["resistance"][2] = [[Normal]]
entity["resistance"][3] = [[Normal]]
entity["resistance"][4] = [[Repel]]
entity["resistance"][5] = [[Normal]]
entity["resistance"][6] = [[Normal]]
entity["resistance"][7] = [[Weak]]
entity["resistance"][8] = [[Normal]]
entity["resistance"][9] = [[Repel]]
entity["desc"] = [[The prince of darkness in Judeo-Christian lore, know for his role in the snake that tempted Adam and Eve at Eden. It is also said he is sent by God to test man's piety.]]
entity["arcana"] = [[Judgement]]
entity["stats"] = {}
entity["stats"][1] = [[51]]
entity["stats"][2] = [[60]]
entity["stats"][3] = [[52]]
entity["stats"][4] = [[47]]
entity["stats"][5] = [[58]]
entity["name"] = [[Satan]]
entity["spellLearn"] = {}
entity["spellLearn"]["Regenerate 3"] = [[81]]
entity["spellLearn"]["Black Viper"] = [[86]]
entity["spellLearn"]["Invigorate 3"] = [[82]]
entity["spellLearn"]["Repel Light"] = [[83]]
return entity
|
help(
[[
elastix is open source software, based on the well-known Insight Segmentation and Registration Toolkit (ITK). The software consists of a collection of algorithms that are commonly used to solve (medical) image registration problems. The modular design of elastix allows the user to quickly configure, test, and compare different registration methods for a specific application. A command-line interface enables automated processing of large numbers of data sets, by means of scripting.
]])
whatis("Loads elastix into the environment")
local version = "2015"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/elastix/"..version
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib"))
family('elastix')
|
-----------------------------------------
-- ID: 4994
-- Scroll of Mages Ballad
-- Teaches the song Mages Ballad
-----------------------------------------
function onItemCheck(target)
return target:canLearnSpell(386)
end
function onItemUse(target)
target:addSpell(386)
end
|
local games = require("Games")
local misc = require("Misc")
local werewords = {}
werewords.desc = "A social deduction game for 4-10 players. One player picks a secret word, and the other players ask them yes or no questions to try to deduce it. Certain players are secretly werewolves, and trying to prevent the word from being guessed."
werewords.rules = "http://werewords.com/rules.php?ver=2"
local werewordsLoadWordlist, werewordsCreateGameInstance, werewordsMessageGame, werewordsMessagePlayer, werewordsGetTellerWord, werewordsAssignRoles
local werewordsSendWordOptions, werewordsFinishNight, werewordsCheckForEnd, werewordsExitGame, werewordsSendWordLists, werewordsPickWord, werewordsTokenStatus
local werewordsYes, werewordsNo, werewordsWhat, werewordsClose, werewordsWayOff, werewordsObjection, werewordsSuccess
--#############################################################################################################################################
--# Configurations #
--#############################################################################################################################################
local RULESETS = {
W = {"Werewolf"},
WF = {"Werewolf", "Fortune Teller"},
WS = {"Werewolf", "Seer"},
WSF = {"Werewolf", "Seer", "Fortune Teller"},
WWS = {"Werewolf", "Werewolf", "Seer"},
WWSF = {"Werewolf", "Werewolf", "Seer", "Fortune Teller"},
["20Q"] = {}
}
local WORDLISTS = {
"supereasy", "easy", "medium", "hard", "ridiculous"
}
--#############################################################################################################################################
--# Main Functions #
--#############################################################################################################################################
function werewords.startGame(message, players)
--[[Start a new Werewords game]]
local args = message.content:split(" ")
local state = werewordsCreateGameInstance()
local playerList = {}
for idx,playerObj in pairs(players) do playerList[playerObj.id] = playerObj end
state["GameChannel"] = message.channel
state["Mayor"] = message.author
state["Mode"] = args[3]
state["PlayerList"] = playerList
ruleset = args[4]
games.registerGame(message.channel, "Werewords", state, players)
message.channel:send("Starting game...")
-- Start game
werewordsAssignRoles(state["PlayerList"], ruleset, state)
werewordsSendWordOptions(state)
message.channel:send("Roles sent out...")
end
function werewords.commandHandler(message, state)
--[[Handle commands for a Werewords game]]
local args = message.content:split(" ")
local channel = message.channel
local author = message.author
-- Save the message as the last question, in case the mayor answers it
if author ~= state["Mayor"] then
state["LastQuestion"] = message
end
-- Anytime commands
if args[1] == "!wordlists" then
werewordsSendWordLists(channel)
return
elseif args[1] == "!end" or args[1] == "!quit" then
werewordsExitGame(channel, state)
return
elseif args[1] == "!tokens" then
werewordsTokenStatus(state)
return
end
-- Mayor commands
if author == state["Mayor"] then
if args[1] == "!yes" then
werewordsYes(message, state)
return
elseif args[1] == "!no" then
werewordsNo(message, state)
return
elseif args[1] == "!what" then
werewordsWhat(message, state)
return
elseif args[1] == "!close" then
werewordsClose(message, state)
return
elseif args[1] == "!wayoff" then
werewordsWayOff(message, args[2], state)
return
elseif args[1] == "!success" then
werewordsSuccess(message, state)
return
end
end
end
function werewords.dmHandler(message, state)
--[[Handle commands that take place in DMs]]
local args = message.content:split(" ")
local author = message.author
if author == state["Mayor"] then
if args[1] == "!pick" then
werewordsPickWord(state, args[2])
return
end
end
if author == state["Seer"] then
if args[1] == "!objection" then
werewordsObjection(state)
end
end
end
--#############################################################################################################################################
--# Utility Functions #
--#############################################################################################################################################
function werewordsLoadWordlist(mode)
local file = "words/words_" .. mode .. ".csv"
if misc.fileExists(file) then
return misc.parseCSV(file)
else
return nil
end
end
function werewordsCreateGameInstance()
--[[Returns a new empty game instance]]
local instance = {
GameChannel = nil,
Mayor = nil,
Seer = nil,
Mode = nil,
PlayerList = nil,
Word = nil,
WordsTemp = nil,
BasicToken = 36,
QuestionToken = 10,
WayOffToken = 1,
SoCloseToken = 1,
SeerToken = 1,
LastQuestion = nil
}
return instance
end
function werewordsMessageGame(string, state)
state["GameChannel"]:send(string)
end
function werewordsMessagePlayer(player, string)
player:send(string)
end
--#############################################################################################################################################
--# Game Functions #
--#############################################################################################################################################
function werewordsGetTellerWord(str)
--[[Takes a string and returns a version of it with each letter replaced with a dash, except the first letter of each word.]]
local output = ""
local first = true
for i=1, #str do
local char = str:sub(i,i)
if first == true then
output = output .. char
first = false
elseif char == " " then
output = output .. " "
first = true
elseif first == false then
output = output .. "-"
end
end
return output
end
function werewordsAssignRoles(players, ruleset, state)
--[[Assigns roles to every player in the current game
players: a list of players, as generated by message.mentionedUsers when the command to start the game is sent
ruleset: the string corresponding to a ruleset (eg "WSF")]]
-- Shuffle players
-- If ruleset doesn't exist, error
if RULESETS[ruleset] == nil then
werewordsMessageGame("Error! Role list does not exist.", state)
werewordsExitGame(state["GameChannel"], state)
return
end
-- Assign player roles
local shuffledPlayers = misc.shuffleTable(misc.shallowCopy(misc.indexifyTable(players)))
local playerList = {}
local specialRoles = misc.shallowCopy(RULESETS[ruleset])
for i, player in pairs(shuffledPlayers) do
if specialRoles[i] ~= nil then
playerList[i] = {player, specialRoles[i]}
-- If special role is Seer, save a reference to the player
if specialRoles[i] == "Seer" then
state["Seer"] = player
end
else
playerList[i] = {player, "Vanilla Townie"}
end
werewordsMessagePlayer(player, "You are: " .. playerList[i][2])
end
state["PlayerList"] = misc.shuffleTable(playerList)
end
function werewordsSendWordOptions(state)
-- If word list doesn't exist, error
-- It pains me to do this on every game startup, but it avoids me having to put a werewords-specific global in Games.lua
local list = werewordsLoadWordlist(state["Mode"])
if list == nil then
werewordsMessageGame("Error! Word list does not exist.", state)
werewordsSendWordLists(state["GameChannel"])
werewordsExitGame(state["GameChannel"], state)
end
-- Pick four words at random and send them to the mayor
local words = {list[math.random(#list)],list[math.random(#list)],list[math.random(#list)],list[math.random(#list)]}
output = "Your word choices are:\n1: " .. words[1] .. "\n2: " .. words[2] .. "\n3: " .. words[3] .. "\n4: " .. words[4]
state["WordsTemp"] = words
werewordsMessagePlayer(state["Mayor"], output)
end
--##########################
--######## ADD ROLES HERE ##
--##########################
function werewordsFinishNight(state)
for idx,playerInfo in pairs(state["PlayerList"]) do
local player = playerInfo[1]
-- WEREWOLF:
if playerInfo[2] == "Werewolf" then
-- Inform of word
werewordsMessagePlayer(player, "The word is: " .. state["Word"])
-- Inform of all other werewolves
for idx2,playerInfo2 in pairs(state["PlayerList"]) do
if idx ~= idx2 and playerInfo2[2] == "Werewolf" then
werewordsMessagePlayer(player, playerInfo2[1].name .. " is a werewolf!")
end
end
-- SEER:
elseif playerInfo[2] == "Seer" then
werewordsMessagePlayer(player, "The word is: " .. state["Word"])
-- APPRENTICE:
elseif playerInfo[2] == "Fortune Teller" then
local censoredWord = werewordsGetTellerWord(state["Word"])
werewordsMessagePlayer(player, "The word is: " .. censoredWord)
end
end
werewordsMessageGame("The game has begun!", state)
end
function werewordsCheckForEnd()
-- Check for Wolf Win end and if it's the case, have Town vote on wolves
end
--#############################################################################################################################################
--# Commands #
--#############################################################################################################################################
function werewordsExitGame(channel, state)
werewordsMessageGame("Quitting game...", state)
games.deregisterGame(channel)
end
function werewordsSendWordLists(channel)
local output = "Currently available wordlists:\n"
for idx,name in pairs(WORDLISTS) do
output = output .. name .. "\n"
end
channel:send(output)
end
function werewordsPickWord(state, idx)
local tempWords = state["WordsTemp"]
local mayor = state["Mayor"]
if tempWords == nil then
werewordsMessagePlayer(mayor, "Error: It's not time to pick a word!")
elseif idx == "mulligan" then
werewordsMessagePlayer(mayor, "Picking new words...")
werewordsSendWordOptions()
return
elseif idx == "1" or idx == "2" or idx == "3" or idx == "4" then
state["Word"] = tempWords[tonumber(idx)]
state["WordsTemp"] = nil
werewordsMessagePlayer(mayor, "The word is: " .. state["Word"])
werewordsFinishNight(state)
else
werewordsMessagePlayer(mayor, "Usage: !pick [1-4 or mulligan]")
end
end
function werewordsTokenStatus(state)
output = "Yes/No: " .. state["BasicToken"] .. " Maybe: " .. state["QuestionToken"]
.. " So Close: " .. state["SoCloseToken"] .. " Way Off: " .. state["WayOffToken"]
.. " Seer: " .. state["SeerToken"]
werewordsMessageGame(output, state)
end
function werewordsYes(message, state)
message:delete()
state["LastQuestion"]:addReaction("✅") --%E2%9C%85
state["BasicToken"] = state["BasicToken"] - 1
werewordsCheckForEnd()
end
function werewordsNo(message, state)
message:delete()
state["LastQuestion"]:addReaction("❌") --%E2%9D%8C
state["BasicToken"] = state["BasicToken"] - 1
werewordsCheckForEnd()
end
function werewordsWhat(message, state)
message:delete()
-- If there's no question toknes left, quietly inform the mayor that they fucked up and hope nobody notices!
if state["QuestionToken"] > 0 then
state["LastQuestion"]:addReaction("🤔") --%F0%9F%A4%94
state["QuestionToken"] = state["QuestionToken"] - 1
else
werewordsMessagePlayer(state["Mayor"], "You have no Maybe tokens left! Answer with something else.")
end
end
function werewordsClose(message, state)
message:delete()
-- If the token is used up, substitute a werewordsYes instead
if state["SoCloseToken"] > 0 then
state["LastQuestion"]:addReaction("❕") --%E2%9D%95
state["SoCloseToken"] = state["SoCloseToken"] - 1
else
state["LastQuestion"]:addReaction("✅") --%E2%9C%85
state["BasicToken"] = state["BasicToken"] - 1
werewordsCheckForEnd()
end
end
function werewordsWayOff(message, target, state)
message:delete()
-- If target is nil, way off is played to the table; otherwise, it's to a specific player
if state["WayOffToken"] > 0 then
if target == nil then
werewordsMessageGame("Y'all are way off!", state)
else
werewordsMessageGame(target .. " is way off!", state)
end
state["WayOffToken"] = state["WayOffToken"] - 1
else
werewordsMessagePlayer(state["Mayor"], "You have already used your Way Off token!")
end
end
function werewordsObjection(state)
if state["SeerToken"] > 0 then
werewordsMessageGame("https://www.clipartmax.com/png/middle/5-52205_clipart-info-phoenix-wright-objection-png.png", state)
state["SeerToken"] = state["SeerToken"] - 1
else
werewordsMessagePlayer(state["Seer"], "You have no Seer tokens left!")
end
end
function werewordsSuccess(message, state)
-- Handle Town Win end (have Wolves guess seer/teller)
end
return werewords |
-- Path of Building
--
-- Class: Calc Breakdown Control
-- Calculation breakdown control used in the Calcs tab
--
local t_insert = table.insert
local m_max = math.max
local m_min = math.min
local m_ceil = math.ceil
local m_floor = math.floor
local m_sin = math.sin
local m_cos = math.cos
local m_pi = math.pi
local band = bit.band
local CalcBreakdownClass = newClass("CalcBreakdownControl", "Control", "ControlHost", function(self, calcsTab)
self.Control()
self.ControlHost()
self.calcsTab = calcsTab
self.shown = false
self.tooltip = new("Tooltip")
self.nodeViewer = new("PassiveTreeView")
self.rangeGuide = NewImageHandle()
self.rangeGuide:Load("Assets/range_guide.png")
self.uiOverlay = NewImageHandle()
self.uiOverlay:Load("Assets/game_ui_small.png")
self.controls.scrollBar = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, -2, 0, 18, 0, 80, "VERTICAL", true)
end)
function CalcBreakdownClass:IsMouseOver()
if not self:IsShown() then
return
end
return self:IsMouseInBounds() or self:GetMouseOverControl()
end
function CalcBreakdownClass:SetBreakdownData(displayData, pinned)
self.pinned = pinned
if displayData == self.sourceData then
return
end
self.sourceData = displayData
self.shown = false
if not displayData then
return
end
-- Build list of sections
self.sectionList = wipeTable(self.sectionList)
for _, sectionData in ipairs(displayData) do
if self.calcsTab:CheckFlag(sectionData) then
if sectionData.breakdown then
self:AddBreakdownSection(sectionData)
elseif sectionData.modName then
self:AddModSection(sectionData)
end
end
end
if #self.sectionList == 0 then
self.calcsTab:ClearDisplayStat()
return
end
self.shown = true
-- Determine the size of each section, and the combined content size of the breakdown
self.contentWidth = 0
local offset = 2
for i, section in ipairs(self.sectionList) do
if section.type == "TEXT" then
section.width = 0
for _, line in ipairs(section.lines) do
local _, num = string.gsub(line, "%d%d%d%d", "") -- count how many commas will be added
if main.showThousandsCalcs and num > 0 then
section.width = m_max(section.width, DrawStringWidth(section.textSize, "VAR", line) + 8 + (4 * num))
else
section.width = m_max(section.width, DrawStringWidth(section.textSize, "VAR", line) + 8)
end
end
section.height = #section.lines * section.textSize + 4
elseif section.type == "TABLE" then
-- This also calculates the width of each column in the table
section.width = 4
for _, col in pairs(section.colList) do
for _, row in pairs(section.rowList) do
if row[col.key] then
local _, num = string.gsub(row[col.key], "%d%d%d%d", "") -- count how many commas will be added
if main.showThousandsCalcs and num > 0 then
col.width = m_max(col.width or 0, DrawStringWidth(16, "VAR", col.label) + 6, DrawStringWidth(12, "VAR", row[col.key]) + 6 + (4 * num))
else
col.width = m_max(col.width or 0, DrawStringWidth(16, "VAR", col.label) + 6, DrawStringWidth(12, "VAR", row[col.key]) + 6)
end
end
end
if col.width then
section.width = section.width + col.width
end
end
section.height = #section.rowList * 14 + 20
if section.label then
self.contentWidth = m_max(self.contentWidth, 6 + DrawStringWidth(16, "VAR", section.label..":"))
section.height = section.height + 16
end
if section.footer then
self.contentWidth = m_max(self.contentWidth, 6 + DrawStringWidth(12, "VAR", section.footer))
section.height = section.height + 12
end
end
self.contentWidth = m_max(self.contentWidth, section.width)
section.offset = offset
offset = offset + section.height + 8
end
self.contentHeight = offset - 6
end
-- Add sections based on the breakdown data generated by the Calcs module
function CalcBreakdownClass:AddBreakdownSection(sectionData)
local actor = self.calcsTab.input.showMinion and self.calcsTab.calcsEnv.minion or self.calcsTab.calcsEnv.player
local breakdown
local ns, name = sectionData.breakdown:match("^(%a+)%.(%a+)$")
if ns then
breakdown = actor.breakdown[ns] and actor.breakdown[ns][name]
else
breakdown = actor.breakdown[sectionData.breakdown]
end
if not breakdown then
return
end
if #breakdown > 0 then
-- Text lines
t_insert(self.sectionList, {
type = "TEXT",
lines = breakdown,
textSize = 16
})
end
if breakdown.radius then
-- Radius visualiser
t_insert(self.sectionList, {
type = "RADIUS",
radius = breakdown.radius,
width = 8 + 1920/4,
height = 4 + 1080/4,
})
end
if breakdown.rowList and #breakdown.rowList > 0 then
-- Generic table
local section = {
type = "TABLE",
label = breakdown.label,
footer = breakdown.footer,
rowList = breakdown.rowList,
colList = breakdown.colList,
}
t_insert(self.sectionList, section)
end
if breakdown.reservations and #breakdown.reservations > 0 then
-- Reservations table, used for life/mana reservation breakdowns
local section = {
type = "TABLE",
rowList = breakdown.reservations,
colList = {
{ label = "Skill", key = "skillName" },
{ label = "Base", key = "base" },
{ label = "MCM", key = "mult" },
{ label = "More/less", key = "more" },
{ label = "Inc/red", key = "inc" },
{ label = "Reservation", key = "total" },
}
}
t_insert(self.sectionList, section)
end
if breakdown.damageTypes and #breakdown.damageTypes > 0 then
local section = {
type = "TABLE",
rowList = breakdown.damageTypes,
colList = {
{ label = "From", key = "source", right = true },
{ label = "Base", key = "base" },
{ label = "Inc/red", key = "inc" },
{ label = "More/less", key = "more" },
{ label = "Converted Damage", key = "convSrc" },
{ label = "Total", key = "total" },
{ label = "Conversion", key = "convDst" },
}
}
t_insert(self.sectionList, section)
end
if breakdown.slots and #breakdown.slots > 0 then
-- Slots table, used for armour/evasion/ES total breakdowns
local colList
local rowList
if (sectionData.gearOnly) then
-- Only show basic table for gear and base ES/Armour/Evasion value
colList = {
{ label = "Value", key = "base", right = true },
{ label = "Source", key = "source" },
{ label = "Name", key = "sourceLabel" },
}
rowList = {}
for _, row in pairs(breakdown.slots) do
if (row.item and row.item.armourData) then
table.insert(rowList, row)
end
end
else
colList = {
{ label = "Base", key = "base", right = true },
{ label = "Inc/red", key = "inc" },
{ label = "More/less", key = "more" },
{ label = "Total", key = "total", right = true },
{ label = "Source", key = "source" },
{ label = "Name", key = "sourceLabel" },
}
rowList = breakdown.slots
end
local section = {
type = "TABLE",
rowList = rowList,
colList = colList,
}
t_insert(self.sectionList, section)
for _, row in pairs(section.rowList) do
if row.item then
row.sourceLabel = colorCodes[row.item.rarity]..row.item.name
row.sourceLabelTooltip = function(tooltip)
self.calcsTab.build.itemsTab:AddItemTooltip(tooltip, row.item, row.source)
end
else
row.sourceLabel = row.sourceName
end
end
end
if breakdown.modList and #breakdown.modList > 0 then
-- Provided mod list
self:AddModSection(sectionData, breakdown.modList)
end
end
-- Add a table section showing a list of modifiers
function CalcBreakdownClass:AddModSection(sectionData, modList)
local actor = self.calcsTab.input.showMinion and self.calcsTab.calcsEnv.minion or self.calcsTab.calcsEnv.player
local build = self.calcsTab.build
-- Build list of modifiers to display
local cfg = (sectionData.cfg and actor.mainSkill[sectionData.cfg.."Cfg"] and copyTable(actor.mainSkill[sectionData.cfg.."Cfg"], true)) or { }
cfg.source = sectionData.modSource
local rowList
local modStore = (sectionData.enemy and actor.enemy.modDB) or (sectionData.cfg and actor.mainSkill.skillModList) or actor.modDB
if modList then
rowList = modList
else
if type(sectionData.modName) == "table" then
rowList = modStore:Tabulate(sectionData.modType, cfg, unpack(sectionData.modName))
else
rowList = modStore:Tabulate(sectionData.modType, cfg, sectionData.modName)
end
end
if #rowList == 0 then
return
end
-- Create section data
local section = {
type = "TABLE",
label = sectionData.label,
rowList = rowList,
colList = {
{ label = "Value", key = "displayValue" },
{ label = "Stat", key = "name" },
{ label = "Skill types", key = "flags" },
{ label = "Notes", key = "tags" },
{ label = "Source", key = "source" },
{ label = "Source Name", key = "sourceName" },
},
}
t_insert(self.sectionList, section)
if not modList and not sectionData.modType then
-- Sort modifiers by type
for i, row in ipairs(rowList) do
row.index = i
end
table.sort(rowList, function(a, b)
if a.mod.type == b.mod.type then
return a.index < b.index
else
return a.mod.type < b.mod.type
end
end)
end
local sourceTotals = { }
if not modList and not sectionData.modSource then
-- Build list of totals from each modifier source
local types = { }
local typeList = { }
for i, row in ipairs(rowList) do
-- Find all the modifier types and source types that are present in the modifier list
if not types[row.mod.type] then
types[row.mod.type] = true
t_insert(typeList, row.mod.type)
end
if not row.mod.source then
ConPrintTable(row.mod)
end
local sourceType = row.mod.source:match("[^:]+")
if not sourceTotals[sourceType] then
sourceTotals[sourceType] = { }
end
end
for sourceType, lines in pairs(sourceTotals) do
cfg.source = sourceType
for _, modType in ipairs(typeList) do
if type(sectionData.modName) == "table" then
-- Multiple stats, show each separately
for _, modName in ipairs(sectionData.modName) do
local total = modStore:Combine(modType, cfg, modName)
if modType == "MORE" then
total = round((total - 1) * 100)
end
if total and total ~= 0 then
t_insert(lines, self:FormatModValue(total, modType) .. " " .. modName:gsub("(%l)(%u)","%1 %2"))
end
end
else
local total = modStore:Combine(modType, cfg, sectionData.modName)
if modType == "MORE" then
total = round((total - 1) * 100)
end
if total and total ~= 0 then
t_insert(lines, self:FormatModValue(total, modType))
end
end
end
end
end
-- Process modifier data
for _, row in ipairs(rowList) do
if not sectionData.modType then
-- No modifier type specified, so format the value to convey type
row.displayValue = self:FormatModValue(row.value, row.mod.type)
else
section.colList[1].right = true
row.displayValue = formatRound(row.value, 2)
end
if modList or type(sectionData.modName) == "table" then
-- Multiple stat names specified, add this modifier's stat to the table
row.name = self:FormatModName(row.mod.name)
end
local sourceType = row.mod.source:match("[^:]+")
if not modList and not sectionData.modSource then
-- No modifier source specified, add the source type to the table
row.source = sourceType
row.sourceTooltip = function(tooltip)
tooltip:AddLine(16, "Total from "..sourceType..":")
for _, line in ipairs(sourceTotals[sourceType]) do
tooltip:AddLine(14, line)
end
end
end
if sourceType == "Item" then
-- Modifier is from an item, add item name and tooltip
local itemId = row.mod.source:match("Item:(%d+):.+")
local item = build.itemsTab.items[tonumber(itemId)]
if item then
row.sourceName = colorCodes[item.rarity]..item.name
row.sourceNameTooltip = function(tooltip)
build.itemsTab:AddItemTooltip(tooltip, item, row.mod.sourceSlot)
end
end
elseif sourceType == "Tree" then
-- Modifier is from a passive node, add node name, and add node ID (used to show node location)
local nodeId = row.mod.source:match("Tree:(%d+)")
if nodeId then
local nodeIdNumber = tonumber(nodeId)
local node = build.spec.nodes[nodeIdNumber] or build.spec.tree.nodes[nodeIdNumber]
row.sourceName = node.dn
row.sourceNameNode = node
end
elseif sourceType == "Skill" then
-- Extract skill name
row.sourceName = build.data.skills[row.mod.source:match("Skill:(.+)")].name
elseif sourceType == "Pantheon" then
row.sourceName = row.mod.source:match("Pantheon:(.+)")
end
if row.mod.flags ~= 0 or row.mod.keywordFlags ~= 0 then
-- Combine, sort and format modifier flags
local flagNames = { }
for flags, src in pairs({[row.mod.flags] = ModFlag, [row.mod.keywordFlags] = KeywordFlag}) do
for name, val in pairs(src) do
if band(flags, val) == val then
t_insert(flagNames, name)
end
end
end
table.sort(flagNames)
row.flags = table.concat(flagNames, ", ")
end
row.tags = nil
if row.mod[1] then
-- Format modifier tags
local baseVal = type(row.mod.value) == "number" and (self:FormatModBase(row.mod, row.mod.value) .. " ")
for _, tag in ipairs(row.mod) do
local desc
if tag.type == "Condition" or tag.type == "ActorCondition" then
desc = (tag.actor and (tag.actor:sub(1,1):upper()..tag.actor:sub(2).." ") or "").."Condition: "..(tag.neg and "Not " or "")..self:FormatVarNameOrList(tag.var, tag.varList)
elseif tag.type == "Multiplier" then
local base = tag.base and (self:FormatModBase(row.mod, tag.base).." + "..math.abs(row.mod.value).." ") or baseVal
desc = base.."per "..(tag.div and (tag.div.." ") or "")..self:FormatVarNameOrList(tag.var, tag.varList)
baseVal = ""
elseif tag.type == "PerStat" then
local base = tag.base and (self:FormatModBase(row.mod, tag.base).." + "..math.abs(row.mod.value).." ") or baseVal
desc = base.."per "..(tag.div or 1).." "..self:FormatVarNameOrList(tag.stat, tag.statList)
baseVal = ""
elseif tag.type == "PercentStat" then
local finalPercent = (row.mod.value * (tag.percent / 100)) * 100
local base = tag.base and (self:FormatModBase(row.mod, tag.base).." + "..math.abs(finalPercent).." ") or self:FormatModBase(row.mod, finalPercent)
desc = base.."% of "..self:FormatVarNameOrList(tag.stat, tag.statList)
baseVal = ""
elseif tag.type == "MultiplierThreshold" or tag.type == "StatThreshold" then
desc = "If "..self:FormatVarNameOrList(tag.var or tag.stat, tag.varList or tag.statList)..(tag.upper and " <= " or " >= ")..(tag.threshold or self:FormatModName(tag.thresholdVar or tag.thresholdStat))
elseif tag.type == "SkillName" then
desc = "Skill: "..(tag.skillNameList and table.concat(tag.skillNameList, "/") or tag.skillName)
elseif tag.type == "SkillId" then
desc = "Skill: "..build.data.skills[tag.skillId].name
elseif tag.type == "SkillType" then
for name, type in pairs(SkillType) do
if type == tag.skillType then
desc = "Skill type: "..(tag.neg and "Not " or "")..self:FormatModName(name)
break
end
end
if not desc then
desc = "Skill type: "..(tag.neg and "Not " or "").."?"
end
elseif tag.type == "SlotNumber" then
desc = "When in slot #"..tag.num
elseif tag.type == "GlobalEffect" then
desc = self:FormatModName(tag.effectType)
elseif tag.type == "Limit" then
desc = "Limited to "..(tag.limitVar and self:FormatModName(tag.limitVar) or self:FormatModBase(row.mod, tag.limit))
else
desc = self:FormatModName(tag.type)
end
if desc then
row.tags = (row.tags and row.tags .. ", " or "") .. desc
end
end
end
end
end
function CalcBreakdownClass:FormatModName(modName)
return modName:gsub("([%l%d]:?)(%u)","%1 %2"):gsub("(%l)(%d)","%1 %2")
end
function CalcBreakdownClass:FormatVarNameOrList(var, varList)
return var and self:FormatModName(var) or table.concat(varList, "/")
end
function CalcBreakdownClass:FormatModBase(mod, base)
return mod.type == "BASE" and string.format("%+g", math.abs(base)) or math.abs(base).."%"
end
function CalcBreakdownClass:FormatModValue(value, modType)
if modType == "BASE" then
return string.format("%+g base", value)
elseif modType == "INC" then
if value >= 0 then
return value.."% increased"
else
return -value.."% reduced"
end
elseif modType == "MORE" then
if value >= 0 then
return value.."% more"
else
return -value.."% less"
end
elseif modType == "OVERRIDE" then
return "Override: "..value
elseif modType == "FLAG" then
return value and "True" or "False"
elseif modType == "LIST" then
if value.mod then
return "Modifier: "..self:FormatModName(value.mod.name)
else
return "?"
end
else
return value
end
end
function CalcBreakdownClass:DrawBreakdownTable(viewPort, x, y, section)
local cursorX, cursorY = GetCursorPos()
if section.label then
-- Draw table label if able
DrawString(x + 2, y, "LEFT", 16, "VAR", "^7"..section.label..":")
y = y + 16
end
local colX = x + 4
for index, col in ipairs(section.colList) do
if col.width then
-- Column is present, draw the separator and label
col.x = colX
if index > 1 then
-- Skip the separator for the first column
SetDrawColor(0.5, 0.5, 0.5)
DrawImage(nil, colX - 2, y, 1, section.height - (section.label and 16 or 0) - (section.footer and 12 or 0))
end
SetDrawColor(1, 1, 1)
DrawString(colX, y + 2, "LEFT", 16, "VAR", col.label)
colX = colX + col.width
end
end
local rowY = y + 20
for _, row in ipairs(section.rowList) do
-- Draw row separator
SetDrawColor(0.5, 0.5, 0.5)
DrawImage(nil, x + 2, rowY - 1, section.width - 4, 1)
for _, col in ipairs(section.colList) do
if col.width and row[col.key] then
-- This row has an entry for this column, draw it
local _, alpha = string.gsub(row[col.key], "%a", " ") -- counts letters in the string
local _, notes = string.gsub(row[col.key], " to ", " ") -- counts " to " in the string
local _, paren = string.gsub(row[col.key], "%b()", " ") -- counts parenthesis in the string
if main.showThousandsCalcs and (alpha == 0 or notes > 0 or paren > 0) and col.right then
DrawString(col.x + col.width - 4, rowY + 1, "RIGHT_X", 12, "VAR", "^7"..formatNumSep(tostring(row[col.key])))
elseif col.right then
DrawString(col.x + col.width - 4, rowY + 1, "RIGHT_X", 12, "VAR", "^7"..row[col.key])
elseif main.showThousandsCalcs and (alpha == 0 or notes > 0 or paren > 0) then
DrawString(col.x, rowY + 1, "LEFT", 12, "VAR", "^7"..formatNumSep(tostring(row[col.key])))
else
DrawString(col.x, rowY + 1, "LEFT", 12, "VAR", "^7"..row[col.key])
end
local ttFunc = row[col.key.."Tooltip"]
local ttNode = row[col.key.."Node"]
if (ttFunc or ttNode) and cursorY >= viewPort.y + 2 and cursorY < viewPort.y + viewPort.height - 2 and cursorX >= col.x and cursorY >= rowY and cursorX < col.x + col.width and cursorY < rowY + 14 then
-- Mouse is over the cell, draw highlighting lines and show the tooltip/node location
SetDrawLayer(nil, 15)
SetDrawColor(0, 1, 0)
DrawImage(nil, col.x - 2, rowY - 1, col.width, 1)
DrawImage(nil, col.x - 2, rowY + 13, col.width, 1)
if ttFunc then
self.tooltip:Clear()
ttFunc(self.tooltip)
self.tooltip:Draw(col.x, rowY, col.width, 12, viewPort)
elseif ttNode and ttNode.x and ttNode.y then -- The source "node" from cluster jewels don't know their location because it's the abstract node in tree.lua rather than the generated node from the cluster jewel.
local viewerX = col.x + col.width + 5
if viewPort.x + viewPort.width < viewerX + 304 then
viewerX = col.x - 309
end
local viewerY = m_min(rowY, viewPort.y + viewPort.height - 304)
SetDrawColor(1, 1, 1)
DrawImage(nil, viewerX, viewerY, 304, 304)
local viewer = self.nodeViewer
viewer.zoom = 5
local scale = self.calcsTab.build.spec.tree.size / 1500
viewer.zoomX = -ttNode.x / scale
viewer.zoomY = -ttNode.y / scale
SetViewport(viewerX + 2, viewerY + 2, 300, 300)
viewer:Draw(self.calcsTab.build, { x = 0, y = 0, width = 300, height = 300 }, { })
SetDrawLayer(nil, 30)
SetDrawColor(1, 0, 0)
DrawImage(viewer.highlightRing, 135, 135, 30, 30)
SetViewport()
end
SetDrawLayer(nil, 10)
end
end
end
rowY = rowY + 14
end
if section.footer then
-- Draw table footer if able
DrawString(x + 2, rowY, "LEFT", 12, "VAR", "^7"..section.footer)
end
end
function CalcBreakdownClass:DrawRadiusVisual(x, y, width, height, radius)
SetDrawColor(0.75, 0.75, 0.75)
DrawImage(self.rangeGuide, x, y, width, height)
--SetDrawColor(0, 0, 0)
--DrawImage(nil, x, y, width, height)
--[[SetDrawColor(0.5, 0.5, 0.75)
for r = 10, 130, 20 do
main:RenderRing(x, y, width, height, 0, 0, r, 3)
end
SetDrawColor(1, 1, 1)
for r = 20, 120, 20 do
main:RenderRing(x, y, width, height, 0, 0, r, 3)
end
main:RenderCircle(x, y, width, height, 0, 0, 2)]]
SetDrawColor(0.5, 1, 0.5, 0.33)
main:RenderCircle(x, y, width, height, 0, 0, radius)
--[[SetDrawColor(1, 0.5, 0.5, 0.33)
if not self.foo1 then
self.foo1, self.foo2 = 0, 0
end
if IsKeyDown("LEFT") then
self.foo1 = self.foo1 - 0.3
elseif IsKeyDown("RIGHT") then
self.foo1 = self.foo1 + 0.3
end
if IsKeyDown("UP") then
self.foo2 = self.foo2 + 0.3
elseif IsKeyDown("DOWN") then
self.foo2 = self.foo2 - 0.3
end
main:RenderCircle(x, y, width, height, self.foo1, self.foo2, 30)]]
SetDrawColor(1, 1, 1)
DrawImage(self.uiOverlay, x, y, width, height)
end
function CalcBreakdownClass:Draw(viewPort)
local sourceData = self.sourceData
local scrollBar = self.controls.scrollBar
local width = self.contentWidth
local height = self.contentHeight
if self.contentHeight > viewPort.height then
-- Content won't fit the screen height, so set the scrollbar
width = self.contentWidth + scrollBar.width
height = viewPort.height
scrollBar.height = height - 4
scrollBar:SetContentDimension(self.contentHeight - 4, viewPort.height - 4)
else
scrollBar:SetContentDimension(0, 0)
end
self.width = width
self.height = height
-- Calculate position based on the source cell
local x = sourceData.x + sourceData.width + 5
local y = m_min(sourceData.y, viewPort.y + viewPort.height - height)
if x + width > viewPort.x + viewPort.width then
x = m_max(viewPort.x, sourceData.x - 5 - width)
end
self.x = x
self.y = y
-- Draw background
SetDrawLayer(nil, 10)
SetDrawColor(0, 0, 0, 0.9)
DrawImage(nil, x + 2, y + 2, width - 4, height - 4)
-- Draw border (this is put in sub layer 11 so it draws over the contents, in case they don't fit the screen)
SetDrawLayer(nil, 11)
if self.pinned then
SetDrawColor(0.25, 1, 0.25)
else
SetDrawColor(0.33, 0.66, 0.33)
end
DrawImage(nil, x, y, width, 2)
DrawImage(nil, x, y + height - 2, width, 2)
DrawImage(nil, x, y, 2, height)
DrawImage(nil, x + width - 2, y, 2, height)
SetDrawLayer(nil, 10)
self:DrawControls(viewPort)
-- Draw the sections
y = y - scrollBar.offset
for i, section in ipairs(self.sectionList) do
local sectionY = y + section.offset
if section.type == "TEXT" then
local lineY = sectionY + 2
for i, line in ipairs(section.lines) do
SetDrawColor(1, 1, 1)
local _, dec = string.gsub(line, "%.%d%d.", " ") -- counts decimals with 2 or more digits
if main.showThousandsCalcs and dec == 0 then
DrawString(x + 4, lineY, "LEFT", section.textSize, "VAR", formatNumSep(line))
else
DrawString(x + 4, lineY, "LEFT", section.textSize, "VAR", line)
end
lineY = lineY + section.textSize
end
elseif section.type == "TABLE" then
self:DrawBreakdownTable(viewPort, x, sectionY, section)
elseif section.type == "RADIUS" then
SetDrawColor(1, 1, 1)
DrawImage(nil, x + 2, sectionY, section.width - 4, section.height)
self:DrawRadiusVisual(x + 4, sectionY + 2, section.width - 8, section.height - 4, section.radius)
end
end
SetDrawLayer(nil, 0)
end
function CalcBreakdownClass:OnKeyDown(key, doubleClick)
if not self:IsShown() or not self:IsEnabled() then
return
end
local mOverControl = self:GetMouseOverControl()
if mOverControl and mOverControl.OnKeyDown then
return mOverControl:OnKeyDown(key)
end
local mOver = self:IsMouseOver()
if key:match("BUTTON") then
if not mOver then
-- Mouse click outside the control, hide the breakdown
self.calcsTab:ClearDisplayStat()
self.shown = false
return
end
end
return self
end
function CalcBreakdownClass:OnKeyUp(key)
if not self:IsShown() or not self:IsEnabled() then
return
end
if key == "WHEELDOWN" then
self.controls.scrollBar:Scroll(1)
elseif key == "WHEELUP" then
self.controls.scrollBar:Scroll(-1)
end
return self
end |
kSkulkMucousShieldPercent = 0.2
kGorgeMucousShieldPercent = 0.13
kLerkMucousShieldPercent = 0.14
kFadeMucousShieldPercent = 0.16
kMucousShieldMaxAmount = 85 |
local skynet = require "skynet"
local meiru = require "meiru.meiru"
local config = require "config"
local router = require "router"
local api_router = require "api_router"
local auth = require "component.auth"
local response = require "component.response"
local renderfunc = require "common.renderfunc"
local assets_path = skynet.getenv("assets_path")
local views_path = assets_path .."view"
local static_path = assets_path .."static"
local static_url = "/"
local app = meiru.create_app()
app.set("views_path", views_path)
app.set("static_url", static_url)
app.data("config", config)
app.data(renderfunc)
app.set("session_secret", config.session_secret)
if os.mode == 'dev' then
-- app.open_footprint()
-- else
-- app.set("host", "www.skynetlua.com")
end
-- app.use(function(req, res)
-- log("req.rawmethod =", req.rawmethod)
-- log("req.rawurl =", req.rawurl)
-- end)
app.use(meiru.static('/public', static_path))
app.use(meiru.static('/favicon.ico', static_path))
--api 借口
local api_node = api_router.node()
app.use(api_node)
--web 路由
local rnode = router.node()
rnode:add(response.render)
rnode:add(auth.authUser)
rnode:add(auth.blockUser)
app.use(rnode)
app.run()
-- log("treeprint:\n", app.treeprint())
return app
|
Pastelizer = {}
require("util")
require("components/slider")
math.randomseed(
love.timer.getDelta() / math.random()
)
function love.load()
local starterColors = {
Pastelizer:RGB(247, 223, 31),
Pastelizer:RGB(237, 41, 57),
Pastelizer:RGB(106, 79, 236),
Pastelizer:RGB(247, 106, 140)
}
Pastelizer.Color = starterColors[math.random(1, #starterColors)]
Pastelizer.PastelColor = Pastelizer.Color
Pastelizer.ColorText = Pastelizer.Color.hex
Pastelizer.PastelLevel = 2
Pastelizer.Fonts = {
Semibold = love.graphics.newFont("assets/fonts/poppins_semibold.ttf", 24),
Bold = love.graphics.newFont("assets/fonts/poppins_bold.ttf", 48)
}
local w, h = love.graphics.getDimensions()
local p = math.ceil(h * 0.025)
Pastelizer.PastelLevelSlider = Pastelizer.Slider(w / 4 + w / 2, h - p * 2, w / 2 - p * 4, Pastelizer.PastelLevel, 0, Pastelizer.PastelLevel * 2, function(value)
if Pastelizer.PastelLevel == value then return end
Pastelizer.PastelLevel = value
end)
for i = 0, Pastelizer.PastelLevel * 2 do
Pastelizer.PastelLevelSlider:setValue(i)
end
Pastelizer.PastelLevelSlider:setValue(0.6)
Pastelizer.Buttons = {
{
text = "Copy",
onClick = function()
love.system.setClipboardText("#" .. Pastelizer.ColorText)
end
},
{
text = "Paste",
onClick = function()
Pastelizer.ColorText = love.system.getClipboardText():gsub("#", ""):sub(1, 6)
end
}
}
love.keyboard.setKeyRepeat(true)
love.audio.setVolume(0.1)
end
function love.textinput(t)
if #Pastelizer.ColorText < 6 then
Pastelizer.ColorText = Pastelizer.ColorText .. t
end
end
local utf8 = require("utf8")
function love.keypressed(key)
if key == "backspace" then
local byteOffset = utf8.offset(Pastelizer.ColorText, -1)
if byteOffset then
Pastelizer.ColorText = string.sub(Pastelizer.ColorText, 1, byteOffset - 1)
end
end
local osString = love.system.getOS()
local control
if osString == "OS X" then
control = love.keyboard.isDown("lgui", "rgui")
elseif osString == "Windows" or osString == "Linux" then
control = love.keyboard.isDown("lctrl", "rctrl")
end
if control then
if key == "c" then
love.system.setClipboardText("#" .. Pastelizer.PastelColor.hex)
end
if key == "v" then
Pastelizer.ColorText = love.system.getClipboardText():gsub("#", ""):sub(1, 6)
end
end
end
function love.update(deltaTime)
Pastelizer.PastelLevelSlider:update()
end
local function round(x, y)
local mult = 10 ^ (y or 0)
return math.floor(x * mult + 0.5) / mult
end
function love.draw()
local w, h = love.graphics.getDimensions()
local currentColor = Pastelizer.Color
local parsedColor = Pastelizer:HexToRGB(Pastelizer.ColorText)
local rgbParsedColor = Pastelizer:RGB(unpack(parsedColor, 1, 3))
if currentColor:ToString() ~= rgbParsedColor:ToString() then
if parsedColor[1] and parsedColor[2] and parsedColor[3] then
Pastelizer.Color = rgbParsedColor
Pastelizer.PastelColor = Pastelizer.Color
Pastelizer.PastelLevel = 2
for i = 0, Pastelizer.PastelLevel * 2 do
Pastelizer.PastelLevelSlider:setValue(i)
end
Pastelizer.PastelLevelSlider.max = Pastelizer.PastelLevel * 2
Pastelizer.PastelLevelSlider:setValue(0.6)
end
end
Pastelizer.PastelColor = Pastelizer:Lighten(Pastelizer.Color, Pastelizer.PastelLevel)
love.graphics.setColor(Pastelizer.Color:Unpack())
love.graphics.rectangle("fill", 0, 0, w / 2, h)
love.graphics.setColor(Pastelizer.PastelColor:Unpack())
love.graphics.rectangle("fill", w / 2, 0, w / 2, h)
local text = "#" .. Pastelizer.ColorText:lower()
local fontWidth = Pastelizer.Fonts.Bold:getWidth(text)
local fontHeight = Pastelizer.Fonts.Bold:getHeight()
local p = math.ceil(h * 0.025)
local debug = love.keyboard.isDown("d")
love.graphics.setColor(Pastelizer:GetContrastColor(Pastelizer.Color):Unpack())
love.graphics.setFont(Pastelizer.Fonts.Bold)
love.graphics.print(text, w / 4 - fontWidth / 2, h / 2 - fontHeight / 2)
if debug then
local relativeLuminance, dR = Pastelizer:GetRelativeLuminance(Pastelizer.Color)
love.graphics.setFont(Pastelizer.Fonts.Semibold)
love.graphics.print(round(relativeLuminance, 2) .. "/" .. dR, p, p)
end
local totalWidth = 0
local buttonHeight = Pastelizer.Fonts.Semibold:getHeight() + 16
love.graphics.setFont(Pastelizer.Fonts.Semibold)
local colorR, colorG, colorB = love.graphics.getColor()
for i, button in ipairs(Pastelizer.Buttons) do
local x, y = p + totalWidth, h - buttonHeight - p
local width = Pastelizer.Fonts.Semibold:getWidth(button.text) + 16
local isHovered = Pastelizer:IsHovering(x, y, width, buttonHeight)
button.last = button.now
button.now = love.mouse.isDown(1)
love.graphics.setColor(colorR, colorG, colorB)
love.graphics.rectangle(isHovered and "fill" or "line", x, y, width, buttonHeight)
totalWidth = totalWidth + width + p
if isHovered then
love.graphics.setColor(Pastelizer.Color:Unpack())
end
love.graphics.print(button.text, x + width / 2 - (width - 16) / 2, y + buttonHeight / 2 - (buttonHeight - 16) / 2)
if isHovered and button.now and not button.last then
button.onClick()
local hint = love.audio.newSource("assets/sounds/hint.wav", "static")
love.audio.play(hint)
end
end
text = "#" .. Pastelizer.PastelColor.hex
love.graphics.setColor(Pastelizer:GetContrastColor(Pastelizer.PastelColor):Unpack())
love.graphics.setFont(Pastelizer.Fonts.Bold)
love.graphics.print(text, w / 2 + w / 4 - Pastelizer.Fonts.Bold:getWidth(text) / 2, h / 2 - fontHeight / 2)
local relativeLuminance, dR = Pastelizer:GetRelativeLuminance(Pastelizer.PastelColor)
if relativeLuminance >= 1 or not Pastelizer:IsSameRatio(Pastelizer.PastelColor, Pastelizer.Color) then
Pastelizer.PastelLevelSlider.max = Pastelizer.PastelLevelSlider.max / 2
end
if debug then
love.graphics.setFont(Pastelizer.Fonts.Semibold)
love.graphics.print(round(relativeLuminance, 2) .. "/" .. dR, w / 2 + p, p)
end
love.graphics.setLineWidth(3)
love.graphics.setFont(Pastelizer.Fonts.Semibold)
local percentage = round(100 * Pastelizer.PastelLevel / Pastelizer.PastelLevelSlider.max)
if debug then
love.graphics.print(string.format("Pastel Level: %s%% (%s/%s)", percentage, round(Pastelizer.PastelLevel, 1), round(Pastelizer.PastelLevelSlider.max, 1)), w / 2 + p, h - Pastelizer.Fonts.Semibold:getHeight() - p * 3.5)
else
love.graphics.print(string.format("Pastel Level: %s%%", percentage), w / 2 + p, h - Pastelizer.Fonts.Semibold:getHeight() - p * 3.5)
end
Pastelizer.PastelLevelSlider:draw()
end |
-- lua/rs/FlinchMixin.lua
FlinchMixin = CreateMixin(FlinchMixin)
FlinchMixin.type = "Flinch"
FlinchMixin.expectedCallbacks =
{
TriggerEffects = "The flinch effect will be triggered through this callback.",
GetMaxHealth = "Returns the maximum amount of health this entity can have.",
SetPoseParam = "Set the named pose parameter to the passed in value."
}
FlinchMixin.optionalCallbacks =
{
GetCustomFlinchEffectName = "Return a custom effect name.",
GetFlinchIntensityOverride = "Return 0-1 flinch intensity for pose param"
}
FlinchMixin.optionalConstants =
{
kPlayFlinchAnimations = "Dictates if this entity will update the Animation Post and Input parameters per flinch intensity"
}
-- Takes this much time to reduce flinch completely.
local kFlinchIntensityReduceRate = 0.4
FlinchMixin.networkVars =
{
-- how intense the flinching is from 0 to 1
flinchAmountOnChange = "compensated float (0 to 1 by 0.01)",
flinchLastChangeTime = "compensated time"
}
local kWorldY = Vector(0, 1, 0)
local function UpdateDamagedEffects(self)
PROFILE("FlinchMixin:UpdateDamagedEffects")
local updateDamagedEffects = not self:isa("Player") or (not self:GetIsLocalPlayer() or self:GetIsThirdPerson())
updateDamagedEffects = updateDamagedEffects and (not HasMixin(self, "Live") or self:GetIsAlive())
updateDamagedEffects = updateDamagedEffects and (not HasMixin(self, "Construct") or self:GetIsBuilt())
updateDamagedEffects = updateDamagedEffects and (not HasMixin(self, "Cloakable") or not self:GetIsCloaked())
updateDamagedEffects = updateDamagedEffects and self:GetIsVisible()
if updateDamagedEffects then
local coords = self:GetCoords()
if coords.yAxis:DotProduct(kWorldY) ~= 1 then
coords = Coords.GetTranslation(self:GetOrigin())
end
local healthScalar = self:GetHealthScalar()
if healthScalar < 0.3 then
self:TriggerEffects("damaged", { flinch_severe = true, effecthostcoords = coords })
elseif healthScalar < 0.6 then
self:TriggerEffects("damaged", { flinch_severe = false, effecthostcoords = coords })
end
end
-- Continue forever.
return true
end
local function UpdateFlinchEffects(self)
PROFILE("FlinchMixin:UpdateFlinchEffects")
if self.flinchDamageThisFrame ~= 0 then
local flinchParams =
{
flinch_severe = self.flinchDamageThisFrame > 0.35 or self.flinchIntensity > 0.35, effecthostcoords = self:GetCoords(),
damagetype = self.flinchLastDamageType
}
self:TriggerEffects("flinch", flinchParams)
self.flinchDamageThisFrame = 0
end
-- Continue forever.
return true
end
function FlinchMixin:__initmixin()
PROFILE("FlinchMixin:__initmixin")
self.flinchIntensity = 0
self.lastHealthScalar = 1
self.flinchAmountOnChange = 0
self.flinchLastChangeTime = 0
if Client then
self.flinchDamageThisFrame = 0
self.flinchLastDamageType = kDamageType.Normal
self:AddTimedCallback(UpdateDamagedEffects, 3)
self:AddTimedCallback(UpdateFlinchEffects, 0.3)
end
end
if Server then
function FlinchMixin:OnTakeDamage(damage, attacker, doer, point, direction)
if damage == 0 then
return
end
-- Once entity has taken this much damage in a second, it is flinching at it's maximum amount
local maxFlinchDamage = self:GetMaxHealth() * 0.2
local flinchAmount = damage / maxFlinchDamage
self:UpdateFlinchAmount(Clamp(self:GetFlinchIntensity() + flinchAmount, 0.2, 1))
-- Make sure new flinch intensity is big enough to be visible, but don't add too much from a bunch of small hits
-- Flamethrower make Harvester go wild
local damageType = kDamageType.Flame
if doer then
if doer.GetDamageType then
damageType = doer:GetDamageType()
end
end
if doer and HasMixin(doer, "Live") and damageType == kDamageType.Flame then
self:UpdateFlinchAmount(self:GetFlinchIntensity() + 0.1)
end
end
function FlinchMixin:UpdateFlinchAmount(newFlinchAmount)
self.flinchIntensity = Clamp(newFlinchAmount, 0, 1)
self.flinchLastChangeTime = Shared.GetTime()
end
FlinchMixin.OnUpdate = nil
FlinchMixin.OnProcessMove = nil
end
function FlinchMixin:OnTakeDamageClient(damage, doer, position)
-- Get damage type from source.
local damageType = kDamageType.Normal
if doer then
if doer.GetDamageType then
damageType = doer:GetDamageType()
elseif HasMixin(doer, "Tech") then
damageType = LookupTechData(doer:GetTechId(), kTechDataDamageType, kDamageType.Normal)
end
end
self.flinchDamageThisFrame = self.flinchDamageThisFrame + math.abs(self.lastHealthScalar - self:GetHealthScalar())
self.flinchLastDamageType = damageType
self.lastHealthScalar = self:GetHealthScalar()
end
function FlinchMixin:OnUpdatePoseParameters()
PROFILE("FlinchMixin:OnUpdatePoseParameters")
if self:GetMixinConstants().kPlayFlinchAnimations then
self:SetPoseParam("intensity", self:GetFlinchIntensity())
end
end
function FlinchMixin:GetFlinchIntensity()
-- Set this for Onos override
self.flinchIntensity = Clamp(self.flinchAmountOnChange - ((Shared.GetTime() - self.flinchLastChangeTime) * kFlinchIntensityReduceRate), 0, 1)
if self.GetFlinchIntensityOverride then
return self:GetFlinchIntensityOverride()
end
return self.flinchIntensity
end
function FlinchMixin:OnUpdateAnimationInput(modelMixin)
PROFILE("FlinchMixin:OnUpdateAnimationInput")
if self:GetMixinConstants().kPlayFlinchAnimations then
modelMixin:SetAnimationInput("flinch", self:GetFlinchIntensity() > 0)
end
end
|
return
{
module = "NativeOsUtils"
}
|
----------------------------------------------------------------------------------------------------
-- The DisplayObject that has graphics capabilities.
-- You can call in the method chain MOAIDraw.
--
-- <h4>Extends:</h4>
-- <ul>
-- <li><a href="flower.DrawableObject.html">DrawableObject</a><l/i>
-- </ul>
--
-- @author Makoto
-- @release V3.0.0
----------------------------------------------------------------------------------------------------
-- import
local class = require "flower.class"
local table = require "flower.table"
local Config = require "flower.Config"
local DrawableObject = require "flower.DrawableObject"
-- class
local Graphics = class(DrawableObject)
-- const
Graphics.DEFAULT_STEPS = 32
---
-- The constructor.
function Graphics:init(width, height)
Graphics.__super.init(self, width, height)
self.commands = {}
end
---
-- This is the function called when drawing.
-- @param index index of DrawCallback.
-- @param xOff xOff of DrawCallback.
-- @param yOff yOff of DrawCallback.
-- @param xFlip xFlip of DrawCallback.
-- @param yFlip yFlip of the Prop.
function Graphics:onDraw(index, xOff, yOff, xFlip, yFlip)
if #self.commands == 0 then
return
end
MOAIGfxDevice.setPenColor(self:getColor())
MOAIGfxDevice.setPenWidth(1)
MOAIGfxDevice.setPointSize(1)
for i, func in ipairs(self.commands) do
func(self)
end
end
---
-- Draw a circle.
-- @param x Position of the left.
-- @param y Position of the top.
-- @param r Radius.(Not in diameter.)
-- @param steps Number of points.
-- @return self
function Graphics:drawCircle(x, y, r, steps)
steps = steps or Graphics.DEFAULT_STEPS
local command = function(self)
if x and y and r and steps then
MOAIDraw.drawCircle(x + r, y + r, r, steps)
else
local rw = math.min(self:getWidth(), self:getHeight()) / 2
MOAIDraw.drawCircle(rw, rw, rw, 360)
end
end
table.insert(self.commands, command)
return self
end
---
-- Draw an ellipse.
-- @param x Position of the left.
-- @param y Position of the top.
-- @param xRad Radius.(Not in diameter.)
-- @param yRad Radius.(Not in diameter.)
-- @param steps Number of points.
-- @return self
function Graphics:drawEllipse(x, y, xRad, yRad, steps)
steps = steps or Graphics.DEFAULT_STEPS
local command = function(self)
if x and y and xRad and yRad and steps then
MOAIDraw.drawEllipse(x + xRad, y + yRad, xRad, yRad, steps)
else
local rw, rh = self:getWidth() / 2, self:getHeight() / 2
MOAIDraw.drawEllipse(rw, rh, rw, rh, steps)
end
end
table.insert(self.commands, command)
return self
end
---
-- Draws a line.
-- @param ... Position of the points(x0, y0).
-- @return self
function Graphics:drawLine(...)
local args = {...}
local command = function(self)
MOAIDraw.drawLine(unpack(args))
end
table.insert(self.commands, command)
return self
end
---
-- Draws a point.
-- @param ... Position of the points(x0, y0).
-- @return self
function Graphics:drawPoints(...)
local args = {...}
local command = function(self)
MOAIDraw.drawPoints(unpack(args))
end
table.insert(self.commands, command)
return self
end
---
-- Draw a ray.
-- @param x Position of the left.
-- @param y Position of the top.
-- @param dx Direction.
-- @param dy Direction.
-- @return self
function Graphics:drawRay(x, y, dx, dy)
local command = function(self)
if x and y and dx and dy then
MOAIDraw.drawRay(x, y, dx, dy)
else
MOAIDraw.drawRay(0, 0, self:getWidth(), self:getHeight())
end
end
table.insert(self.commands, command)
return self
end
---
-- Draw a rectangle.
-- @param x0 Position of the left.
-- @param y0 Position of the top.
-- @param x1 Position of the right.
-- @param y1 Position of the bottom
-- @return self
function Graphics:drawRect(x0, y0, x1, y1)
local command = function(self)
if x0 and y0 and x1 and y1 then
MOAIDraw.drawRect(x0, y0, x1, y1)
else
MOAIDraw.drawRect(0, 0, self:getWidth(), self:getHeight())
end
end
table.insert(self.commands, command)
return self
end
---
-- Draw a callback.
-- @param callback callback function.
-- @return self
function Graphics:drawCallback(callback)
table.insert(self.commands, callback)
return self
end
---
-- Fill the circle.
-- @param x Position of the left.
-- @param y Position of the top.
-- @param r Radius.(Not in diameter.)
-- @param steps Number of points.
-- @return self
function Graphics:fillCircle(x, y, r, steps)
steps = steps or Graphics.DEFAULT_STEPS
local command = function(self)
if x and y and r and steps then
MOAIDraw.fillCircle(x + r, y + r, r, steps)
else
local r = math.min(self:getWidth(), self:getHeight()) / 2
MOAIDraw.fillCircle(r, r, r, steps)
end
end
table.insert(self.commands, command)
return self
end
---
-- Fill an ellipse.
-- @param x Position of the left.
-- @param y Position of the top.
-- @param xRad Radius.(Not in diameter.)
-- @param yRad Radius.(Not in diameter.)
-- @param steps Number of points.
-- @return self
function Graphics:fillEllipse(x, y, xRad, yRad, steps)
steps = steps or Graphics.DEFAULT_STEPS
local command = function(self)
if x and y and xRad and yRad then
MOAIDraw.fillEllipse(x + xRad, y + yRad, xRad, yRad, steps)
else
local rw, rh = self:getWidth() / 2, self:getHeight() / 2
MOAIDraw.fillEllipse(rw, rh, rw, rh, steps)
end
end
table.insert(self.commands, command)
return self
end
---
-- Fills the triangle.
-- @param ... Position of the points(x0, y0).
-- @return self
function Graphics:fillFan(...)
local args = {...}
local command = function(self)
MOAIDraw.fillFan(unpack(args))
end
table.insert(self.commands, command)
return self
end
---
-- Fill a rectangle.
-- @param x0 Position of the left.
-- @param y0 Position of the top.
-- @param x1 Position of the right.
-- @param y1 Position of the bottom.
-- @return self
function Graphics:fillRect(x0, y0, x1, y1)
local command = function(self)
if x0 and y0 and x1 and y1 then
MOAIDraw.fillRect(x0, y0, x1, y1)
else
MOAIDraw.fillRect(0, 0, self:getWidth(), self:getHeight())
end
end
table.insert(self.commands, command)
return self
end
---
-- Sets the color of the pen.
-- Will be reflected in the drawing functions.
-- @param r red
-- @param g green
-- @param b blue
-- @param a alpha
-- @return self
function Graphics:setPenColor(r, g, b, a)
a = a or 1
local command = function(self)
local red, green, blue, alpha = self:getColor()
red = r * red
green = g * green
blue = b * blue
alpha = a * alpha
MOAIGfxDevice.setPenColor(red, green, blue, alpha)
end
table.insert(self.commands, command)
return self
end
---
-- Set the size of the pen that you specify.
-- Will be reflected in the drawing functions.
-- @param width width
-- @return self
function Graphics:setPenWidth(width)
local command = function(self)
MOAIGfxDevice.setPenWidth(width)
end
table.insert(self.commands, command)
return self
end
---
-- Set the size of the specified point.
-- Will be reflected in the drawing functions.
-- @param size
-- @return self
function Graphics:setPointSize(size)
local command = function(self)
MOAIGfxDevice.setPointSize(size)
end
table.insert(self.commands, command)
return self
end
---
-- Clears the drawing operations.
-- @return self
function Graphics:clear()
self.commands = {}
return self
end
return Graphics |
local testing = require 'tests.testing'
local fn = require 'fn'
local M = {}
function M.test_none()
testing.forstats({count = 0, sum = 0},
fn.concat())
end
function M.test_one()
testing.forstats({count = 5, sum = 15},
fn.concat({fn.fromto(1, 5)}))
end
function M.test_one_none_generated()
testing.forstats({count = 0, sum = 0},
fn.concat({fn.fromto(3, 1)}))
end
function M.test_two()
testing.forstats({count = 8, sum = 48},
fn.concat({fn.fromto(1, 5)}, {fn.fromto(10, 12)}))
end
function M.test_three()
testing.forstats({count = 10, sum = 51},
fn.concat({fn.fromto(1, 5)}, {fn.fromto(10, 12)}, {ipairs({'a', 'b'})}))
end
return M
|
local PhysService = game:GetService("PhysicsService")
local PlayerGroup = PhysService:CreateCollisionGroup("p")
PhysService:CollisionGroupSetCollidable("p","p",false)
function NoCollide(model)
for k, v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then
PhysService:SetPartCollisionGroup(v,"p")
end
end
end
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
repeat wait() until char:FindFirstChild("HumanoidRootPart")
repeat wait() until char:FindFirstChild("Head")
repeat wait() until char:FindFirstChild("Humanoid")
char:FindFirstChild("HumanoidRootPart")
char:FindFirstChild("Head")
char:FindFirstChild("Humanoid")
wait(0.1)
NoCollide(char)
end)
if player.Character then
NoCollide(player.Character)
end
end) |
AddCSLuaFile()
DEFINE_BASECLASS( "base_wire_entity" )
ENT.PrintName = "Wire Simple Explosive"
ENT.WireDebugName = "Simple Explosive"
if CLIENT then return end -- No more client
function ENT:Initialize()
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self.NormInfo = ""
self.Inputs = Wire_CreateInputs(self, { "Detonate" })
end
function ENT:Setup( key, damage, removeafter, radius )
self.key = key
self.damage = math.Min(damage, 1500)
self.removeafter = removeafter
self.radius = math.Clamp(radius, 1, 10000)
self.Exploded = false
if (self.damage > 0) then
self.NormInfo = "Damage: " .. math.floor(self.damage) .. "\nRadius: " .. math.floor(self.radius)
else
self.NormInfo = "Radius: " .. math.floor(self.radius)
end
self:ShowOutput()
end
function ENT:OnTakeDamage( dmginfo )
self:TakePhysicsDamage( dmginfo )
end
function ENT:TriggerInput(iname, value)
if (iname == "Detonate") then
if (!self.Exploded) and ( math.abs(value) == self.key ) then
self:Explode()
elseif (value == 0) then
self.Exploded = false
end
end
end
function ENT:Explode( )
if ( !self:IsValid() ) then return end
if (self.Exploded) then return end
local ply = self:GetPlayer()
if not IsValid(ply) then ply = self end
if ( self.damage > 0 ) then
util.BlastDamage( self, ply, self:GetPos(), self.radius, self.damage )
end
local effectdata = EffectData()
effectdata:SetOrigin( self:GetPos() )
util.Effect( "Explosion", effectdata, true, true )
self.Exploded = true
self:ShowOutput()
if ( self.removeafter ) then
self:Remove()
return
end
end
function ENT:ShowOutput( )
if (self.Exploded) then
self:SetOverlayText("Exploded\n"..self.NormInfo)
else
self:SetOverlayText("Explosive\n"..self.NormInfo)
end
end
duplicator.RegisterEntityClass( "gmod_wire_simple_explosive", WireLib.MakeWireEnt, "Data", "key", "damage", "removeafter", "radius" )
|
#!/usr/bin/env lua
local json = require("json")
local socket = require("socket")
local mime = require("mime")
local tcp = socket.tcp()
local sf = string.format
local page = "sample.json"
local action = print
if not arg[1] and not arg[2] then
print("You need to specify a valid user name and password!")
print("Example: "..arg[0].." thelinx secret [filter] [action]")
return
end
if arg[3] then
if tonumber((arg[3]:gsub(",", ""))) then
page = "filter.json?follow="..arg[3]
else
page = "filter.json?track="..arg[3]
end
end
if arg[4] then
function action(string)
print(string)
os.execute(sf(arg[4], string:gsub("<", "<"):gsub(">", ">")))
end
end
tcp:settimeout(99999999)
tcp:connect("stream.twitter.com", 80)
tcp:send(sf([[
GET /1/statuses/%s HTTP/1.0
Host: stream.twitter.com
Authorization: Basic %s
]], page, mime.b64(arg[1]..":"..arg[2])))
while true do
local tw = tcp:receive("*l")
if not tw then return end
if tw:len() > 50 then
local t = json.decode(tw)
if t.user and t.text then
action(sf("<%s> %s", t.user.screen_name, t.text))
end
end
end
|
object_tangible_furniture_city_xwing_event_reward = object_tangible_furniture_city_shared_xwing_event_reward:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_city_xwing_event_reward, "object/tangible/furniture/city/xwing_event_reward.iff")
|
local manager = require(script.Manager)
-- Manager Modules
local datastore = manager('Datastore')
local session = manager('Session')
local suffix = manager('Suffix')
local cache = manager('Cache')
-- Cache
local sessions = cache.Sessions
-- Services
local players = game:GetService('Players')
local replicated_storage = game:GetService('ReplicatedStorage')
-- Folders
local remotes = replicated_storage.Remotes
-- Remotes
local on_ready = remotes.OnReady
local purchase = remotes.Purchase
local data_remote = remotes.Data
local data_update = remotes.DataUpdate
local session_remote = remotes.Session
local session_event = remotes.SessionEvent
local notification = remotes.Notification
-- Variables
local ready = {}
-- Listeners
players.PlayerAdded:Connect(function(player)
local data = datastore.Load(player)
session.New(player)
repeat task.wait() until table.find(ready, player.UserId)
if (data.Claimed == 0 or os.time() >= data.Claimed) then
data.Claimed = os.time() + 86400
data.Streak += 1
local total = (
(data.Bricks > 100 and data.Bricks or 100) *
(data.Streak / 10))
local message = ('You received <font color="rgb(255, 179, 2)">%s bricks</font> from your daily reward!'):format(suffix(total))
data.Bricks += total
notification:FireClient(player, message)
data_update:FireClient(player, datastore.Filter(player.UserId))
end
end)
players.PlayerRemoving:Connect(function(player)
cache:Unload(player.UserId)
end)
-- Remote Listeners
data_remote.OnServerInvoke = function(player)
return datastore.Fetch(player.UserId).Data
end
session_remote.OnServerInvoke = function(player)
if (not sessions:IsEntry(player.UserId)) then
return { error=true, message='Player data was not loaded.' }
end
local entry = sessions(player.UserId)
entry = manager.Table.CopyWithWhitelist(
entry,
{ 'status', 'height', 'chance', 'state' }
)
return entry
end
session_event.OnServerEvent:Connect(function(player: Instance, event_type: string)
if (typeof(event_type) ~= 'string') then return end
local player_session = sessions(player.UserId)
if (event_type:lower() == 'start') then
player_session:Start()
elseif (event_type:lower() == 'click') then
player_session:Play()
end
end)
purchase.OnServerEvent:Connect(function(player: Instance, p1: number)
local player_session = sessions(player.UserId)
player_session:Upgrade(p1)
end)
on_ready.OnServerEvent:Connect(function(player)
if (not table.find(ready, player.UserId)) then
table.insert(ready, player.UserId)
end
end) |
local subgroups = {"empty-barrel", "fill-barrel"}
if settings.startup["unbarrel-subgroup-excludes"] then
subgroups = {}
for subgroup in string.gmatch(settings.startup["unbarrel-subgroup-excludes"].value, '[^",%s]+') do
table.insert(subgroups, subgroup)
end
end
log("hiding subgroups from hand crafting: " .. serpent.line(subgroups))
for _, recipe in pairs(data.raw["recipe"]) do
for _, subgroup in pairs(subgroups) do
if recipe.subgroup == subgroup then
if recipe.ingredients then
recipe.hide_from_player_crafting = true
end
if recipe.normal then
recipe.normal.hide_from_player_crafting = true
end
if recipe.expensive then
recipe.expensive.hide_from_player_crafting = true
end
end
end
end
|
return {
id = "balloon",
name = "Balloons",
cost = 6000,
profit = 1500,
desirability = 5,
width = 3,
dirtyable = true,
visitable = true,
upkeep = 35,
sprites = {
{
name = "interior",
animations = {
clean = {
first = 0,
last = 0,
speed = 1,
},
dirty = {
first = 1,
last = 1,
speed = 1,
},
},
playing = "clean",
},
{
name = "door",
animations = {
opened = {
first = 0,
last = 0,
speed = 1,
},
closed = {
first = 3,
last = 3,
speed = 1,
},
closing = {
first = 0,
last = 3,
speed = 0.2,
goto = "closed",
},
opening = {
first = 3,
last = 0,
speed = 0.2,
goto = "opened",
},
},
playing = "opening",
},
{
name = "windows",
animations = {
opened = {
first = 0,
last = 0,
speed = 1,
},
closed = {
first = 3,
last = 3,
speed = 1,
},
closing = {
first = 0,
last = 3,
speed = 0.2,
goto = "closed",
},
opening = {
first = 3,
last = 0,
speed = 0.2,
goto = "opened",
},
},
playing = "opening",
},
},
}
|
-- ----------------------------------------------------
-- sqlite3_create.lua
--
-- Oct/29/2014
-- ----------------------------------------------------
require ("luasql.sqlite3")
require ("text_manipulate")
require ("sql_manipulate")
print ("*** 開始 ***")
local file_db=arg[1]
print (file_db)
local env = luasql.sqlite3()
local con = env:connect (file_db)
sql_drop_table_proc (con)
sql_create_table_proc (con)
sql_insert_proc (con,"t0711","郡山",78134,"1981-7-15")
sql_insert_proc (con,"t0712","会津若松",45736,"1981-3-25")
sql_insert_proc (con,"t0713","白河",51934,"1981-3-21")
sql_insert_proc (con,"t0714","福島",72382,"1981-8-8")
sql_insert_proc (con,"t0715","喜多方",61536,"1981-1-5")
sql_insert_proc (con,"t0716","二本松",48134,"1981-4-12")
sql_insert_proc (con,"t0717","いわき",67435,"1981-9-17")
sql_insert_proc (con,"t0718","相馬",82137,"1981-10-21")
sql_insert_proc (con,"t0719","須賀川",92538,"1981-11-17")
con:close()
env:close()
print ("*** 終了 ***")
-- ----------------------------------------------------
|
local format = string.format
local cmd = vim.cmd
local M = {}
M.Hlgroup = {
name = '',
opts = {
gui = nil,
guifg = nil,
guibg = nil,
},
}
function M.Hlgroup:embed(text)
return format('%%#%s#%s%%*', self.name, text)
end
function M.Hlgroup:exec()
local opts = ''
for k, v in pairs(self.opts) do
opts = opts .. format('%s=%s', k, v) .. ' '
end
-- Clear the highlight group before (re)defining it
cmd(format('highlight clear %s', self.name))
cmd(format('highlight %s %s', self.name, opts))
end
function M.Hlgroup:new(args)
local hlgroup = {}
setmetatable(hlgroup, self)
self.__index = self
hlgroup.name = args.name
hlgroup.opts = args.opts
hlgroup:exec()
return hlgroup
end
return M
|
fx_version 'cerulean'
games { 'gta5' }
author 'THC'
ui_page 'html/index.html'
files {
'html/index.html',
'html/style.css',
'html/Achtung!-Polizei.otf'
} |
local value = tonumber(redis.call("hincrbyfloat", KEYS[1], ARGV[3], ARGV[1]))
local before = value - ARGV[1]
local limit = tonumber(ARGV[2])
if (value > limit) then
redis.call("hset", KEYS[1], ARGV[3], limit)
if (before >= limit) then
return -1
else
return limit - before
end
end
return ARGV[1] |
local SleepDuration = 50
function main()
for x = 0, 92, 4 do
for y = 0, 6, 1 do
local Col = math.random(8)
if Col == 1 then
SetLed( x, y, 7, 0, 0 )
elseif Col == 2 then
SetLed( x, y, 7, 7, 0 )
elseif Col == 3 then
SetLed( x, y, 7, 7, 7 )
elseif Col == 3 then
SetLed( x, y, 0, 7, 7 )
elseif Col == 5 then
SetLed( x, y, 0, 0, 7 )
elseif Col == 6 then
SetLed( x, y, 0, 0, 7 )
elseif Col == 7 then
SetLed( x, y, 0, 7, 0 )
else
SetLed( x, y, 7, 0, 7 )
end
end
end
Update()
Sleep( SleepDuration )
end |
return {
talon_thanos = {
acceleration = 0.0015,
brakerate = 0.08,
buildcostenergy = 440150,
buildcostmetal = 29800,
builder = false,
buildpic = "talon_thanos.dds",
buildtime = 350000,
canattack = true,
canguard = true,
canhover = true,
canmove = true,
canpatrol = true,
canstop = 1,
category = "ALL HUGE MOBILE SURFACE",
collisionvolumeoffsets = "0 -10 0",
collisionvolumescales = "65 65 185",
collisionvolumetype = "box",
corpse = "dead",
defaultmissiontype = "Standby",
description = "Anti T3/T4 Gravitytank",
explodeas = "BANTHA_BLAST",
firestandorders = 1,
footprintx = 10,
footprintz = 10,
idleautoheal = 5,
idletime = 1800,
losemitheight = 50,
maneuverleashlength = 640,
mass = 29800,
maxdamage = 86745,
maxslope = 16,
maxvelocity = 1.5,
maxwaterdepth = 0,
mobilestandorders = 1,
movementclass = "TANKHOVER4",
name = "Thanos",
noautofire = false,
objectname = "talon_thanos",
radaremitheight = 50,
selfdestructas = "KROG_BLAST",
sightdistance = 750,
standingfireorder = 2,
standingmoveorder = 1,
steeringmode = 1,
turninplace = 0,
turninplaceanglelimit = 140,
turninplacespeedlimit = 0.85,
turnrate = 125,
unitname = "talon_thanos",
waterline = 7,
customparams = {
buildpic = "talon_thanos.dds",
faction = "TALON",
},
featuredefs = {
dead = {
blocking = true,
damage = 12768,
description = "Thanos Wreckage",
featuredead = "heap",
footprintx = 4,
footprintz = 4,
metal = 5265,
object = "talon_thanos_dead",
reclaimable = true,
},
heap = {
blocking = false,
damage = 15960,
description = "Thanos Debris",
footprintx = 4,
footprintz = 4,
metal = 2808,
object = "4x4d",
reclaimable = true,
},
},
sfxtypes = {
pieceexplosiongenerators = {
[1] = "piecetrail0",
[2] = "piecetrail1",
[3] = "piecetrail2",
[4] = "piecetrail3",
[5] = "piecetrail4",
[6] = "piecetrail6",
},
},
sounds = {
canceldestruct = "cancel2",
underattack = "warning1",
cant = {
[1] = "cantdo4",
},
count = {
[1] = "count6",
[2] = "count5",
[3] = "count4",
[4] = "count3",
[5] = "count2",
[6] = "count1",
},
ok = {
[1] = "hovlgok2",
},
select = {
[1] = "hovlgsl2",
},
},
weapondefs = {
antimatteraccelerator = {
areaofeffect = 80,
beamtime = 1,
burnblow = true,
collidefriendly = false,
corethickness = 0.4,
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
energypershot = 10000,
explosiongenerator = "custom:RAVAGER",
firestarter = 20,
impulseboost = 0,
impulsefactor = 0,
largebeamlaser = true,
laserflaresize = 10,
name = "Mounted antimatter accelerator",
noexplode = true,
noselfdamage = true,
range = 1400,
reloadtime = 10,
rgbcolor = "0.1 0.9 1.0",
soundhitdry = "",
soundhitwet = "sizzle",
soundhitwetvolume = 0.3,
soundstart = "talon_accelerator",
soundtrigger = 1,
sweepfire = false,
targetmoveerror = 0.4,
texture1 = "Type4Beam",
texture2 = "NULL",
texture3 = "NULL",
texture4 = "EMG",
thickness = 13,
tolerance = 2000,
turret = false,
weapontype = "BeamLaser",
weaponvelocity = 1500,
customparams = {
light_mult = 1.8,
light_radius_mult = 1.2,
},
damage = {
areoship = 25000,
commanders = 2500,
default = 12500,
experimental_land = 25000,
experimental_ships = 25000,
subs = 5,
},
},
talon_laser = {
areaofeffect = 12,
beamtime = 0.12,
corethickness = 0.175,
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
explosiongenerator = "custom:SMALL_RED_BURN",
firestarter = 30,
impactonly = 1,
impulseboost = 0,
impulsefactor = 0,
laserflaresize = 10,
name = "Rapid Talon Gun",
noselfdamage = true,
range = 650,
reloadtime = 0.3,
rgbcolor = "1.0 0.8 0.25",
rgbcolor2= "1.0 1.0 1.00",
soundhitdry = "talongunhit",
soundhitwet = "sizzle",
soundhitwetvolume = 0.5,
soundstart = "talongunfirerapid",
soundtrigger = 1,
sweepfire = false,
targetmoveerror = 0.1,
thickness = 1,
turret = true,
weapontype = "LaserCannon",
weaponvelocity = 850,
damage = {
default = 75,
subs = 5,
},
},
talon_starburst = {
areaofeffect = 130,
avoidfeature = false,
cegtag = "talonstartbursttrail",
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
firestarter = 70,
flighttime = 6,
impulseboost = 0,
impulsefactor = 0,
model = "talon_rocket",
name = "Guided Rockets",
range = 1050,
reloadtime = 1,
smoketrail = false,
soundhitdry = "xplomed4",
soundhitwet = "splsmed",
soundhitwetvolume = 0.6,
soundstart = "rapidrocket3",
startvelocity = 150,
targetable = 16,
texture1 = "null",
texture2 = "null",
texture3 = "null",
texture4 = "null",
tolerance = 5000,
tracks = true,
turnrate = 50000,
weaponacceleration = 75,
weapontimer = 1.25,
weapontype = "StarburstLauncher",
weaponvelocity = 650,
damage = {
default = 500,
subs = 5,
},
},
},
weapons = {
[1] = {
badtargetcategory = "MEDIUM SMALL TINY",
def = "AntimatterAccelerator",
onlytargetcategory = "SURFACE",
},
[2] = {
def = "TALON_LASER",
onlytargetcategory = "SURFACE",
maindir = "0 0 1",
maxangledif = 320,
},
[3] = {
def = "TALON_STARBURST",
onlytargetcategory = "SURFACE VTOL",
},
},
},
}
|
--Created by the QnEditor,do not modify.If not,you will die very nankan!
local MAP = {
var = {
Button_selected = 1,
Text_num = 2,
Image_congratulation = 3,
Image_gold_icon = 4,
Text_gold_num = 5,
},
ui = {
[1] = {"Button_selected"},
[2] = {"Button_selected","Text_num"},
[3] = {"Button_selected","Image_congratulation"},
[4] = {"Button_selected","View5","Image_gold_icon"},
[5] = {"Button_selected","View5","Text_gold_num"},
},
func = {
[1] = "onBindToSelected",
},
}
return MAP; |
#!/usr/bin/env lua
-- create an mtar v1 file --
local function genHeader(name, len)
--io.stderr:write(name, "\n")
return string.pack(">I2I1I2", 0xFFFF, 1, #name) .. name
.. string.pack(">I8", len)
end
local function packFile(path)
local handle = assert(io.open(path, "r"))
local data = handle:read("a")
handle:close()
return genHeader(path:gsub("^/tmp/dotos/",""):gsub("^rom/",""), #data) .. data
end
for file in io.lines() do
io.write(packFile(file))
end
|
require 'nn'
local fSize = {2, 96, 192, 256, 256}
local featuresOut = fSize[4]
local model = nn.Sequential()
model:add(nn.SpatialConvolution(fSize[1], fSize[2], 7, 7, 3, 3))
model:add(nn.ReLU())
model:add(nn.SpatialMaxPooling(2,2,2,2))
model:add(nn.SpatialConvolution(fSize[2], fSize[3], 5, 5))
model:add(nn.ReLU())
model:add(nn.SpatialConvolution(fSize[3], fSize[4], 3, 3))
model:add(nn.ReLU())
model:add(nn.SpatialConvolution(fSize[4], fSize[5], 1, 1))
model:add(nn.ReLU())
model:add(nn.SpatialAveragePooling(2,2,2,2))
model:add(nn.Reshape(featuresOut*2*2))
model:add(nn.Linear(featuresOut*2*2,1))
return model
|
marauder_soldier = Creature:new {
customName = "a Marauder Soldier",
socialGroup = "endor_marauder",
faction = "endor_marauder",
level = 150,
chanceHit = 3.75,
damageMin = 570,
damageMax = 1050,
baseXp = 10174,
baseHAM = 50000,
baseHAMmax = 60000,
armor = 0,
resists = {20,70,20,60,60,45,80,80,25},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0.0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER + HEALER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/tatooine_npc/hedon_istee.iff"},
outfit = "marauder_outfit",
lootGroups = {
{
groups = {
{group = "marauder_armor_schems", chance = 10000000}
},
lootChance = 1500000
},
{
groups = {
{group = "junk", chance = 10000000},
},
lootChance = 1000000
},
{
groups = {
{group = "armor_attachments", chance = 10000000}
},
lootChance = 1000000
},
{
groups = {
{group = "clothing_attachments", chance = 10000000}
},
lootChance = 1000000
},
{
groups = {
{group = "artifact", chance = 10000000}
},
lootChance = 1000000
},
{
groups = {
{group = "tierone", chance = 10000000}
},
lootChance = 750000
},
},
weapons = {"mixed_force_weapons"},
conversationTemplate = "",
attacks = merge(fencermaster,swordsmanmaster,pikemanmaster,tkamaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(marauder_soldier, "marauder_soldier") |
local shell = require("shell")
local filesystem = require("filesystem")
local computer = require("computer")
if not filesystem.exists("/home/myaenetwork") then
filesystem.makeDirectory("/home/myaenetwork")
shell.setWorkingDirectory("/home/myaenetwork/")
print("Downloading")
shell.execute("wget https://raw.githubusercontent.com/PoroCoco/myaenetwork/main/account.lua")
shell.execute("wget https://raw.githubusercontent.com/PoroCoco/myaenetwork/main/web.lua")
shell.execute("wget https://raw.githubusercontent.com/PoroCoco/myaenetwork/main/MaenUpdater.lua")
shell.execute("wget https://raw.githubusercontent.com/PoroCoco/myaenetwork/main/accountAux.lua")
shell.execute("wget https://raw.githubusercontent.com/PoroCoco/myaenetwork/main/webAux.lua")
shell.setWorkingDirectory("/home/")
filesystem.remove("home/autoInstall.lua")
print("Done")
print("Switching computer architecture to Lua 5.3")
os.sleep(2)
computer.setArchitecture("Lua 5.3")
else
print("Already installed")
end
|
--------------------------------------------------------------------------------
--- Head: Require
--
local gfs = require('gears.filesystem')
--
-- Tail: Require
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--- Head: Path
--
local themes_dir_path = gfs.get_themes_dir()
local theme_default_dir_path = themes_dir_path .. 'default'
print('themes_dir_path = ' .. themes_dir_path)
print('theme_default_dir_path = ' .. theme_default_dir_path)
--
-- Tail: Path
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--- Head: Theme
--
local theme = {}
-- https://github.com/awesomeWM/awesome/blob/master/themes/default/theme.lua#L105
-- https://github.com/awesomeWM/awesome/blob/master/themes/default/layouts/floatingw.png
-- https://github.com/awesomeWM/awesome/blob/master/lib/awful/layout/suit/floating.lua#L109
-- https://github.com/awesomeWM/awesome/blob/master/lib/awful/widget/layoutbox.lua#L34
-- https://github.com/awesomeWM/awesome/blob/master/lib/awful/layout/init.lua#L413
theme.layout_floating = theme_default_dir_path .. '/layouts/floatingw.png'
theme.layout_fairh = theme_default_dir_path .. '/layouts/fairhw.png'
theme.layout_fairv = theme_default_dir_path .. '/layouts/fairvw.png'
theme.layout_magnifier = theme_default_dir_path .. '/layouts/magnifierw.png'
theme.layout_max = theme_default_dir_path .. '/layouts/maxw.png'
theme.layout_fullscreen = theme_default_dir_path .. '/layouts/fullscreenw.png'
theme.layout_tilebottom = theme_default_dir_path .. '/layouts/tilebottomw.png'
theme.layout_tileleft = theme_default_dir_path .. '/layouts/tileleftw.png'
theme.layout_tile = theme_default_dir_path .. '/layouts/tilew.png'
theme.layout_tiletop = theme_default_dir_path .. '/layouts/tiletopw.png'
theme.layout_spiral = theme_default_dir_path .. '/layouts/spiralw.png'
theme.layout_dwindle = theme_default_dir_path .. '/layouts/dwindlew.png'
theme.layout_cornernw = theme_default_dir_path .. '/layouts/cornernww.png'
theme.layout_cornerne = theme_default_dir_path .. '/layouts/cornernew.png'
theme.layout_cornersw = theme_default_dir_path .. '/layouts/cornersww.png'
theme.layout_cornerse = theme_default_dir_path .. '/layouts/cornersew.png'
return theme
--
-- Tail: Theme
--------------------------------------------------------------------------------
|
racesnumbers = {
"first",
"gudrace",
"city",
"mountains",
"desert",
"longroad",
"noname",
"antenna",
"longroad2",
"city2",
"coast",
"mountains2",
"solar",
"desert2"
}
--[[
spawns["name"] = {
angle,
1{x,y,z},
2{x,y,z},
...
}
]]--
spawns = {}
spawns["first"] = {
-90,
{122392,105408,2400},
{122913,105408,2400},
{123416,105408,2400},
{122392,106408,2400},
{122913,106408,2400},
{123416,106408,2400},
{122392,107408,2400},
{122913,107408,2400},
{123416,107408,2400},
{122392,108408,2400},
{122913,108408,2400},
{123416,108408,2400},
{122913,109408,2450},
{123416,109408,2450},
{124906,109864,2400},
{124906,110408,2500},
}
spawns["gudrace"] = {
-25,
{-72024,26202,4600},
{-72024,25732,4600},
{-72024,25191,4600},
{-72524,26302,4650},
{-72524,25832,4650},
{-72524,25291,4650},
{-73024,26402,4650},
{-73024,25932,4650},
{-73024,25391,4650},
{-73524,26502,4650},
{-73524,26032,4650},
{-73524,25491,4650},
{-74024,26602,4650},
{-74024,26132,4650},
{-74024,25591,4650},
{-73997,27032,4650},
}
spawns["city"] = {
0,
{193593,180589,1250},
{193593,180021,1250},
{192593,180589,1250},
{192593,180021,1250},
{191593,180589,1250},
{191593,180021,1250},
{190593,180589,1250},
{190593,180021,1250},
{189593,180589,1250},
{189593,180021,1250},
{188593,180589,1250},
{188593,180021,1250},
{187593,180589,1250},
{187593,180021,1250},
{186593,180589,1250},
{186593,180021,1250},
}
spawns["mountains"] = {
90,
{124370,82095,1550},
{124961,82095,1550},
{124370,81095,1550},
{124961,81095,1550},
{124370,80095,1550},
{124961,80095,1550},
{124370,79095,1550},
{124961,79095,1550},
{124370,78095,1550},
{124961,78095,1550},
{124370,77095,1550},
{124961,77095,1550},
{124370,76095,1550},
{124961,76095,1550},
{124370,75095,1550},
{124961,75095,1550},
}
spawns["desert"] = {
180,
{213802,97185,1250},
{213802,97685,1250},
{213802,96685,1250},
{214802,97185,1250},
{214802,97685,1250},
{214802,96685,1250},
{215802,97185,1250},
{215802,97685,1250},
{215802,96685,1250},
{216802,97185,1250},
{216802,97685,1250},
{216802,96685,1250},
{217802,97185,1250},
{217802,97685,1250},
{217802,96685,1250},
{218657,98744,1250},
}
spawns["longroad"] = {
-90,
{-74578,83417,2150},
{-74943,83417,2150},
{-74578,84417,2150},
{-74943,84417,2150},
{-74578,85417,2150},
{-74943,85417,2150},
{-74578,86417,2150},
{-74943,86417,2150},
{-74578,87417,2150},
{-74943,87417,2150},
{-74578,88417,2150},
{-74943,88417,2150},
{-74578,89417,2150},
{-73617,88820,2150},
{-73617,89820,2150},
{-73617,90820,2150},
}
spawns["noname"] = {
-90,
{177065,156241,4800},
{177565,156241,4800},
{176565,156241,4800},
{176565,157241,4800},
{177065,157241,4800},
{177565,157241,4800},
{177065,158241,4800},
{177565,158241,4800},
{177065,159241,4800},
{177565,159241,4800},
{177065,160241,4800},
{176851,158504,4800},
{176851,159504,4800},
{176851,160504,4800},
{176851,161504,4850},
{176851,162504,4900},
}
spawns["antenna"] = {
-90,
{197631,5739,5550},
{197131,5739,5550},
{196631,5739,5550},
{196131,5739,5550},
{197631,6739,5550},
{197131,6739,5550},
{196631,6739,5550},
{197631,7739,5600},
{197131,7739,5600},
{196631,7739,5600},
{197631,8739,5650},
{197131,8739,5650},
{196631,8739,5650},
{197631,9739,5700},
{197131,9739,5700},
{197631,10739,5750},
}
spawns["longroad2"] = {
180,
{181354,-53771,1550},
{182354,-53771,1550},
{183354,-53771,1550},
{184354,-53771,1550},
{185354,-53771,1600},
{186354,-53771,1600},
{187354,-53771,1600},
{188354,-53771,1600},
{189354,-53771,1600},
{190354,-53771,1600},
{191354,-53771,1550},
{192354,-53771,1500},
{193354,-53771,1450},
{194354,-53771,1400},
{195354,-53771,1350},
{196354,-53771,1300},
}
spawns["city2"] = {
0,
{77094,185785,500},
{76094,185785,500},
{75094,185785,500},
{74094,185785,500},
{73094,185785,500},
{72094,185785,500},
{71094,185785,500},
{70094,185785,500},
{69094,185785,500},
{68094,185785,500},
{67094,185785,500},
{66094,185785,500},
{65094,185785,500},
{64094,185785,500},
{63094,185785,500},
{62094,185785,500},
}
spawns["coast"] = {
90,
{151214,217341,325},
{151714,217341,325},
{151214,216341,325},
{151714,216341,325},
{151214,215341,325},
{151714,215341,325},
{151214,214341,325},
{151714,214341,325},
{151214,213341,325},
{151714,213341,325},
{151214,212341,325},
{151714,212341,325},
{151214,211341,325},
{151714,211341,325},
{151214,210341,325},
{151714,210341,325},
}
spawns["mountains2"] = {
-90,
{98377,-13250,1250},
{98377,-12250,1250},
{98377,-11250,1250},
{98377,-10250,1250},
{98377,-9250,1300},
{98377,-8250,1300},
{98377,-7250,1300},
{98377,-6250,1300},
{98377,-5250,1300},
{98377,-4250,1300},
{98377,-3250,1300},
{98377,-2250,1350},
{98377,-1250,1350},
{98377,-250,1350},
{98377,750,1350},
{98377,1750,1350},
}
spawns["solar"] = {
-90,
{101056,-33863,1200},
{101056,-32863,1200},
{101056,-31863,1200},
{101056,-30863,1200},
{101056,-29863,1200},
{101056,-28863,1200},
{101056,-27863,1200},
{101056,-26863,1200},
{101056,-25863,1200},
{101056,-24863,1200},
{101056,-23863,1200},
{101056,-22863,1200},
{101056,-21863,1200},
{101056,-20863,1200},
{101056,-19863,1200},
{101056,-18863,1200},
}
spawns["desert2"] = {
115,
{140196,-110397,1200},
{140735,-111555,1200},
{140735+539*1,-111555-1158*1,1200},
{140735+539*2,-111555-1158*2,1200},
{140735+539*3,-111555-1158*3,1200},
{140735+539*4,-111555-1158*4,1200},
{140735+539*5,-111555-1158*5,1200},
{140735+539*6,-111555-1158*6,1200},
{140982,-110799,1200},
{140982+539*1,-110799-1158*1,1200},
{140982+539*2,-110799-1158*2,1200},
{140982+539*3,-110799-1158*3,1200},
{140982+539*4,-110799-1158*4,1200},
{140982+539*5,-110799-1158*5,1200},
{140982+539*6,-110799-1158*6,1200},
{140982+539*7,-110799-1158*7,1200},
}
races = {}
races["first"] = {
{122938,104318,2235,90},
{121121,72574,1155},
{111229,32815,1155},
{98125,10518,1375},
{98840,-38486,1240},
{95131,-72866,1209},
{89467,-90448,1632},
{90715,-106145,1169},
{99717,-111916,1263},
{116731,-107788,1115},
{134141,-129625,1151},
{152931,-145749,1155,155}
}
races["gudrace"] = {
{-69563,24614,4510,155},
{-57811,12338,4767},
{-61033,-5821,4084},
{-59680,-25989,3325},
{-85770,-40159,3304},
{-100516,-29882,3265},
{-105346,-6557,2675},
{-88862,-4111,2283},
{-99669,-21663,1082},
{-127300,-36820,1311},
{-137911,-20320,1045},
{-125381,-10583,1757},
{-113182,-4591,2685},
{-116626,8729,1885},
{-130166,22023,2632},
{-141201,32818,3764},
{-129516,45903,2931},
{-105833,41636,4398},
{-85590,32032,4609,155},
}
races["city"] = {
{195254,180363,1195,180},
{198044,181777,1197},
{197685,191434,1194},
{200116,196502,1194},
{209303,198484,1194},
{204302,202415,1194},
{198086,207467,1195},
{190838,210569,1194},
{184727,213379,1194},
{175976,209111,1195},
{153629,209116,1195},
{145752,207796,1196},
{145182,201537,1185},
{151173,196564,367},
{153634,190170,1186},
{171373,189292,1210},
{176135,186995,1195},
{181239,184525,1194},
{184929,182301,1194},
{187331,175054,1357},
{189842,166401,2016},
{187990,160101,3439},
{178639,156436,4730,45},
}
races["mountains"] = {
{124612,83028,1456,-80},
{122249,92705,1212},
{123994,108028,2270},
{126857,118167,4064},
{119600,125599,5080},
{109394,135798,5119},
{112712,150806,4078},
{118380,157888,3541},
{119570,164626,2935},
{115255,172593,3111},
{109278,185427,2786},
{101723,193715,1872},
{90014,188137,1207},
{76760,185783,440},
{64780,185789,440},
{51104,182606,439},
{45094,172268,647},
{45899,163647,1129},
{48176,154201,1230},
{44469,144727,1311},
{48714,135399,1475},
{57374,134994,2013},
{69803,134841,3489},
{79975,136877,3825},
{89511,134934,4573},
{101218,127972,6111},
{100761,122104,6319,90},
}
races["desert"] = {
{211942,97695,1193,-10},
{209969,99311,1220},
{204696,105866,1261},
{196849,108895,1145},
{189501,107463,1146},
{183284,102558,1272},
{175550,99496,1428},
{168251,93752,1366},
{160855,92156,1213},
{153615,85836,1220},
{147287,78915,1146},
{142312,77617,1309},
{132082,77770,1470},
{132463,74731,1489,90},
}
races["longroad"] = {
{-74858,82790,2094,80},
{-76133,77013,2231},
{-78638,71099,2501},
{-75734,65911,2584},
{-60650,59247,1704},
{-48706,48177,1621},
{-40732,37390,2317},
{-31136,27483,2558},
{-20486,27066,1863},
{-9695,16429,1466},
{-7218,-2545,1466},
{-2404,-17028,1466},
{3348,-27150,1467},
{12260,-37352,1467},
{21723,-47373,1480},
{24799,-58160,1721},
{31951,-66858,1805},
{38662,-71798,1189},
{47957,-72205,1181},
{61143,-72333,1214},
{73791,-71386,1256},
{84280,-67895,1355},
{93702,-64772,1279},
{104515,-64767,1279},
{117433,-65360,1192},
{128882,-64767,1463},
{145645,-62106,1557},
{157309,-55558,1751},
{173072,-53585,1498},
{188317,-53991,1538},
{202912,-52687,1143},
{210430,-44722,1114},
{213861,-33951,1121},
{216836,-22938,1443},
{219878,-7662,2000},
{219545,-217,2000,-90},
}
races["noname"] = {
{176495,155226,4729,96},
{177738,149245,5587},
{180797,142667,5653},
{190783,143971,5416},
{198824,144173,4018},
{205379,145205,2592},
{211501,145097,1455},
{216495,138656,1352},
{215326,133296,1506},
{216365,122037,1435},
{219513,111366,1276},
{216726,96980,1183},
{216010,89661,1280},
{216607,80001,1607},
{216189,71775,1467},
{215293,64523,1436},
{215272,55600,1463},
{216300,47575,1499},
{216018,37118,2392},
{222258,19127,2028},
{220676,9553,1956},
{219748,-2369,2000},
{218530,-16931,2073},
{215749,-27584,1238},
{213375,-35627,1123},
{208922,-47565,1137},
{192506,-54147,1450},
{181361,-53763,1492},
{173169,-53579,1498,0},
}
races["antenna"] = {
{197579,4826,5475,94},
{197766,290,5613},
{194508,-6358,5655},
{188957,-11682,5650},
{181404,-13887,6110},
{173290,-14074,6110},
{164365,-7559,6609},
{163134,710,7318},
{166946,6898,8193},
{170824,11302,8915},
{175587,13755,9617},
{179084,13703,10272,140},
}
races["longroad2"] = {
{180514,-53725,1496,-4},
{176601,-53614,1497},
{167241,-55158,1791},
{161038,-56012,1897},
{153391,-56877,1809},
{140176,-63817,1332},
{129049,-64769,1461},
{119138,-65342,1203},
{108602,-65123,1279},
{96032,-64565,1279},
{86579,-66861,1381},
{75335,-71002,1268},
{67203,-72370,1135},
{53018,-72182,1161},
{34358,-69168,1486},
{27520,-62253,1651},
{22412,-50805,1487},
{16257,-40974,1466},
{4293,-28407,1466},
{-3881,-13092,1466},
{-8529,1542,1467},
{-8074,20966,1467},
{-2504,31090,1466},
{4706,44490,1783},
{3443,54085,2001},
{-2863,68907,1927},
{-8620,87908,1534},
{-11470,104855,1514},
{-11211,113377,2131},
{-10269,122020,1501},
{-7459,139178,1456,-90},
}
races["city2"] = {
{77530,185785,440,180},
{82023,185532,416},
{90114,188216,1217},
{97817,192000,2172},
{105664,195253,1861},
{117884,203065,1182},
{121739,211047,1158},
{129470,212620,1170},
{138078,213326,1194},
{142984,211464,1194},
{147575,209122,1195},
{151893,209127,1194},
{158869,209110,1194},
{166794,207855,1194},
{166794,199931,1194},
{166795,187029,1197},
{168569,181136,1230},
{172992,181124,1801},
{179075,180325,1245},
{183689,179751,1193},
{189326,180385,1194},
{198075,181635,1197},
{197682,188743,1194},
{198083,198355,1194},
{198961,202424,1197},
{204462,202433,1194},
{209289,201296,1194},
{209294,195993,1197},
{209286,184650,1194},
{209280,175662,1194},
{209276,168988,1194},
{210087,165336,1197},
{214656,165332,1194},
{219252,163605,1194},
{219437,151378,1193,90},
}
races["coast"] = {
{151537,218055,264,-90},
{150455,222648,291},
{143665,221986,494},
{135983,220111,477},
{130080,218560,475},
{123018,218394,507},
{113373,219984,294},
{108561,222675,70},
{102626,222741,306},
{94286,220245,525},
{87009,216208,1374},
{82245,209043,1267},
{78217,201648,507},
{76000,196228,438},
{74863,189102,439},
{69177,185789,439},
{63266,185795,440},
{52585,183393,439},
{46558,177955,460},
{39972,174868,44},
{31540,174535,163},
{19652,173712,900},
{11581,171666,1445},
{6969,170069,1077},
{-503,167028,901},
{-3953,162755,1102},
{-6941,156913,1243},
{-10241,152411,1057},
{-13417,148082,1623},
{-19008,140685,1504},
{-21789,137158,1446,18},
}
races["mountains2"] = {
{98563,-13794,1204,92},
{94233,-15836,1245},
{86773,-12498,1670},
{81166,-9584,2458},
{76620,-7270,1886},
{72956,1784,1271},
{72099,8825,1270},
{72336,16961,1295},
{73875,26083,1431},
{76480,32610,1307},
{70927,39509,1403},
{59371,42080,2459},
{53583,42226,2947},
{45154,43241,3239},
{39277,43020,3509},
{33027,40666,3059},
{25978,37248,2426},
{20419,31043,2075},
{18541,23694,1637},
{15616,16330,1742},
{14259,8956,1836},
{13938,4449,1928},
{17756,3648,2401},
{19744,10314,2996},
{23739,16795,3507},
{24730,11838,4060},
{23787,6242,4309},
{24504,1057,4862},
{28764,1375,5552},
{27755,6515,5795},
{28906,11950,6509},
{32998,16545,7573},
{39385,16589,8578},
{41672,11742,9109},
{40723,5940,9368},
{40697,681,9807},
{44194,-3150,9784,170},
}
races["solar"] = {
{100994,-34523,1176,90},
{102489,-35597,1154},
{108300,-35492,1145},
{115804,-35380,1145},
{119491,-34201,1146},
{119533,-28977,1146},
{119601,-21358,1146},
{118722,-19466,1145},
{114838,-19007,1145},
{115672,-16787,1145},
{119612,-15826,1146},
{118700,-13909,1145},
{113599,-13974,1145},
{108492,-13920,1145},
{103888,-13871,1145},
{101004,-13468,1154},
{102594,-12536,1145},
{107493,-12506,1145},
{112410,-12514,1145},
{116942,-12564,1145},
{119655,-11650,1145},
{118740,-6623,1146},
{113771,-6660,1146},
{108151,-6619,1146},
{104267,-6626,1146},
{100961,-8652,1145},
{100420,-11318,1171,0},
}
races["desert2"] = {
{140140,-109664,1153,-65},
{138859,-106619,1154},
{141969,-104222,1146},
{147234,-106556,1145},
{153081,-108696,1146},
{159168,-108922,1146},
{164859,-104617,1492},
{170779,-100261,2117},
{172980,-93531,1763},
{166558,-86535,1989},
{164322,-81121,2047},
{167935,-78310,1809},
{172630,-76730,1413},
{175327,-69449,1205},
{176238,-62842,1159},
{176635,-55767,682},
{180803,-48877,948},
{186793,-46225,1355},
{189468,-42513,1355},
{190642,-38463,1387,-150},
} |
--[[
source: https://github.com/hamishforbes/lua-resty-iputils/blob/master/lib/resty/iputils.lua
]]
module(..., package.seeall)
_VERSION = '0.3.1'
local bit = require("bit")
local ipairs = ipairs
local tonumber = tonumber
local tostring = tostring
local type = type
local byte = string.byte
local str_find = string.find
local str_sub = string.sub
local lshift = bit.lshift
local band = bit.band
local bor = bit.bor
local xor = bit.bxor
-- Precompute binary subnet masks...
local bin_masks = {}
for i=0,32 do
bin_masks[tostring(i)] = lshift((2^i)-1, 32-i)
end
-- ... and their inverted counterparts
local bin_inverted_masks = {}
for i=0,32 do
local i = tostring(i)
bin_inverted_masks[i] = xor(bin_masks[i], bin_masks["32"])
end
function split_octets(input)
local pos = 0
local prev = 0
local octs = {}
for i=1, 4 do
pos = str_find(input, ".", prev, true)
if pos then
if i == 4 then
-- Should not have a match after 4 octets
return nil, "Invalid IP"
end
octs[i] = str_sub(input, prev, pos-1)
elseif i == 4 then
-- Last octet, get everything to the end
octs[i] = str_sub(input, prev, -1)
break
else
return nil, "Invalid IP"
end
prev = pos +1
end
return octs
end
function unsign(bin)
if bin < 0 then
return 4294967296 + bin
end
return bin
end
function ip2bin(ip)
if lrucache then
local get = lrucache:get(ip)
if get then
return get[1], get[2]
end
end
if type(ip) ~= "string" then
return nil, "IP must be a string"
end
local octets = split_octets(ip)
if not octets or #octets ~= 4 then
return nil, "Invalid IP"
end
-- Return the binary representation of an IP and a table of binary octets
local bin_octets = {}
local bin_ip = 0
for i,octet in ipairs(octets) do
local bin_octet = tonumber(octet)
if not bin_octet or bin_octet < 0 or bin_octet > 255 then
return nil, "Invalid octet: "..tostring(octet)
end
bin_octets[i] = bin_octet
bin_ip = bor(lshift(bin_octet, 8*(4-i) ), bin_ip)
end
if not bin_ip then
return nil, 'error'
end
bin_ip = unsign(bin_ip)
if lrucache then
lrucache:set(ip, {bin_ip, bin_octets})
end
return bin_ip, bin_octets
end
function split_cidr(input)
local pos = str_find(input, "/", 0, true)
if not pos then
return {input}
end
return {str_sub(input, 1, pos-1), str_sub(input, pos+1, -1)}
end
function parse_cidr(cidr)
local mask_split = split_cidr(cidr, '/')
local net = mask_split[1]
local mask = mask_split[2] or "32"
local mask_num = tonumber(mask)
if not mask_num or (mask_num > 32 or mask_num < 0) then
return nil, "Invalid prefix: /"..tostring(mask)
end
local bin_net, err = ip2bin(net) -- Convert IP to binary
if not bin_net then
return nil, err
end
local bin_mask = bin_masks[mask] -- Get masks
local bin_inv_mask = bin_inverted_masks[mask]
local lower = band(bin_net, bin_mask) -- Network address
local upper = bor(lower, bin_inv_mask) -- Broadcast address
if not upper or not lower then
return nil, 'error'
end
return unsign(lower), unsign(upper)
end
function parse_cidrs(cidrs)
local out = {}
local i = 1
for _,cidr in ipairs(cidrs) do
local lower, upper = parse_cidr(cidr)
if not lower then
log_err("Error parsing '", cidr, "': ", upper)
else
out[i] = {lower, upper}
i = i+1
end
end
return out
end
function ip_in_cidrs(ip, cidrs)
local bin_ip, bin_octets = ip2bin(ip)
if not bin_ip then
return nil, bin_octets
end
for _,cidr in ipairs(cidrs) do
if bin_ip >= cidr[1] and bin_ip <= cidr[2] then
return true
end
end
return false
end
function binip_in_cidrs(bin_ip_ngx, cidrs)
if 4 ~= #bin_ip_ngx then
return false, "invalid IP address"
end
local bin_ip = 0
for i=1,4 do
bin_ip = bor(lshift(bin_ip, 8), byte(bin_ip_ngx, i))
end
if not bin_ip then
return false
end
bin_ip = unsign(bin_ip)
for _,cidr in ipairs(cidrs) do
if bin_ip >= cidr[1] and bin_ip <= cidr[2] then
return true
end
end
return false
end
|
print("Lua Test A")
print("Hello world, Lua!!!")
print("\n") |
--[[
Basically rewriting the c++ code to not be total shit so this can also not be total shit.
]]
local allowedCustomization = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).CustomizeGameplay
local jcKeys = tableKeys(colorConfig:get_data().judgment)
local jcT = {} -- A "T" following a variable name will designate an object of type table.
for i = 1, #jcKeys do
jcT[jcKeys[i]] = byJudgment(jcKeys[i])
end
local jdgT = {
-- Table of judgments for the judgecounter
"TapNoteScore_W1",
"TapNoteScore_W2",
"TapNoteScore_W3",
"TapNoteScore_W4",
"TapNoteScore_W5",
"TapNoteScore_Miss",
"HoldNoteScore_Held",
"HoldNoteScore_LetGo"
}
local dvCur
local jdgCur -- Note: only for judgments with OFFSETS, might reorganize a bit later
local positive = getMainColor("positive")
local highlight = getMainColor("highlight")
local negative = getMainColor("negative")
-- We can also pull in some localized aliases for workhorse functions for a modest speed increase
local Round = notShit.round
local Floor = notShit.floor
local diffusealpha = Actor.diffusealpha
local diffuse = Actor.diffuse
local finishtweening = Actor.finishtweening
local linear = Actor.linear
local x = Actor.x
local y = Actor.y
local addx = Actor.addx
local addy = Actor.addy
local Zoomtoheight = Actor.zoomtoheight
local Zoomtowidth = Actor.zoomtowidth
local Zoomm = Actor.zoom
local queuecommand = Actor.queuecommand
local playcommand = Actor.queuecommand
local settext = BitmapText.settext
local Broadcast = MessageManager.Broadcast
-- these dont really work as borders since they have to be destroyed/remade in order to scale width/height
-- however we can use these to at least make centered snap lines for the screens -mina
local function dot(height, x)
return Def.Quad{
InitCommand=function(self)
self:zoomto(dotwidth,height)
self:addx(x)
end
}
end
local function dottedline(len, height, x, y, rot)
local t = Def.ActorFrame{
InitCommand=function(self)
self:xy(x,y):addrotationz(rot)
if x == 0 and y == 0 then
self:diffusealpha(0.65)
end
end
}
local numdots = len/dotwidth
t[#t+1] = dot(height, 0)
for i=1,numdots/4 do
t[#t+1] = dot(height, i * dotwidth * 2 - dotwidth/2)
end
for i=1,numdots/4 do
t[#t+1] = dot(height, -i * dotwidth * 2 + dotwidth/2)
end
return t
end
local function DottedBorder(width, height, bw, x, y)
return Def.ActorFrame {
Name = "Border",
InitCommand=function(self)
self:xy(x,y):visible(false):diffusealpha(0.35)
end,
dottedline(width, bw, 0, 0, 0),
dottedline(width, bw, 0, height/2, 0),
dottedline(width, bw, 0, -height/2, 0),
dottedline(height, bw, 0, 0, 90),
dottedline(height, bw, width/2, 0, 90),
dottedline(height, bw, -width/2, 0, 90),
}
end
-- Screenwide params
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
isCentered = PREFSMAN:GetPreference("Center1Player")
local CenterX = SCREEN_CENTER_X
local mpOffset = 0
if not isCentered then
CenterX =
THEME:GetMetric(
"ScreenGameplay",
string.format("PlayerP1%sX", ToEnumShortString(GAMESTATE:GetCurrentStyle():GetStyleType()))
)
mpOffset = SCREEN_CENTER_X
end
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local screen -- the screen after it is loaded
local WIDESCREENWHY = -5
local WIDESCREENWHX = -5
--error bar things
local errorBarFrameWidth = capWideScale(get43size(MovableValues.ErrorBarWidth), MovableValues.ErrorBarWidth)
local wscale = errorBarFrameWidth / 180
--differential tracker things
local targetTrackerMode = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetTrackerMode
--receptor/Notefield things
local Notefield
local noteColumns
local usingReverse
--guess checking if things are enabled before changing them is good for not having a log full of errors
local enabledErrorBar = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).ErrorBar
local enabledMiniBar = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).MiniProgressBar
local enabledFullBar = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).FullProgressBar
local enabledTargetTracker = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetTracker
local enabledDisplayPercent = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).DisplayPercent
local enabledJudgeCounter = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).JudgeCounter
local leaderboardEnabled = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).leaderboardEnabled and DLMAN:IsLoggedIn()
local isReplay = GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerController() == "PlayerController_Replay"
local function arbitraryErrorBarValue(value)
errorBarFrameWidth = capWideScale(get43size(value), value)
wscale = errorBarFrameWidth / 180
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Wife deviance tracker. Basically half the point of the theme.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For every doot there is an equal and opposite scoot.
]]
local t =
Def.ActorFrame {
Name = "WifePerch",
OnCommand = function(self)
-- Discord thingies
local largeImageTooltip =
GetPlayerOrMachineProfile(PLAYER_1):GetDisplayName() ..
": " .. string.format("%5.2f", GetPlayerOrMachineProfile(PLAYER_1):GetPlayerRating())
local detail =
GAMESTATE:GetCurrentSong():GetDisplayMainTitle() ..
" " ..
string.gsub(getCurRateDisplayString(), "Music", "") .. " [" .. GAMESTATE:GetCurrentSong():GetGroupName() .. "]"
-- truncated to 128 characters(discord hard limit)
detail = #detail < 128 and detail or string.sub(detail, 1, 124) .. "..."
local state = "MSD: " .. string.format("%05.2f", GAMESTATE:GetCurrentSteps(PLAYER_1):GetMSD(getCurRateValue(), 1))
local endTime = os.time() + GetPlayableTime()
GAMESTATE:UpdateDiscordPresence(largeImageTooltip, detail, state, endTime)
screen = SCREENMAN:GetTopScreen()
usingReverse = GAMESTATE:GetPlayerState(PLAYER_1):GetCurrentPlayerOptions():UsingReverse()
Notefield = screen:GetChild("PlayerP1"):GetChild("NoteField")
Notefield:addy(MovableValues.NotefieldY * (usingReverse and 1 or -1))
Notefield:addx(MovableValues.NotefieldX)
noteColumns = Notefield:get_column_actors()
-- lifebar stuff
local lifebar = SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1)
if (allowedCustomization) then
Movable.pressed = false
Movable.current = "None"
Movable.DeviceButton_r.element = Notefield
Movable.DeviceButton_t.element = noteColumns
Movable.DeviceButton_r.condition = true
Movable.DeviceButton_t.condition = true
self:GetChild("LifeP1"):GetChild("Border"):SetFakeParent(lifebar)
Movable.DeviceButton_j.element = lifebar
Movable.DeviceButton_j.condition = true
Movable.DeviceButton_k.element = lifebar
Movable.DeviceButton_k.condition = true
Movable.DeviceButton_l.element = lifebar
Movable.DeviceButton_l.condition = true
end
lifebar:zoomtowidth(MovableValues.LifeP1Width)
lifebar:zoomtoheight(MovableValues.LifeP1Height)
lifebar:xy(MovableValues.LifeP1X, MovableValues.LifeP1Y)
lifebar:rotationz(MovableValues.LifeP1Rotation)
for i, actor in ipairs(noteColumns) do
actor:zoomtowidth(MovableValues.NotefieldWidth)
actor:zoomtoheight(MovableValues.NotefieldHeight)
end
end,
JudgmentMessageCommand = function(self, msg)
if msg.Offset ~= nil then
dvCur = msg.Offset
jdgCur = msg.Judgment
Broadcast(MESSAGEMAN, "SpottedOffset")
end
end
}
-- lifebard
t[#t + 1] = Def.ActorFrame{
Name = "LifeP1",
MovableBorder(200, 5, 1, -35, 0)
}
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**LaneCover**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Old scwh lanecover back for now. Equivalent to "screencutting" on ffr; essentially hides notes for a fixed distance before they appear
on screen so you can adjust the time arrows display on screen without modifying their spacing from each other.
]]
if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).LaneCover then
t[#t + 1] = LoadActor("lanecover")
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Player Target Differential: Ghost target rewrite, average score gone for now**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Point differential to AA.
]]
-- Mostly clientside now. We set our desired target goal and listen to the results rather than calculating ourselves.
local target = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetGoal
GAMESTATE:GetPlayerState(PLAYER_1):SetTargetGoal(target / 100)
-- We can save space by wrapping the personal best and set percent trackers into one function, however
-- this would make the actor needlessly cumbersome and unnecessarily punish those who don't use the
-- personal best tracker (although everything is efficient enough now it probably wouldn't matter)
-- moved it for better manipulation
local d = Def.ActorFrame {
Name = "TargetTracker",
InitCommand = function(self)
if (allowedCustomization) then
Movable.DeviceButton_7.element = self
Movable.DeviceButton_8.element = self
Movable.DeviceButton_8.Border = self:GetChild("Border")
Movable.DeviceButton_7.condition = enabledTargetTracker
Movable.DeviceButton_8.condition = enabledTargetTracker
end
self:xy(MovableValues.TargetTrackerX, MovableValues.TargetTrackerY):zoom(MovableValues.TargetTrackerZoom)
end,
MovableBorder(100,13, 1, 0, 0)
}
if targetTrackerMode == 0 then
d[#d + 1] =
LoadFont("Common Normal") .. {
Name = "PercentDifferential",
InitCommand = function(self)
self:halign(0):valign(1)
if allowedCustomization then
self:settextf("%5.2f (%5.2f%%)", -100, 100)
setBorderAlignment(self:GetParent():GetChild("Border"), 0, 1)
setBorderToText(self:GetParent():GetChild("Border"), self)
end
self:settextf("")
end,
JudgmentMessageCommand = function(self, msg)
local tDiff = msg.WifeDifferential
if tDiff >= 0 then
diffuse(self, positive)
else
diffuse(self, negative)
end
self:settextf("%5.2f (%5.2f%%)", tDiff, target)
end
}
else
d[#d + 1] =
LoadFont("Common Normal") .. {
Name = "PBDifferential",
InitCommand = function(self)
self:halign(0):valign(1)
if allowedCustomization then
self:settextf("%5.2f (%5.2f%%)", -100, 100)
setBorderAlignment(self:GetParent():GetChild("Border"), 0, 1)
setBorderToText(self:GetParent():GetChild("Border"), self)
end
self:settextf("")
end,
JudgmentMessageCommand = function(self, msg)
local tDiff = msg.WifePBDifferential
if tDiff then
local pbtarget = msg.WifePBGoal
if tDiff >= 0 then
diffuse(self, color("#00ff00"))
else
diffuse(self, negative)
end
self:settextf("%5.2f (%5.2f%%)", tDiff, pbtarget * 100)
else
tDiff = msg.WifeDifferential
if tDiff >= 0 then
diffuse(self, positive)
else
diffuse(self, negative)
end
self:settextf("%5.2f (%5.2f%%)", tDiff, target)
end
end
}
end
if enabledTargetTracker then
t[#t + 1] = d
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Display Percent**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Displays the current percent for the score.
]]
local cp =
Def.ActorFrame {
Name = "DisplayPercent",
InitCommand = function(self)
if (allowedCustomization) then
Movable.DeviceButton_w.element = self
Movable.DeviceButton_e.element = self
Movable.DeviceButton_w.condition = enabledDisplayPercent
Movable.DeviceButton_e.condition = enabledDisplayPercent
Movable.DeviceButton_w.Border = self:GetChild("Border")
Movable.DeviceButton_e.Border = self:GetChild("Border")
end
self:zoom(MovableValues.DisplayPercentZoom):x(MovableValues.DisplayPercentX):y(MovableValues.DisplayPercentY)
end,
Def.Quad {
InitCommand = function(self)
self:zoomto(60, 13):diffuse(color("0,0,0,0.4")):halign(1):valign(0)
end
},
-- Displays your current percentage score
LoadFont("Common Large") .. {
Name = "DisplayPercent",
InitCommand = function(self)
self:zoom(0.3):halign(1):valign(0)
end,
OnCommand = function(self)
if allowedCustomization then
self:settextf("%05.2f%%", -10000)
setBorderAlignment(self:GetParent():GetChild("Border"), 1, 0)
setBorderToText(self:GetParent():GetChild("Border"), self)
end
self:settextf("%05.2f%%", 0)
end,
JudgmentMessageCommand = function(self, msg)
self:settextf("%05.2f%%", Floor(msg.WifePercent * 100) / 100)
end
},
MovableBorder(100, 13, 1, 0, 0)
}
if enabledDisplayPercent then
t[#t + 1] = cp
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Player judgment counter (aka pa counter)**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Counts judgments.
--]]
-- User Parameters
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local spacing = 10 -- Spacing between the judgetypes
local frameWidth = 60 -- Width of the Frame
local frameHeight = ((#jdgT + 1) * spacing) -- Height of the Frame
local judgeFontSize = 0.40 -- Font sizes for different text elements
local countFontSize = 0.35
local gradeFontSize = 0.45
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local jdgCounts = {} -- Child references for the judge counter
local j =
Def.ActorFrame {
Name = "JudgeCounter",
InitCommand = function(self)
if (allowedCustomization) then
Movable.DeviceButton_p.element = self
Movable.DeviceButton_p.condition = enabledJudgeCounter
end
self:xy(MovableValues.JudgeCounterX, MovableValues.JudgeCounterY)
end,
OnCommand = function(self)
for i = 1, #jdgT do
jdgCounts[jdgT[i]] = self:GetChild(jdgT[i])
end
end,
JudgmentMessageCommand = function(self, msg)
if jdgCounts[msg.Judgment] then
settext(jdgCounts[msg.Judgment], msg.Val)
end
end,
Def.Quad { -- bg
InitCommand = function(self)
self:zoomto(frameWidth, frameHeight):diffuse(color("0,0,0,0.4"))
end
},
MovableBorder(frameWidth, frameHeight, 1, 0, 0)
}
local function makeJudgeText(judge, index) -- Makes text
return LoadFont("Common normal") .. {
InitCommand = function(self)
self:xy(-frameWidth/2 + 5, -frameHeight/2 + (index * spacing)):zoom(judgeFontSize):halign(0)
end,
OnCommand = function(self)
settext(self, getShortJudgeStrings(judge))
diffuse(self, jcT[judge])
end
}
end
local function makeJudgeCount(judge, index) -- Makes county things for taps....
return LoadFont("Common Normal") .. {
Name = judge,
InitCommand = function(self)
self:xy(frameWidth/2 - 5, -frameHeight/2 + (index * spacing)):zoom(countFontSize):halign(1):settext(0)
end
}
end
-- Build judgeboard
for i = 1, #jdgT do
j[#j + 1] = makeJudgeText(jdgT[i], i)
j[#j + 1] = makeJudgeCount(jdgT[i], i)
end
-- Now add the completed judgment table to the primary actor frame t if enabled
if enabledJudgeCounter then
t[#t + 1] = j
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Player ErrorBar**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Visual display of deviance MovableValues.
--]]
-- User Parameters
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local barcount = 30 -- Number of bars. Older bars will refresh if judgments/barDuration exceeds this value. You don't need more than 40.
local barWidth = 2 -- Width of the ticks.
local barDuration = 0.75 -- Time duration in seconds before the ticks fade out. Doesn't need to be higher than 1. Maybe if you have 300 bars I guess.
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local currentbar = 1 -- so we know which error bar we need to update
local ingots = {} -- references to the error bars
local alpha = 0.07 -- ewma alpha
local avg
local lastAvg
-- Makes the error bars. They position themselves relative to the center of the screen based on your dv and diffuse to your judgement value before disappating or refreshing
-- Should eventually be handled by the game itself to optimize performance
function smeltErrorBar(index)
return Def.Quad {
Name = index,
InitCommand = function(self)
self:xy(MovableValues.ErrorBarX, MovableValues.ErrorBarY):zoomto(barWidth, MovableValues.ErrorBarHeight):diffusealpha(0)
end,
UpdateErrorBarCommand = function(self) -- probably a more efficient way to achieve this effect, should test stuff later
finishtweening(self) -- note: it really looks like shit without the fade out
diffusealpha(self, 1)
diffuse(self, jcT[jdgCur])
x(self, MovableValues.ErrorBarX + dvCur * wscale)
y(self, MovableValues.ErrorBarY)
Zoomtoheight(self, MovableValues.ErrorBarHeight)
linear(self, barDuration)
diffusealpha(self, 0)
end
}
end
local e =
Def.ActorFrame {
Name = "ErrorBar",
InitCommand = function(self)
if (allowedCustomization) then
Movable.DeviceButton_5.element = self:GetChildren()
Movable.DeviceButton_6.element = self:GetChildren()
Movable.DeviceButton_5.condition = enabledErrorBar ~= 0
Movable.DeviceButton_6.condition = enabledErrorBar ~= 0
Movable.DeviceButton_5.Border = self:GetChild("Border")
Movable.DeviceButton_6.Border = self:GetChild("Border")
Movable.DeviceButton_6.DeviceButton_left.arbitraryFunction = arbitraryErrorBarValue
Movable.DeviceButton_6.DeviceButton_right.arbitraryFunction = arbitraryErrorBarValue
end
if enabledErrorBar == 1 then
for i = 1, barcount do -- basically the equivalent of using GetChildren() if it returned unnamed children numerically indexed
ingots[#ingots + 1] = self:GetChild(i)
end
else
avg = 0
lastAvg = 0
end
end,
SpottedOffsetMessageCommand = function(self)
if enabledErrorBar == 1 then
currentbar = ((currentbar) % barcount) + 1
playcommand(ingots[currentbar], "UpdateErrorBar") -- Update the next bar in the queue
end
end,
DootCommand = function(self)
self:RemoveChild("DestroyMe")
self:RemoveChild("DestroyMe2")
end,
Def.Quad {
Name = "WeightedBar",
InitCommand = function(self)
if enabledErrorBar == 2 then
self:xy(MovableValues.ErrorBarX, MovableValues.ErrorBarY):zoomto(barWidth, MovableValues.ErrorBarHeight):diffusealpha(1):diffuse(
getMainColor("enabled")
)
else
self:visible(false)
end
end,
SpottedOffsetMessageCommand = function(self)
if enabledErrorBar == 2 then
avg = alpha * dvCur + (1 - alpha) * lastAvg
lastAvg = avg
self:x(MovableValues.ErrorBarX + avg * wscale)
end
end
},
Def.Quad {
Name = "Center",
InitCommand = function(self)
self:diffuse(getMainColor("highlight")):xy(MovableValues.ErrorBarX, MovableValues.ErrorBarY):zoomto(2, MovableValues.ErrorBarHeight)
end
},
-- Indicates which side is which (early/late) These should be destroyed after the song starts.
LoadFont("Common Normal") ..
{
Name = "DestroyMe",
InitCommand = function(self)
self:xy(MovableValues.ErrorBarX + errorBarFrameWidth / 4, MovableValues.ErrorBarY):zoom(0.35)
end,
BeginCommand = function(self)
self:settext("Late"):diffusealpha(0):smooth(0.5):diffusealpha(0.5):sleep(1.5):smooth(0.5):diffusealpha(0)
end
},
LoadFont("Common Normal") ..
{
Name = "DestroyMe2",
InitCommand = function(self)
self:xy(MovableValues.ErrorBarX - errorBarFrameWidth / 4, MovableValues.ErrorBarY):zoom(0.35)
end,
BeginCommand = function(self)
self:settext("Early"):diffusealpha(0):smooth(0.5):diffusealpha(0.5):sleep(1.5):smooth(0.5):diffusealpha(0):queuecommand(
"Doot"
)
end,
DootCommand = function(self)
self:GetParent():queuecommand("Doot")
end
},
MovableBorder(MovableValues.ErrorBarWidth, MovableValues.ErrorBarHeight, 1, MovableValues.ErrorBarX, MovableValues.ErrorBarY)
}
-- Initialize bars
if enabledErrorBar == 1 then
for i = 1, barcount do
e[#e + 1] = smeltErrorBar(i)
end
end
-- Add the completed errorbar frame to the primary actor frame t if enabled
if enabledErrorBar ~= 0 then
t[#t + 1] = e
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Player Info**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Avatar and such, now you can turn it off. Planning to have player mods etc exported similarly to the nowplaying, and an avatar only option
]]
if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).PlayerInfo then
t[#t + 1] = LoadActor("playerinfo")
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Full Progressbar**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Song Completion Meter that doesn't eat 100 fps. Courtesy of simply love. Decided to make the full progress bar and mini progress bar
separate entities. So you can have both, or one or the other, or neither.
]]
-- User params
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local width = SCREEN_WIDTH / 2 - 100
local height = 10
local alpha = 0.7
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local replaySlider =
isReplay and
Widg.SliderBase {
width = width,
height = height,
min = 0,
visible = false,
max = GAMESTATE:GetCurrentSong():MusicLengthSeconds(),
-- Change to onValueChangeEnd if this
-- lags too much
onValueChange = function(val)
SCREENMAN:GetTopScreen():SetReplayPosition(val)
end
} or
nil
local p =
Def.ActorFrame {
Name = "FullProgressBar",
InitCommand = function(self)
self:xy(MovableValues.FullProgressBarX, MovableValues.FullProgressBarY)
self:zoomto(MovableValues.FullProgressBarWidth, MovableValues.FullProgressBarHeight)
if (allowedCustomization) then
Movable.DeviceButton_9.element = self
Movable.DeviceButton_0.element = self
Movable.DeviceButton_9.condition = enabledFullBar
Movable.DeviceButton_0.condition = enabledFullBar
end
end,
Def.Quad {
InitCommand = function(self)
self:zoomto(width, height):diffuse(color("#666666")):diffusealpha(alpha)
end
},
Def.SongMeterDisplay {
InitCommand = function(self)
self:SetUpdateRate(0.5)
end,
StreamWidth = width,
Stream = Def.Quad {
InitCommand = function(self)
self:zoomy(height):diffuse(getMainColor("highlight"))
end
}
},
LoadFont("Common Normal") .. {
-- title
InitCommand = function(self)
self:zoom(0.35):maxwidth(width * 2)
end,
BeginCommand = function(self)
self:settext(GAMESTATE:GetCurrentSong():GetDisplayMainTitle())
end,
DoneLoadingNextSongMessageCommand = function(self)
self:settext(GAMESTATE:GetCurrentSong():GetDisplayMainTitle())
end
},
LoadFont("Common Normal") .. {
-- total time
InitCommand = function(self)
self:x(width / 2):zoom(0.35):maxwidth(width * 2):halign(1)
end,
BeginCommand = function(self)
local ttime = GetPlayableTime()
settext(self, SecondsToMMSS(ttime))
diffuse(self, byMusicLength(ttime))
end,
DoneLoadingNextSongMessageCommand = function(self)
local ttime = GetPlayableTime()
settext(self, SecondsToMMSS(ttime))
diffuse(self, byMusicLength(ttime))
end
},
MovableBorder(width, height, 1, 0, 0),
replaySlider
}
if enabledFullBar then
t[#t + 1] = p
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Mini Progressbar**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Song Completion Meter that doesn't eat 100 fps. Courtesy of simply love. Decided to make the full progress bar and mini progress bar
separate entities. So you can have both, or one or the other, or neither.
]]
local width = 34
local height = 4
local alpha = 0.3
local mb =
Def.ActorFrame {
Name = "MiniProgressBar",
InitCommand = function(self)
self:xy(MovableValues.MiniProgressBarX, MovableValues.MiniProgressBarY)
if (allowedCustomization) then
Movable.DeviceButton_q.element = self
Movable.DeviceButton_q.condition = enabledMiniBar
Movable.DeviceButton_q.Border = self:GetChild("Border")
end
end,
Def.Quad {
InitCommand = function(self)
self:zoomto(width, height):diffuse(color("#666666")):diffusealpha(alpha)
end
},
Def.Quad {
InitCommand = function(self)
self:x(1 + width / 2):zoomto(1, height):diffuse(color("#555555"))
end
},
Def.SongMeterDisplay {
InitCommand = function(self)
self:SetUpdateRate(0.5)
end,
StreamWidth = width,
Stream = Def.Quad {
InitCommand = function(self)
self:zoomy(height):diffuse(getMainColor("highlight"))
end
}
},
MovableBorder(width, height, 1, 0, 0)
}
if enabledMiniBar then
t[#t + 1] = mb
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Music Rate Display**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]
t[#t + 1] =
LoadFont("Common Normal") ..
{
InitCommand = function(self)
self:xy(SCREEN_CENTER_X, SCREEN_BOTTOM - 8):zoom(0.35):settext(getCurRateDisplayString())
end,
DoneLoadingNextSongMessageCommand = function(self)
self:settext(getCurRateDisplayString())
end
}
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**BPM Display**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Better optimized frame update bpm display.
]]
local BPM
local a = GAMESTATE:GetPlayerState(PLAYER_1):GetSongPosition()
local r = GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate() * 60
local GetBPS = SongPosition.GetCurBPS
local function UpdateBPM(self)
local bpm = GetBPS(a) * r
settext(BPM, Round(bpm, 2))
end
t[#t + 1] =
Def.ActorFrame {
InitCommand = function(self)
BPM = self:GetChild("BPM")
if #GAMESTATE:GetCurrentSong():GetTimingData():GetBPMs() > 1 then -- dont bother updating for single bpm files
self:SetUpdateFunction(UpdateBPM)
self:SetUpdateRate(0.5)
else
BPM:settextf("%5.2f", GetBPS(a) * r) -- i wasn't thinking when i did this, we don't need to avoid formatting for performance because we only call this once -mina
end
end,
LoadFont("Common Normal") ..
{
Name = "BPM",
InitCommand = function(self)
self:x(SCREEN_CENTER_X):y(SCREEN_BOTTOM - 16):halign(0.5):zoom(0.40)
end
},
DoneLoadingNextSongMessageCommand = function(self)
self:queuecommand("Init")
end
}
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Combo Display**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]
local x = 0
local y = 60
-- CUZ WIDESCREEN DEFAULTS SCREAAAAAAAAAAAAAAAAAAAAAAAAAM -mina
if IsUsingWideScreen() then
y = y - WIDESCREENWHY
x = x + WIDESCREENWHX
end
--This just initializes the initial point or not idk not needed to mess with this any more
function ComboTransformCommand(self, params)
self:x(x)
self:y(y)
end
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Judgment Display**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
moving here eventually
]]
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**NPS Display**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
re-enabling the old nps calc/graph for now
]]
t[#t + 1] = LoadActor("npscalc")
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**NPS graph**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ditto
]]
return t
|
--=============================================================================
--
-- lua/Scoreboard.lua
--
-- Created by Henry Kropf and Charlie Cleveland
-- Copyright 2011, Unknown Worlds Entertainment
--
--=============================================================================
--[[
* Main purpose it to maintain a cache for player info, allowing information for a player
* to be retrived by a players clientIndex or playerName.
*
* Originally intended to be used by the scoreboard, therefore its name.
* Should probably be renamed PlayerRecords or PlayerDatabase
*
* Keeps track of when it was last updated and avoids updating more often than kMaxPlayerDataAge
]]
Script.Load("lua/Insight.lua")
-- primary lookup table with clientIndex (clientId) as key
local playerData = { }
-- index with player name as key
local playerDataByName = { }
-- sorted list by score
local sortedPlayerData = { }
local lastPlayerDataUpdateTime = 0
local kMaxPlayerDataAge = 0.5
local kStatusTranslationStringMap = {
[kPlayerStatus.Dead]="STATUS_DEAD",
[kPlayerStatus.Evolving]="STATUS_EVOLVING",
[kPlayerStatus.Embryo]="STATUS_EMBRYO",
[kPlayerStatus.Commander]="STATUS_COMMANDER",
[kPlayerStatus.Exo]="STATUS_EXO",
[kPlayerStatus.GrenadeLauncher]="STATUS_GRENADE_LAUNCHER",
[kPlayerStatus.Rifle]= "STATUS_RIFLE",
[kPlayerStatus.HeavyMachineGun]= "STATUS_HMG",
[kPlayerStatus.Shotgun]="STATUS_SHOTGUN",
[kPlayerStatus.Flamethrower]="STATUS_FLAMETHROWER",
[kPlayerStatus.Void]="STATUS_VOID",
[kPlayerStatus.Spectator]="STATUS_SPECTATOR",
[kPlayerStatus.Skulk]="STATUS_SKULK",
[kPlayerStatus.Gorge]="STATUS_GORGE",
[kPlayerStatus.Lerk]="STATUS_LERK",
[kPlayerStatus.Fade]="STATUS_FADE",
[kPlayerStatus.Onos]="STATUS_ONOS",
[kPlayerStatus.SkulkEgg]="SKULK_EGG",
[kPlayerStatus.GorgeEgg]="GORGE_EGG",
[kPlayerStatus.LerkEgg]="LERK_EGG",
[kPlayerStatus.FadeEgg]="FADE_EGG",
[kPlayerStatus.OnosEgg]="ONOS_EGG",
}
-- reloads the player data. Should be no need to call this, as player data is reloaded on demand
function Scoreboard_ReloadPlayerData()
PROFILE("Scoreboard:ReloadPlayerData")
lastPlayerDataUpdateTime = Shared.GetTime()
for _, pie in ientitylist(Shared.GetEntitiesWithClassname("PlayerInfoEntity")) do
local statusTxt = "-"
if pie.status ~= kPlayerStatus.Hidden then
local statusTranslationString = kStatusTranslationStringMap[pie.status]
statusTxt = statusTranslationString and Locale.ResolveString(statusTranslationString) or "Unknown status:" .. pie.status
end
local playerRecord = playerData[pie.clientId]
if playerRecord == nil then
playerRecord = {}
playerData[pie.clientId] = playerRecord
playerRecord.ClientIndex = pie.clientId
playerRecord.IsSteamFriend = Client.GetIsSteamFriend(pie.steamId)
playerRecord.Ping = 0
end
playerRecord.LastUpdateTime = lastPlayerDataUpdateTime
playerRecord.EntityId = pie.playerId
playerRecord.Name = pie.playerName
playerRecord.EntityTeamNumber = pie.teamNumber
playerRecord.Score = pie.score
playerRecord.Kills = pie.kills
playerRecord.Deaths = pie.deaths
playerRecord.Resources = math.floor(pie.resources)
playerRecord.IsCommander = pie.isCommander
playerRecord.IsRookie = pie.isRookie
playerRecord.Status = statusTxt
playerRecord.IsSpectator = pie.isSpectator
playerRecord.Assists = pie.assists
playerRecord.SteamId = pie.steamId
playerRecord.Skill = pie.playerSkill
playerRecord.Tech = pie.currentTech
end
sortedPlayerData = { }
playerDataByName = { }
-- clean out old player records
for clientIndex, playerRecord in pairs(playerData) do
if lastPlayerDataUpdateTime - playerRecord.LastUpdateTime > kMaxPlayerDataAge then
playerData[clientIndex] = nil
else
table.insert(sortedPlayerData, playerRecord)
playerDataByName[playerRecord.Name] = playerRecord
end
end
Scoreboard_Sort()
end
-- call this to ensure that the data is reasonably up-to-date
local function CheckForReload()
if Shared.GetTime() - lastPlayerDataUpdateTime > kMaxPlayerDataAge then
Scoreboard_ReloadPlayerData()
return true
end
return false
end
-- Returns the playerRecord for the given players clientIndex, reloading player data if required
function Scoreboard_GetPlayerRecord(clientIndex)
if not CheckForReload() and playerData[clientIndex] == nil then
Scoreboard_ReloadPlayerData()
end
return playerData[clientIndex]
end
-- Returns the playerRecord for the given players name, reloading player data if required
function Scoreboard_GetPlayerRecordByName(playerName)
if not CheckForReload() and playerDataByName[playerName] == nil then
Scoreboard_ReloadPlayerData()
end
return playerDataByName[playerName]
end
function Insight_SetPlayerHealth(clientIndex, health, maxHealth, armor, maxArmor)
local playerRecord = Scoreboard_GetPlayerRecord(clientIndex)
if playerRecord then
playerRecord.Health = health
playerRecord.MaxHealth = maxHealth
playerRecord.Armor = armor
playerRecord.MaxArmor = maxArmor
end
end
function Scoreboard_Clear()
playerData = { }
Insight_Clear()
end
-- Score > Kills > Deaths > Resources
function Scoreboard_Sort()
local function sortByScore(player1, player2)
if player1.EntityTeamNumber == player2.EntityTeamNumber then
if player1.Score == player2.Score then
if player1.Kills == player2.Kills then
if player1.Deaths == player2.Deaths then
if player1.Resources == player2.Resources then
-- Somewhat arbitrary but keeps more coherence and adds players to bottom in case of ties
return player1.ClientIndex > player2.ClientIndex
else
return player1.Resources > player2.Resources
end
else
return player1.Deaths < player2.Deaths
end
else
return player1.Kills > player2.Kills
end
else
return player1.Score > player2.Score
end
else
-- Spectators should be at the top of the RR "team"
-- Spectators are team 3 and RR players are team 0
return player1.EntityTeamNumber > player2.EntityTeamNumber
end
end
table.sort(sortedPlayerData, sortByScore)
end
function Scoreboard_SetPing(clientIndex, ping)
-- setting ping does not cause a reload for missing player data
if playerData[clientIndex] then
playerData[clientIndex].Ping = ping
end
end
-- Set local data for player so scoreboard updates instantly (used only in test)
function Scoreboard_SetLocalPlayerData(playerName, index, data)
playerData[index] = data
end
function Scoreboard_GetPlayerName(clientIndex)
local record = Scoreboard_GetPlayerRecord(clientIndex)
return record and record.Name
end
function Scoreboard_GetPlayerList()
CheckForReload()
local playerList = { }
for p = 1, #sortedPlayerData do
local playerRecord = sortedPlayerData[p]
table.insert(playerList, { name = playerRecord.Name, client_index = playerRecord.ClientIndex })
end
return playerList
end
function Scoreboard_GetPlayerData(clientIndex, dataType)
-- often used to avoid a null-check
local playerRecord = Scoreboard_GetPlayerRecord(clientIndex)
return playerRecord and playerRecord[dataType]
end
--[[
* Get table of scoreboard player records for all players with team numbers in specified table.
]]
function GetScoreData(teamNumberTable)
local scoreData = { }
local commanders = { }
local localTeamNumber = Client.GetLocalClientTeamNumber()
for index, playerRecord in ipairs(sortedPlayerData) do
if table.find(teamNumberTable, playerRecord.EntityTeamNumber) then
local isVisibleTeam = localTeamNumber == kSpectatorIndex or playerRecord.EntityTeamNumber == localTeamNumber
local isCommander = playerRecord.IsCommander and isVisibleTeam
if not isCommander then
table.insert(scoreData, playerRecord)
else
table.insert(commanders, playerRecord)
end
end
end
for _, commander in ipairs(commanders) do
table.insert(scoreData, 1, commander)
end
return scoreData
end
--[[
* Get score data for the blue team
]]
function ScoreboardUI_GetBlueScores()
return GetScoreData({ kTeam1Index })
end
--[[
* Get score data for the red team
]]
function ScoreboardUI_GetRedScores()
return GetScoreData({ kTeam2Index })
end
--[[
* Get score data for everyone not playing.
]]
function ScoreboardUI_GetSpectatorScores()
return GetScoreData({ kTeamReadyRoom, kSpectatorIndex })
end
function ScoreboardUI_GetAllScores()
return GetScoreData({ kTeam1Index, kTeam2Index, kTeamReadyRoom, kSpectatorIndex })
end
function ScoreboardUI_GetTeamResources(teamNumber)
local teamInfo = GetEntitiesForTeam("TeamInfo", teamNumber)
if table.count(teamInfo) > 0 then
return teamInfo[1]:GetTeamResources()
end
return 0
end
--[[
* Get the name of the blue team
]]
function ScoreboardUI_GetBlueTeamName()
return kTeam1Name
end
--[[
* Get the name of the red team
]]
function ScoreboardUI_GetRedTeamName()
return kTeam2Name
end
--[[
* Get the name of the spectator team
]]
function ScoreboardUI_GetSpectatorTeamName()
return kSpectatorTeamName
end
--[[
* Return true if playerName is a local player.
]]
kActualClientId = nil
function ScoreboardUI_IsPlayerLocal(playerName)
local player = Client.GetLocalPlayer()
-- make the scoreboard use the player's actual id to highlight
local clientId = player:GetClientIndex()
if Client.GetIsControllingPlayer() then
kActualClientId = clientId
else
clientId = kActualClientId or clientId
end
-- Get entry with this name and check entity id
if player then
local playerRecord = Scoreboard_GetPlayerRecord(clientId)
return playerRecord and playerName == playerRecord.Name
end
return false
end
function ScoreboardUI_IsPlayerCommander(playerName)
local playerRecord = Scoreboard_GetPlayerRecordByName(playerName)
return playerRecord and playerRecord.IsCommander
end
function ScoreboardUI_IsPlayerRookie(playerName)
local playerRecord = Scoreboard_GetPlayerRecordByName(playerName)
return playerRecord and playerRecord.IsRookie
end
function ScoreboardUI_GetTeamHasCommander(teamNumber)
CheckForReload()
for i = 1, #sortedPlayerData do
local playerRecord = sortedPlayerData[i]
if playerRecord.EntityTeamNumber == teamNumber and playerRecord.IsCommander then
return true
end
end
return false
end
function ScoreboardUI_GetCommanderName(teamNumber)
CheckForReload()
for i = 1, table.maxn(sortedPlayerData) do
local playerRecord = sortedPlayerData[i]
if (playerRecord.EntityTeamNumber == teamNumber) and playerRecord.IsCommander then
return playerRecord.Name
end
end
return nil
end
function ScoreboardUI_GetOrderedCommanderNames(teamNumber)
CheckForReload()
local commanders = {}
-- Create table of commander entity ids and names
for i = 1, table.maxn(sortedPlayerData) do
local playerRecord = sortedPlayerData[i]
if (playerRecord.EntityTeamNumber == teamNumber) and playerRecord.IsCommander then
table.insert( commanders, {playerRecord.EntityId, playerRecord.Name} )
end
end
local function sortCommandersByEntity(pair1, pair2)
return pair1[1] < pair2[1]
end
-- Sort it by entity id
table.sort(commanders, sortCommandersByEntity)
--http Return names in order
local commanderNames = {}
for index, pair in ipairs(commanders) do
table.insert(commanderNames, pair[2])
end
return commanderNames
end
function ScoreboardUI_GetNumberOfAliensByType(alienType)
CheckForReload()
local numberOfAliens = 0
local localTeamNumber = Client.GetLocalClientTeamNumber()
for index, playerRecord in ipairs(sortedPlayerData) do
if alienType == playerRecord.Status and playerRecord.EntityTeamNumber == localTeamNumber then
numberOfAliens = numberOfAliens + 1
end
end
return numberOfAliens
end
|
scrW,scrH = System:screenSize();
imageUrl = "http://g.alicdn.com/ju/lua/2.0.24/doc/icon.png"
IMG_W = scrW/3;
Download( imageUrl,"baidu.png",
function (data)
print( data );
--数据流写到文件中
File.save("demo.png",data);
print(PathOfResource("demo.png"));
--文件创建图片
imageView = Image();
imageView:image("demo.png");
imageView:frame(0,0,IMG_W,IMG_W);
--内容流创建图片
imageView2 = Image();
imageView2:image(data);
imageView2:frame(IMG_W,0,IMG_W,IMG_W);
--读取文件流创建文件
imageView3 = Image();
imageView3:image(File.read("demo.png"));
imageView3:frame(IMG_W*2,0,IMG_W,IMG_W);
end);
|
package = "blunty666.nodes.gui.objects"
class = "CheckBox"
extends = "Button"
constructor = function(self, node, x, y, order)
self.super(node, x, y, order, " ", colours.white, colours.black, 1, 1)
self.isToggle = true
self.activeMainColour = colours.white
self.activeTextColour = colours.black
self.activeText = "X"
end
|
local CSGSecurity = {{{{{ {}, {}, {} }}}}}
Objects = {
--Tach
createObject ( 3115, -2066.1001, 474.60001, 35.1, 0, 90, 270 ),
createObject ( 6959, -1673.4, 799.79999, 35, 0, 90, 0 ),
createObject ( 6959, -1673.4, 772.40002, 35, 0, 90, 0 ),
createObject ( 6959, -1693, 799.79999, 35, 0, 90, 0 ),
createObject ( 6959, -1693, 772.40002, 35, 0, 90, 0 ),
createObject ( 3115, -1683.1, 819.40002, 45.1, 0, 90, 90 ),
createObject ( 3115, -1683.2, 752.79999, 45.1, 0, 90, 270 ),
createObject ( 2951, -1231.2002, 51.79981, 13.1, 0, 0, 315.247 ),
createObject ( 2951, -1230.2, 50.8, 13.1, 0, 0, 315.247 ),
createObject ( 2929, -1227.1, 50.3, 14.9, 0, 0, 45.25 ),
createObject ( 2978, -1228.9, 55.9, 14.3, 0, 90, 224 ),
createObject ( 3095, -209.8, 1055.8, 22.3 ),
createObject ( 6959, 2412.2, 2183.2, 13.4 ),
createObject ( 6959, 2453.5, 2183.2, 13.4 ),
createObject ( 6959, 2491, 2183.2, 13.4 ),
createObject ( 2951, 161.10001, -22.4, 4.5, 0, 0, 90 ),
createObject ( 2951, 136.7, -22.6, 4.5, 0, 0, 90 ),
createObject ( 6959, 1870.3, 2218.8999, 14.1 ),
createObject ( 6959, 1881.8, 2218.8999, 14.1 ),
createObject ( 6959, 1881.8, 2207, 14.1 ),
createObject ( 6959, 1870.3, 2207, 14.1 ),
createObject ( 3115, 1851.8, 2218.8999, 14.4, 0, 180, 0 ),
createObject ( 3115, 1851.8, 2204.8999, 14.4, 0, 179.995, 0 ),
createObject ( 3115, 1901.5, 2206.1001, 14.4, 0, 180, 90 ),
createObject ( 3115, 1901.5, 2217.8, 14.4, 0, 179.995, 90 ),
createObject ( 3095, 366.5, -60.2, 1004.6 ),
createObject ( 7025, 370.10001, -60, 1008.6 ),
-- TachModern
createObject ( 3115, -2066.1001, 474.60001, 35.1, 0, 90, 270 ),
createObject ( 6959, -1673.4, 799.79999, 35, 0, 90, 0 ),
createObject ( 6959, -1673.4, 772.40002, 35, 0, 90, 0 ),
createObject ( 6959, -1693, 799.79999, 35, 0, 90, 0 ),
createObject ( 6959, -1693, 772.40002, 35, 0, 90, 0 ),
createObject ( 3115, -1683.1, 819.40002, 45.1, 0, 90, 90 ),
createObject ( 3115, -1683.2, 752.79999, 45.1, 0, 90, 270 ),
createObject ( 2951, -1231.2002, 51.79981, 13.1, 0, 0, 315.247 ),
createObject ( 2951, -1230.2, 50.8, 13.1, 0, 0, 315.247 ),
createObject ( 2929, -1227.1, 50.3, 14.9, 0, 0, 45.25 ),
createObject ( 2978, -1228.9, 55.9, 14.3, 0, 90, 224 ),
createObject ( 3095, -209.8, 1055.8, 22.3 ),
createObject ( 6959, 2412.2, 2183.2, 13.4 ),
createObject ( 6959, 2453.5, 2183.2, 13.4 ),
createObject ( 6959, 2491, 2183.2, 13.4 ),
createObject ( 2951, 161.10001, -22.4, 4.5, 0, 0, 90 ),
createObject ( 2951, 136.7, -22.6, 4.5, 0, 0, 90 ),
createObject ( 6959, 1870.3, 2218.8999, 14.1 ),
createObject ( 6959, 1881.8, 2218.8999, 14.1 ),
createObject ( 6959, 1881.8, 2207, 14.1 ),
createObject ( 6959, 1870.3, 2207, 14.1 ),
createObject ( 3115, 1851.8, 2218.8999, 14.4, 0, 180, 0 ),
createObject ( 3115, 1851.8, 2204.8999, 14.4, 0, 179.995, 0 ),
createObject ( 3115, 1901.5, 2206.1001, 14.4, 0, 180, 90 ),
createObject ( 3115, 1901.5, 2217.8, 14.4, 0, 179.995, 90 ),
createObject ( 3095, 366.5, -60.2, 1004.6 ),
createObject ( 7025, 370.10001, -60, 1008.6 ),
createObject ( 684, 1099.8, -1291.1, 15.9, 90, 0, 0 ),
createObject ( 684, 1099.3, -1291.4, 15.9, 90, 0, 0 ),
createObject ( 2951, 427.10001, -1642.4, 45.8, 0, 89.75, 40.75 ),
createObject ( 2951, 426.5, -1642.9, 45.8, 0.034, 89.75, 32.998 ),
createObject ( 2951, 1586.3, -1716.1, 25.1, 90, 0, 5.25 ),
createObject ( 2951, 1586.2, -1715.7, 25.1, 90, 0, 5.246 ),
createObject ( 2951, 1588.3, -1742.1, 25.1, 90, 0, 5.246 ),
createObject ( 2951, 1588.3, -1741.4, 25.1, 90, 0, 5.246 ),
createObject ( 2951, 1621.6, -1712.6, 25.1, 90, 0, 5.746 ),
createObject ( 2951, 1621.7, -1713, 25.1, 90, 0, 5.746 ),
createObject ( 2951, 1623.8, -1738.9, 25.1, 90, 0, 5.246 ),
createObject ( 2951, 1623.7, -1738.2, 25.1, 90, 0, 5.246 ),
createObject ( 3095, 1005.3, -919.20001, 45.1, 0, 0, 8 ),
createObject ( 1418, 2007.2, 1519.8, 16, 90, 0, 85 ),
createObject ( 1418, 2007.5, 1523.3, 16, 90, 0, 84.996 ),
createObject ( 1418, 2005.8, 1519.9, 16, 90, 0, 84.996 ),
createObject ( 1418, 2006.4, 1523.4, 16, 89.75, 90, 354.996 ),
createObject ( 3115, 2177.2, 1284.9, 15.4 ),
createObject ( 3115, 2166.8999, 1288.90002, 6.2, 90, 0, 270 ),
createObject ( 2951, 1078.1, 1362.3, 9.8 ),
createObject ( 640, 1175.4, 1223.7, 12.6, 90, 0, 90 ),
createObject ( 640, 1175.7, 1223.7, 12.6, 90, 0, 90 ),
createObject ( 640, 1176.1, 1223.7, 12.6, 90, 0, 90 ),
createObject ( 640, 1175.6, 1223.7, 12.6, 270, 0, 90 ),
createObject ( 640, 2317.1001, 1406, 24.3 ),
createObject ( 640, 2317.1001, 1411.4, 24.3 ),
createObject ( 640, 2317.1001, 1416.7, 24.3 ),
createObject ( 640, 2317.1001, 1422.1, 24.3 ),
createObject ( 640, 2317.1001, 1427.4, 24.3 ),
createObject ( 640, 2317.1001, 1432.7, 24.3 ),
createObject ( 640, 2317.1001, 1438.1, 24.3 ),
createObject ( 640, 2317.1001, 1443.5, 24.3 ),
createObject ( 640, 2317.1001, 1448.9, 24.3 ),
createObject ( 640, 2317.1001, 1454.3, 24.3 ),
createObject ( 640, 2317.1001, 1459.7, 24.3 ),
createObject ( 640, 2317.1001, 1465.1, 24.3 ),
createObject ( 640, 2317.1001, 1470.5, 24.3 ),
createObject ( 640, 2317.1001, 1475.9, 24.3 ),
createObject ( 640, 2317.1006, 1481.2998, 24.3 ),
createObject ( 640, 2317.1001, 1486.7, 24.3 ),
createObject ( 640, 2317.1001, 1492, 24.3 ),
createObject ( 640, 2317.1001, 1497, 24.3 ),
createObject ( 640, 2317.1001, 1501.1, 24.3 ),
createObject ( 640, -180, 1129.1, 19.4, 90, 0, 90 ),
createObject ( 640, -180, 1128.6, 19.4, 90, 0, 90 ),
createObject ( 640, -179.7, 1128.8, 19.4, 90, 0, 1.25 ),
createObject ( 3095, -648.90002, 1174.4, 22.3, 0, 90, 282 ),
createObject ( 3095, -651.09998, 1183.4, 22.2, 0, 270, 281.997 ),
createObject ( 3095, -651.09998, 1183.4, 13.3, 0, 270, 281.992 ),
createObject ( 3095, -646, 1179.1, 22.2, 0.05, 91, 14.1 ),
createObject ( 3095, -646.29999, 1180.3, 22.2, 0.07, 90.08, 14.09 ),
createObject ( 3095, -646.29999, 1180.3, 13.3, 0, 90.049, 14.046 ),
createObject ( 3168, -640.5, 2717.2, 71.2, 0, 0, 42.312 ),
createObject ( 6959, 2301.2, 1730.3, 9.8 ),
createObject ( 3095, 2440, 1745.2, 9.2 ),
createObject ( 6959, 2348.2, 1863.2, 14 ),
createObject ( 4199, 1675.2, 1380.5, 16.1, 0, 0, 29.25 ),
createObject ( 4199, 1672.3, 1385.7, 16.1, 0.06, 0.14, 29.64 ),
createObject ( 4199, 1675.4, 1511.4, 16.1, 0, 0, 326.754 ),
createObject ( 3095, 1670.2, 1483.1, 13.3, 0, 0, 359.5 ),
createObject ( 3095, 1661.4, 1483.2, 13.3, 0, 0, 359.495 ),
createObject ( 3095, 1714, 1348.6, 9.8, 0, 90, 346 ),
createObject ( 2978, -346, 1625.2, 135.7, 330.5, 180.287, 0.391 ),
createObject ( 2978, -346.5, 1625.2, 135.7, 330.496, 180.286, 0.39 ),
createObject ( 3095, 2620.3, 1073.9, 9.1 ),
createObject ( 3095, 2621.5, 1063.6, 9.2 ),
createObject ( 2978, -1674.6, 560.29999, 38.4, 0, 270, 46 ),
createObject ( 2978, -1675.1, 560.79999, 38.4, 0, 270, 46.25 ),
createObject ( 2978, -1675.1, 560.79999, 37, 0, 270, 46 ),
createObject ( 2978, -1674.6, 560.29999, 37, 0, 270, 46 ),
createObject ( 1223, -1645, 544, 34.4, 0, 0, 56 ),
createObject ( 2978, -1650.7, 537.59998, 38.4, 0, 270, 46.247 ),
createObject ( 2978, -1651.1, 538, 38.4, 0, 270, 46.247 ),
createObject ( 2978, -1651.2, 538.09998, 36.7, 0, 270, 46.247 ),
createObject ( 2978, -1650.7, 537.59998, 37, 0, 270, 46.247 ),
createObject ( 2951, -1377.2, 491.60001, 5.6, 0, 0, 90 ),
createObject ( 1418, -1405.9, 1.4, 6.8, 0, 90, 0 ),
createObject ( 3095, -1868.2, -160.10001, 16.1 ),
createObject ( 1446, -1955, 617.70001, 144.3, 302.001, 0, 0 ),
createObject ( 1446, -1959.7, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 1446, -1964.4, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 1446, -1969.1, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 1446, -1973.8, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 1446, -1978.5, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 1446, -1983.2, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 1446, -1987.7, 617.70001, 144.3, 301.998, 0, 0 ),
createObject ( 3095, 1833.2, 1286.6, 8.2, 0, 346.25, 0 ),
createObject ( 6959, -2670.8, 498.29999, 20.1 ),
createObject ( 3095, -1745.2, 979.59998, 24.1, 0, 5.25, 0 ),
createObject ( 3095, -1745.2, 988.59998, 24.1, 0, 5.25, 0 ),
createObject ( 6959, -2276, 1065.9, 64.5 ),
createObject ( 3095, -2511.8, 857.90002, 65.9, 0, 90, 307.75 ),
createObject ( 3095, -2511.8, 857.90002, 74.7, 0, 90, 307.749 ),
createObject ( 3095, -2511.8, 857.90002, 82.6, 0, 90, 307.749 ),
createObject ( 3095, -2511.7, 849.90002, 82.6, 0, 90, 52.251 ),
createObject ( 3095, -2511.7, 849.90002, 73.6, 0, 90, 52.245 ),
createObject ( 3095, -2511.7, 849.90002, 65.9, 0, 90, 52.245 ),
createObject ( 3033, -2515.3, 855, 64.3, 0, 90, 90 ),
createObject ( 3033, -2515.3, 855, 69.9, 0, 90, 90 ),
createObject ( 3033, -2515.3, 855, 75.5, 0, 90, 90 ),
createObject ( 3033, -2515.3, 855, 81.1, 0, 90, 90 ),
createObject ( 3033, -2515.3, 855, 84.7, 0, 90, 90 ),
createObject ( 3033, -2512.5, 852.90002, 61.4, 90, 0, 0 ),
createObject ( 1418, -2863.2, 1253.6, 6.7, 0, 0, 45 ),
createObject ( 1418, -2860.8, 1256, 6.7, 0, 0, 44.995 ),
createObject ( 1418, -2858.3999, 1258.4, 6.7, 0, 0, 44.995 ),
createObject ( 1418, -2856, 1260.8, 6.7, 0, 0, 44.995 ),
createObject ( 1418, -2853.6001, 1263.2, 6.7, 0, 0, 44.995 ),
createObject ( 1418, -2851.2, 1265.6, 6.7, 0, 0, 44.995 ),
createObject ( 1418, -2849.1001, 1267.7, 6.7, 0, 0, 44.995 ),
createObject ( 3095, -2554.6001, 1179, 40.4, 0, 88, 340 ),
createObject ( 984, -2663.3999, 1704.2, 67.6, 0.994, 353.999, 359.854 ),
createObject ( 984, -2663.3999, 1694.6, 67.4, 1.5, 359.25, 0.517 ),
createObject ( 3095, 356.20001, -1628.5, 41, 0.75, 359.25, 339.51 ),
createObject ( 3095, 362, -1630.6, 41, 0.747, 359.247, 344.005 ),
createObject ( 3095, 370, -1632.4, 41, 0.742, 359.242, 350.004 ),
createObject ( 3095, 378, -1633.1, 41, 0.736, 359.242, 359.002 ),
createObject ( 3095, 386.29999, -1632.6, 41, 0.731, 359.992, 4.491 ),
createObject ( 3095, 388.5, -1632, 41, 0.731, 359.989, 4.488 ),
createObject ( 3095, 395, -1629.1, 41, 0.731, 359.989, 356.988 ),
createObject ( 3095, 395.10001, -1627.8, 44.8, 0.725, 359.989, 358.734 ),
createObject ( 3095, 388.70001, -1629.8, 44.8, 0.72, 359.989, 354.231 ),
createObject ( 3095, 381.89999, -1633.1, 44.8, 0.714, 359.989, 1.227 ),
createObject ( 3095, 373.60001, -1632.9, 44.8, 0.709, 359.989, 355.225 ),
createObject ( 3095, 366.10001, -1631.6, 44.8, 0.709, 359.989, 347.721 ),
createObject ( 3095, 361.79999, -1630.3, 44.8, 0.709, 359.989, 347.717 ),
createObject ( 3095, 355.89999, -1625.7, 44.8, 0.709, 359.989, 351.717 ),
createObject ( 3095, 349.79999, -1623.7, 41, 0.209, 359.989, 351.716 ),
createObject ( 3095, 349.5, -1623.3, 40.3, 0, 90, 264.25 ),
createObject ( 3095, 350.20001, -1621.7, 44.2, 0, 90, 264.249 ),
createObject ( 3095, 350, -1624.7, 36, 0, 90, 263.249 ),
createObject ( 3095, 356.79999, -1626.7, 44.2, 0, 90, 264.249 ),
createObject ( 3095, 362.39999, -1633.1, 44.7, 0, 90, 264.249 ),
createObject ( 3095, 370.39999, -1634.1, 44.7, 0, 90, 264.249 ),
createObject ( 3095, 379.20001, -1635.1, 44.7, 0, 90, 264.999 ),
createObject ( 3095, 381.70001, -1635.5, 44.7, 0, 90, 263.746 ),
createObject ( 3095, 389.5, -1630.8, 44.2, 0, 90, 263.743 ),
createObject ( 3095, 395.5, -1627.1, 44.2, 0, 90, 263.743 ),
createObject ( 3095, 395.20001, -1628.9, 40.9, 0, 90, 263.743 ),
createObject ( 3095, 395.10001, -1630.2, 36.4, 0, 90, 263.743 ),
createObject ( 3095, 389.10001, -1633.2, 36.4, 0, 90, 263.743 ),
createObject ( 3095, 382.10001, -1635.1, 36.4, 0, 90, 262.993 ),
createObject ( 3095, 373.5, -1634, 36.4, 0, 90, 262.991 ),
createObject ( 3095, 363.89999, -1632.8, 36.4, 0, 90, 262.991 ),
createObject ( 3095, 362, -1632.6, 36.4, 0, 90, 262.991 ),
createObject ( 3095, 355.39999, -1630, 36.4, 0, 90, 262.991 ),
createObject ( 3095, 393.39999, -1631.8, 36.4, 0, 90, 353 ),
createObject ( 3095, 387.10001, -1632.9, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 381, -1633.2, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 374.89999, -1633.2, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 368.89999, -1632.4, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 363, -1631, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 357.10001, -1629.3, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 351.29999, -1626.8, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 345.60001, -1623.3, 36.4, 0, 90, 352.996 ),
createObject ( 3095, 393.60001, -1630.2, 44.5, 0, 90, 352.996 ),
createObject ( 3095, 387.10001, -1632.9, 44.5, 0, 90, 352.996 ),
createObject ( 3095, 381, -1633.2, 44.5, 0, 90, 352.996 ),
createObject ( 3095, 374.89999, -1633.2, 44.5, 0, 90, 352.996 ),
createObject ( 3095, 368.89999, -1632.4, 44.5, 0, 90, 352.996 ),
createObject ( 3095, 362.79999, -1631, 44.5, 0, 90, 355.496 ),
createObject ( 3095, 356.89999, -1629.2, 44.5, 0, 90, 355.496 ),
createObject ( 3095, 351.29999, -1625.2, 44.5, 0, 90, 355.496 ),
createObject ( 3095, 345.60001, -1621.9, 40.7, 0, 90, 355.496 ),
createObject ( 3095, 345.70001, -1620.2, 44.7, 0, 90, 355.496 ),
createObject ( 2951, 496.89999, -1361.3, 20.4, 90, 5.548, 49.202 ),
createObject ( 2978, 500.10001, -1359, 20.2, 0, 0, 23 ),
createObject ( 2951, 842.59998, -1062.8, 32.5, 90, 0, 305 ),
createObject ( 2951, 839.40002, -1058.2, 32.5, 90, 0, 303.247 ),
createObject ( 2951, 839.20001, -1056.5, 32.5, 90, 0, 249.995 ),
createObject ( 2951, 841.20001, -1053.9, 32.5, 90, 0, 215.494 ),
createObject ( 2978, 835.40002, -1056.9, 32.7, 0, 180, 354 ),
createObject ( 2978, 835.5, -1056, 32.7, 0, 179.995, 353.996 ),
createObject ( 2978, 835.70001, -1055.1, 32.7, 0, 179.995, 339.996 ),
createObject ( 2978, 836, -1054.5, 32.7, 0, 179.995, 334.244 ),
createObject ( 2978, 836.59998, -1053.7, 32.7, 0, 179.995, 316.994 ),
createObject ( 2978, 837.70001, -1053, 32.7, 0, 179.995, 313.239 ),
createObject ( 17968, 2442.3999, -1641.8, 26.9 ),
createObject ( 3095, 1300.5, -965.70001, 34.6, 0, 90, 270 ),
createObject ( 6959, -2177.3999, 238.3, 50.5 ),
createObject ( 6959, -2177.2, 265.70001, 50.5, 0.04, 0.04, 0.07 ),
createObject ( 6959, -2218.5, 265.60001, 50.5, 0.038, 0.038, 0.066 ),
createObject ( 6959, -2218.6001, 239.10001, 50.5, 0.07, 0, 0.04 ),
createObject ( 2951, -2241.8999, 282.89999, 50.2, 90, 0, 90 ),
createObject ( 2951, -2241.8999, 277.29999, 50.2, 90, 0, 90 ),
createObject ( 2951, -2241.8999, 271.60001, 50.2, 90, 0, 90 ),
createObject ( 2951, -2240.2, 266.20001, 50.2, 90, 0, 128 ),
createObject ( 2951, -2241.8999, 233.10001, 50.2, 90, 0, 90 ),
createObject ( 2951, -2241.8999, 227.5, 50.2, 90, 0, 90 ),
createObject ( 2951, -2241.8999, 221.89999, 50.2, 90, 0, 90 ),
createObject ( 2951, -2240.1001, 238.10001, 50.2, 90, 0, 50.5 ),
createObject ( 10793, 381.20001, -2069.1001, 26.9, 0, 0, 270 ),
createObject ( 3095, 1955, -1557.1, 16.1, 0, 0, 314.5 ),
createObject ( 3095, 1941.6, -1557.6, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 1938.1, -1554.1, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 1951.2, -1580.2, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 1957.5, -1586.5, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 1959.8, -1588.9, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 1994.5, -1586.6, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 1998.7, -1590.8, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 2007.8, -1591, 16.1, 0, 0, 314.995 ),
createObject ( 3095, 2018.7, -1591, 16.1, 0, 0, 314.995 ),
createObject ( 17031, -637.70001, -1701.3, 43.4, 348, 0, 64 ),
createObject ( 17031, -623.70001, -1701.1, 43.4, 347.997, 0, 63.995 ),
createObject ( 17031, -596.70001, -1715.8, 43.4, 347.997, 0, 63.995 ),
createObject ( 17031, -581.70001, -1735.2, 43.4, 347.997, 0, 47.995 ),
createObject ( 744, -613, -1898.9, 0.7 ),
createObject ( 744, -611.20001, -1897.2, 0.7 ),
createObject ( 744, -613.70001, -1896.4, 0.7 ),
createObject ( 744, -615.40002, -1898.7, 0.7, 0, 1.25, 0.75 ),
createObject ( 899, -759.20001, -1847.7, 16.3, 38, 0, 0 ),
createObject ( 6959, 239, 1795.3, 16.6 ),
createObject ( 6959, 195.5, 1794.5, 16.6 ),
createObject ( 2951, 689.59998, -1426.1, 17.5, 0, 0, 90 ),
createObject ( 2951, 1865.3, 2075.3, 12.4 ),
createObject ( 2951, 1865.2, 2074.8, 12.4 ),
createObject ( 684, 1866.4, 2075, 15.7, 0, 140, 90 ),
createObject ( 684, 1866.3, 2075.2, 15.74, 0, 212.499, 90 ),
createObject ( 3095, 874.09998, -1563.1, 15.9, 0, 0, 22 ),
}
for index, object in ipairs ( Objects ) do
setElementDoubleSided ( object, true )
end
-- GTI Fixes
local mapObjects = {
createObject(2935, 1712.15, 907.9, 12.94, 0, 0, 0),
createObject(2935, 1715.199, 907.8994, 12.94, 0, 0, 0),
createObject(2935, 1712.1494, 901, 12.94, 0, 0, 0),
createObject(2935, 1715.1992, 901, 12.94, 0, 0, 0),
createObject(2935, 1712.15, 895, 12.94, 0, 0, 0),
createObject(2935, 1715.1992, 895, 12.94, 0, 0, 0),
createObject(2765, -2240.2998, 79.3994, 37.5, 0, 0, 135),
createObject(2395, 1277.5977, 2531.1992, 20, 0, 179.995, 90),
createObject(2395, 1276, 2525.5, 18.5, 0, 90, 53.998),
createObject(2395, 1277.3994, 2531.8, 17.7, 0, 90, 125.997),
createObject(2395, 1277.598, 2531.199, 17.4, 0, 179.995, 90),
createObject(8650, 1078.3001, 1386.5, 5.9, 0, 0, 0),
createObject(8650, 850.6, -1043.6, 29, 0, 0, 304),
createObject(8650, 1823.65, 2063.2, 7.3, 0, 0, 0),
createObject(8650, 1771.6, 2163.2, 7.5, 0, 0, 0),
createObject(8650, 1737.5, 2122.7, 12.4, 0, 0, 90),
createObject(17946, 2533.7002, -1290.6025, 36.95, 0, 0, 359.747),
createObject(6959, 2397.8994, 2164.1992, -2.3, 90, 179.995, 179.995),
createObject(6959, 2438.5, 2164.2, -2.3, 90, 180.005, 179.984),
createObject(16317, 1553.6999, 889.3, 8.1, 0, 0, 10),
createObject(2987, -1406, 1.2, 6, 0, 0, 0),
createObject(2885, 145.1, -200.6, 3.8, 90, 0, 316),
createObject(1498, 2401.7, -1714.6, 12.9, 0, 0, 0),
createObject(2885, -2397.8999, 2408, 18.8, 0, 0, 64),
createObject(6959, 2479.8, 2164.2, -2.3, 90, 179.995, 179.995),
createObject(6959, 2493.5, 2164.2, -2.3, 90, 180.005, 179.984),
createObject(17026, -2304.8999, -883.8, 1, 0, 0, 220),
createObject(901, -2314, -879.6, 18, 0, 0, 16),
createObject(901, -2313.8, -888.3, 13.8, 0, 0, 15.996),
createObject(901, -2311.8, -895.8, 8.5, 0, 0, 15.996),
createObject(2774, 1865.9, 2233.3999, 2.7, 0, 0, 0),
createObject(901, -2320, -875.8, 25, 50, 0, 347.996),
createObject(2774, 1866.1, 2233.3999, 2.7, 0, 0, 0),
createObject(901, -2313.5, -877.2, 25.3, 49.999, 0, 347.992),
createObject(2774, 1886.1, 2233.3999, 2.7, 0, 0, 0),
createObject(2774, 1885.9, 2233.3999, 2.7, 0, 0, 0),
createObject(901, -2326, -871.3, 24, 49.999, 0, 319.992),
createObject(2774, 1907.6, 2211.8, 2.7, 0, 0, 0),
createObject(2774, 1907.6, 2212, 2.7, 0, 0, 0),
createObject(2774, 1886.1, 2190.3, 2.7, 0, 0, 0),
createObject(2774, 1885.9, 2190.3, 2.7, 0, 0, 0),
createObject(2774, 1866.1, 2190.3, 2.7, 0, 0, 0),
createObject(2774, 1865.9, 2190.3, 2.7, 0, 0, 0),
createObject(2774, 1844.5, 2211.8, 2.7, 0, 0, 0),
createObject(2774, 1844.5, 2212, 2.7, 0, 0, 0),
createObject(1649, -1593.1999, 642.8, 37.8, 0, 0, 46),
createObject(3037, 2507, 1144.8001, 18.8, 0, 0, 90),
createObject(3062, 2503.8, 1144.8001, 19.1, 0, 0, 0),
createObject(3037, 2510.5, 1144.8001, 18.8, 0, 0, 90),
createObject(3037, 2515.7, 1149.5, 18.8, 0, 0, 0),
createObject(1649, -1590.3001, 645.9, 38.1, 0, 0, 46.494),
createObject(1649, -1587.3001, 649, 38.1, 0, 0, 46.244),
createObject(3055, 2167.3, 1289.8001, 9.8, 0, 0, 268),
createObject(1649, -1585.1, 651.4, 38.1, 0, 0, 46.741),
createObject(3055, 2171, 1290.8001, 13.8, 90, 90, 267.995),
createObject(3037, -1564, 674.2, 39.5, 0, 0, 316.5),
createObject(3037, -1571.3001, 666.8, 40.2, 0, 0, 316.5),
createObject(2957, 807, -1031.3001, 27.4, 0, 0, 32.75),
createObject(3037, -1577.1, 659.7, 39.9, 0, 0, 316.5),
createObject(3037, -1583.1, 653.5, 39.6, 0, 0, 316.5),
createObject(3037, -1588.1999, 648.5, 39.4, 0, 0, 316.5),
createObject(3037, -1594.5, 642.1, 39.1, 0, 0, 316.5),
createObject(3037, -1600, 636.6, 38.9, 0, 0, 316.5),
createObject(3037, -1604.1999, 632.6, 38.7, 0, 0, 316.5),
createObject(3037, -1609.1, 626.8, 38.4, 0, 0, 316.5),
createObject(3037, -1612.6, 622.3, 37.2, 0, 0, 316.5),
createObject(3037, -1618, 617.2, 38, 0, 0, 316.5),
createObject(3037, -1623.5, 611.8, 37.7, 0, 0, 316.5),
createObject(2957, 812.5, -1028.6999, 27.5, 0, 0, 23.745),
createObject(3037, -1629.1999, 606.2, 37.4, 0, 0, 316.5),
createObject(3037, -1635.8001, 599.3, 37.1, 0, 0, 316.5),
createObject(3037, -1640.6999, 593.7, 36.8, 0, 0, 316.5),
createObject(2957, 817.4, -1026.1999, 27.5, 0, 0, 25.491),
createObject(2957, 824, -1023, 27.8, 0, 0, 23.738),
createObject(3037, 1038.5, -1382.8001, 17.3, 0, 90, 90),
createObject(5020, 2862.1001, -1408, 16.3, 0, 90, 270),
createObject(5020, 2862.3, -1405.4, 16.3, 0, 90, 270),
createObject(5020, 2861.8, -1404.3001, 16.3, 0, 90, 270),
createObject(5020, 935, -1384.3001, 18.5, 0, 90, 270),
createObject(5020, 937.2, -1384.4, 18.5, 0, 90, 270),
createObject(5020, 935, -1386.1, 17.2, 0, 0, 90),
createObject(5020, 937.2, -1386, 17.2, 0, 0, 90),
createObject(17951, 1934.7, -1555.6, 14.4, 0, 0, 44.75),
createObject(17951, 1939.1, -1559.9, 14.4, 0, 0, 44.747),
createObject(17951, 1940.2, -1560.9, 14.4, 0, 0, 44.747),
createObject(17951, 1951.5, -1558.5, 14.9, 0, 0, 44.747),
createObject(17951, 1953.5, -1560.5, 14.9, 0, 0, 44.747),
createObject(2934, -2587.4, 960.6, 86.6, 0, 0, 0),
createObject(2934, -2587.4, 956.1, 86.6, 0, 0, 90),
createObject(2934, -2587.4, 964.8, 86.6, 0, 0, 90),
createObject(2934, -2589.7, 960.7, 86.6, 0, 0, 0),
createObject(2934, -2584.7, 960.4, 86.6, 0, 0, 0),
createObject(2934, -2587, 949.9, 81.5, 0, 0, 0),
createObject(2934, -2589.2, 949.9, 81.5, 0, 0, 0),
createObject(2934, -2584.7, 950.3, 81.5, 0, 0, 0),
createObject(2934, -2584.3, 942.3, 77.5, 0, 0, 0),
createObject(2934, -2586.8, 942.4, 77.5, 0, 0, 0),
createObject(2934, -2589.6, 942.6, 77.5, 0, 0, 0),
createObject(2934, -2587.3, 934.2, 75.5, 0, 0, 0),
createObject(2934, -2590, 934.4, 75.5, 0, 0, 0),
createObject(2934, -2584.5, 934.1, 75.5, 0, 0, 0),
createObject(2934, -2587.1, 925.7, 72.1, 0, 0, 0),
createObject(2934, -2583.6, 925.8, 72.1, 0, 0, 0),
createObject(2934, -2589.9, 926.4, 72.1, 0, 0, 0),
createObject(2934, -2580.1, 923.9, 72.6, 0, 0, 90),
createObject(2934, -2580, 921.4, 72.6, 0, 0, 90),
createObject(2934, -2580.1, 925.9, 72.6, 0, 0, 90),
createObject(2934, -2553.9, 924.2, 72, 0, 0, 90),
createObject(2934, -2553.8, 921, 72, 0, 0, 90),
createObject(2934, -2543.6, 931.6, 72.7, 0, 0, 0),
createObject(2934, -2540.3, 931.6, 72.7, 0, 0, 0),
createObject(2934, -2548.6, 940.6, 72.5, 0, 0, 0),
createObject(2934, -2545.8, 940.5, 72.5, 0, 0, 0),
createObject(2934, -2544.3, 940.6, 72.5, 0, 0, 0),
createObject(2934, -2550.3, 949.3, 72.9, 0, 0, 0),
createObject(2934, -2546.8, 949.2, 72.9, 0, 0, 0),
createObject(2934, -2543, 949.6, 72.9, 0, 0, 0),
createObject(2934, -2546.5, 956.7, 78.1, 0, 0, 0),
createObject(2934, -2549.7, 956.8, 78.1, 0, 0, 0),
createObject(2934, -2543.5, 956.7, 78.1, 0, 0, 0),
createObject(2934, -2549.3, 964.8, 82.9, 0, 0, 0),
createObject(2934, -2546.1, 964.9, 82.9, 0, 0, 0),
createObject(2934, -2543.3, 965, 82.9, 0, 0, 0),
createObject(2934, -2547.3, 970, 82.9, 0, 0, 90),
createObject(2934, -2545.3, 970.1, 82.9, 0, 0, 90),
createObject(2934, -2547.3, 972.8, 82.9, 0, 0, 90),
createObject(2934, -2545.3, 972.5, 82.9, 0, 0, 90),
createObject(2934, -2547.6, 977.6, 85.5, 0, 0, 0),
createObject(2934, -2544.8, 977.6, 85.5, 0, 0, 0),
createObject(2934, -2542.5, 977.6, 85.5, 0, 0, 0),
createObject(2934, -2554.1, 989, 85.3, 0, 0, 0),
createObject(2934, -2556.6, 989.1, 85.3, 0, 0, 0),
createObject(2934, -2581.3, 988.8, 85.9, 0, 0, 0),
createObject(2934, -2584.1, 988.6, 85.9, 0, 0, 0),
createObject(2934, -2591.5, 977.9, 85.5, 0, 0, 0),
createObject(2934, -2594.5, 977.6, 85.5, 0, 0, 0),
createObject(2934, -2596.2, 977.7, 85.5, 0, 0, 0),
createObject(2934, 244, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 234.5, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 226, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 216.7, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 201.7, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 192.9, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 183.6, 1828.5, 18.1, 0, 0, 90),
createObject(2934, 174.6, 1828.5, 18.1, 0, 0, 90),
createObject(3577, -2455.9, 764.1, 44, 0, 270, 0),
createObject(3577, -2455.9, 764.1, 45, 0, 269.995, 0),
createObject(11012, -2166.8, -236.5, 40.9, 0, 0, 0),
createObject(17951, 1029.4, -1176.4, 26.3, 0, 0, 0),
createObject(900, 474.7, 798, -19, 0, 90, 0),
createObject(2765, -1467.9, 505.2, 9, 0, 0, 90),
createObject(2765, -1467.9, 507.1, 9, 0, 0, 90),
createObject(2765, -1467.8, 503, 9, 0, 0, 90),
createObject(2765, -1467.8, 499.2, 9, 0, 0, 90),
createObject(2765, -1467.8, 496.1, 9, 0, 0, 90),
createObject(2765, -1467.8, 492.8, 9, 0, 0, 90),
createObject(2765, -1651, 538.4, 38.71, 0, 90, 318),
createObject(2765, -1869.1, -156.7, 17.1, 90, 16.779, 73.221),
createObject(2765, -1869.3, -159.5, 17.1, 90, 16.776, 73.218),
createObject(10974, -2200.5, 251.91, 53.2, 0, 0, 0),
createObject(17951, 2862.3, -1445.3, 15.1, 0, 90, 0),
createObject(17951, 2862.3, -1439.2, 15.1, 0, 90, 0),
createObject(17951, 2862.3, -1433.1, 15.1, 0, 90, 0),
createObject(17951, 2858.8, -1433.1, 15.1, 0, 90, 0),
createObject(17951, 2858.8, -1439.2, 15.1, 0, 90, 0),
createObject(1569, -2550.8, 195.5, 5.15, 0, 0, 285.5),
createObject(1569, -2550, 192.6, 5.15, 0, 0, 105.496),
}
-- LOD Objects
--------------->>
local lodObjects = {
createObject(7343, 2397.8994, 2164.1992, -2.3, 90, 179.995, 179.995, true),
createObject(7343, 2438.5, 2164.2, -2.3, 90, 180.005, 179.984, true),
createObject(7343, 2479.8, 2164.2, -2.3, 90, 179.995, 179.995, true),
createObject(7343, 2493.5, 2164.2, -2.3, 90, 180.005, 179.984, true),
createObject(11270, -2166.8, -236.5, 40.9, 0, 0, 0, true),
}
-- LOD Object Association
-------------------------->>
setLowLODElement(mapObjects[18], lodObjects[1])
setLowLODElement(mapObjects[19], lodObjects[2])
setLowLODElement(mapObjects[25], lodObjects[3])
setLowLODElement(mapObjects[26], lodObjects[4])
setLowLODElement(mapObjects[148], lodObjects[5])
-- Double Sided
---------------->>
setElementDoubleSided(mapObjects[8], true)
setElementDoubleSided(mapObjects[9], true)
setElementDoubleSided(mapObjects[10], true)
setElementDoubleSided(mapObjects[11], true)
setElementDoubleSided(mapObjects[17], true)
setElementDoubleSided(mapObjects[18], true)
setElementDoubleSided(mapObjects[19], true)
setElementDoubleSided(mapObjects[22], true)
setElementDoubleSided(mapObjects[24], true)
setElementDoubleSided(mapObjects[25], true)
setElementDoubleSided(mapObjects[26], true)
setElementDoubleSided(mapObjects[47], true)
setElementDoubleSided(mapObjects[49], true)
setElementDoubleSided(mapObjects[50], true)
setElementDoubleSided(mapObjects[53], true)
setElementDoubleSided(mapObjects[55], true)
setElementDoubleSided(mapObjects[58], true)
setElementDoubleSided(mapObjects[69], true)
setElementDoubleSided(mapObjects[73], true)
setElementDoubleSided(mapObjects[74], true)
setElementDoubleSided(mapObjects[75], true)
setElementDoubleSided(mapObjects[83], true)
setElementDoubleSided(mapObjects[84], true)
setElementDoubleSided(mapObjects[85], true)
setElementDoubleSided(mapObjects[86], true)
setElementDoubleSided(mapObjects[87], true)
setElementDoubleSided(mapObjects[146], true)
setElementDoubleSided(mapObjects[147], true)
setElementDoubleSided(mapObjects[148], true)
setElementDoubleSided(mapObjects[160], true)
setElementDoubleSided(mapObjects[161], true)
setElementDoubleSided(mapObjects[162], true)
setElementDoubleSided(mapObjects[163], true)
setElementDoubleSided(mapObjects[164], true)
setElementDoubleSided(mapObjects[165], true)
setElementDoubleSided(mapObjects[166], true)
setElementDoubleSided(mapObjects[167], true)
-- Object Scale
---------------->>
setObjectScale(mapObjects[21], 0)
setObjectScale(mapObjects[22], 0)
setObjectScale(mapObjects[23], 1.1000000238419)
setObjectScale(mapObjects[24], 0)
setObjectScale(mapObjects[53], 0)
setObjectScale(mapObjects[54], 0)
setObjectScale(mapObjects[55], 0)
setObjectScale(mapObjects[56], 0)
setObjectScale(mapObjects[57], 0)
setObjectScale(mapObjects[59], 0)
setObjectScale(mapObjects[60], 0)
setObjectScale(mapObjects[61], 0)
setObjectScale(mapObjects[62], 0)
setObjectScale(mapObjects[63], 0)
setObjectScale(mapObjects[64], 0)
setObjectScale(mapObjects[65], 0)
setObjectScale(mapObjects[66], 0)
setObjectScale(mapObjects[67], 0)
setObjectScale(mapObjects[68], 0)
setObjectScale(mapObjects[70], 0)
setObjectScale(mapObjects[71], 0)
setObjectScale(mapObjects[72], 0)
setObjectScale(mapObjects[75], 0)
setObjectScale(mapObjects[81], 0)
setObjectScale(mapObjects[82], 0)
setObjectScale(mapObjects[89], 0)
setObjectScale(mapObjects[90], 0)
setObjectScale(mapObjects[91], 0)
setObjectScale(mapObjects[92], 0)
setObjectScale(mapObjects[93], 0)
setObjectScale(mapObjects[94], 0)
setObjectScale(mapObjects[95], 0)
setObjectScale(mapObjects[96], 0)
setObjectScale(mapObjects[97], 0)
setObjectScale(mapObjects[98], 0)
setObjectScale(mapObjects[99], 0)
setObjectScale(mapObjects[100], 0)
setObjectScale(mapObjects[101], 0)
setObjectScale(mapObjects[102], 0)
setObjectScale(mapObjects[103], 0)
setObjectScale(mapObjects[104], 0)
setObjectScale(mapObjects[105], 0)
setObjectScale(mapObjects[106], 0)
setObjectScale(mapObjects[107], 0)
setObjectScale(mapObjects[108], 0)
setObjectScale(mapObjects[109], 0)
setObjectScale(mapObjects[110], 0)
setObjectScale(mapObjects[111], 0)
setObjectScale(mapObjects[112], 0)
setObjectScale(mapObjects[113], 0)
setObjectScale(mapObjects[114], 0)
setObjectScale(mapObjects[115], 0)
setObjectScale(mapObjects[116], 0)
setObjectScale(mapObjects[117], 0)
setObjectScale(mapObjects[118], 0)
setObjectScale(mapObjects[119], 0)
setObjectScale(mapObjects[120], 0)
setObjectScale(mapObjects[121], 0)
setObjectScale(mapObjects[122], 0)
setObjectScale(mapObjects[123], 0)
setObjectScale(mapObjects[124], 0)
setObjectScale(mapObjects[125], 0)
setObjectScale(mapObjects[126], 0)
setObjectScale(mapObjects[127], 0)
setObjectScale(mapObjects[128], 0)
setObjectScale(mapObjects[129], 0)
setObjectScale(mapObjects[130], 0)
setObjectScale(mapObjects[131], 0)
setObjectScale(mapObjects[132], 0)
setObjectScale(mapObjects[133], 0)
setObjectScale(mapObjects[134], 0)
setObjectScale(mapObjects[135], 0)
setObjectScale(mapObjects[136], 0)
setObjectScale(mapObjects[137], 0)
setObjectScale(mapObjects[138], 0)
setObjectScale(mapObjects[139], 0)
setObjectScale(mapObjects[140], 0)
setObjectScale(mapObjects[141], 0)
setObjectScale(mapObjects[142], 0)
setObjectScale(mapObjects[143], 0)
setObjectScale(mapObjects[144], 0)
setObjectScale(mapObjects[145], 0)
setObjectScale(mapObjects[166], 1.03)
setObjectScale(mapObjects[167], 1.03)
-- Remove World Objects
------------------------>>
removeWorldModel(1345, 3.5106, 171.4453, -93.4453, 1.2734)
removeWorldModel(1345, 3.5106, 196.7109, -121.4063, 1.2734)
removeWorldModel(654, 13.1365, -2312.6563, -885.7344, 7.5547)
removeWorldModel(11012, 58.5888, -2166.867, -236.5078, 40.8672)
removeWorldModel(11270, 58.5888, -2166.867, -236.5078, 40.8672)
removeWorldModel(1523, 3.4588, -2550.562, 194.4383, 6.6375) |
local null_ls = require("null-ls")
local helpers = require("null-ls/helpers")
local methods = require("null-ls/methods")
local function make_tool(overrides)
local function tool(arg)
local defaults = {
name = arg.name,
filetypes = arg.ft,
generator_opts = vim.tbl_extend("keep", arg, overrides.opts),
}
return helpers.make_builtin(vim.tbl_extend("keep", overrides, defaults))
end
return tool
end
local make_formatter = make_tool({
method = methods.internal.FORMATTING,
factory = helpers.formatter_factory,
opts = {
cwd = function()
return vim.fn.expand("%:p:h")
end,
to_stdin = true,
},
})
---@diagnostic disable-next-line: unused-local
local make_linter = make_tool({
method = methods.internal.DIAGNOSTICS_ON_SAVE,
factory = helpers.generator_factory,
opts = {
to_stdin = true,
},
})
local builtins = null_ls.builtins
local actions = builtins.code_actions
local linters = builtins.diagnostics
local act = {
-- Shellcheck
actions.shellcheck,
-- eslint_d
actions.eslint_d,
-- gitsigns.nvim
actions.gitsigns,
}
local format = {
make_formatter({
name = "Black",
command = "black",
args = { "-q", "-" },
ft = { "python" },
}),
make_formatter({
name = "ClangFormat",
command = "clang-format",
args = { "--assume-filename", "$FILENAME" },
ft = { "c", "cpp", "cs" },
}),
make_formatter({
name = "Prettier",
command = "prettier",
args = { "--stdin-filepath", "$FILENAME" },
ft = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml",
},
}),
make_formatter({
name = "Rustfmt",
command = "rustfmt",
ft = { "rust" },
}),
make_formatter({
name = "StyLua",
command = "stylua",
args = { "-s", "-" },
ft = { "lua" },
}),
make_formatter({
name = "brittany",
command = "brittany",
ft = { "haskell" },
}),
make_formatter({
name = "latexindent",
command = "latexindent",
args = { "-g", "/dev/null" },
ft = { "tex" },
}),
make_formatter({
name = "nixpkgs-fmt",
command = "nixpkgs-fmt",
ft = { "nix" },
}),
make_formatter({
name = "shfmt",
command = "shfmt",
args = { "-i", "4", "-ci" },
ft = { "sh" },
}),
}
local lint = {
-- Pylint
linters.pylint.with({
args = { "-j0", "-f", "json", "$FILENAME" },
method = null_ls.methods.DIAGNOSTICS_ON_SAVE,
}),
-- Shellcheck
linters.shellcheck,
-- eslint_d
linters.eslint_d.with({
args = { "-f", "json", "$FILENAME" },
method = null_ls.methods.DIAGNOSTICS_ON_SAVE,
}),
}
local merge = require("init_functions").merge
null_ls.setup({
diagnostics_format = "[#{c}] #{m} (#{s})",
on_attach = function(client, buffer)
require("plugins/init_lsp").on_attach(client, buffer, {
formatting = true,
}).base()
end,
sources = merge({ act, format, lint }),
})
|
-------------------------------------------
--Classes and their stats
-------------------------------------------
Classes = {}
Classes[1] = {
NAME = "Human",
COST = 0,
WEAPON = "human_gun",
DESCRIPTION = "This is the default starting class armed with a glock. Play this class if you plan on saving for a more expensive class such as Ninja or Hitman.",
SPECIALABILITY = "Right click to call hacks!",
SPECIALABILITY_COST = 0,
HEALTH = 100,
SPEED = 250,
MODEL = "models/player/Kleiner.mdl",
JUMPOWER = 200
}
Classes[2] = {
NAME = "Gunner",
COST = 6000,
WEAPON = "gunner_gun",
DESCRIPTION = "This class is armed with a desert eagle, dealing significantly more damage per shot than the Human's pistol. This is a great class if you're just starting off and want to have some extra money in the bank.",
SPECIALABILITY = "Allows you to deflect bullets, consuming \n(amount of damage * 2) energy every time you deflect. \nYour energy does not regenerate, so once depleted, you take bullet damage. \nBullet damage greater than your current energy will deplete it and do full damage. \nSpecial only active while weilding the desert eagle.",
SPECIALABILITY_COST = 30000,
HEALTH = 100,
SPEED = 170,
MODEL = "models/player/Barney.mdl",
JUMPOWER = 200
}
Classes[3] = {
NAME = "Ninja",
COST = 15000,
WEAPON = "ninja_gun",
DESCRIPTION = "This class is armed with a USP, able to jump high, run fast and take no fall damage. Ninja is a great budget option for ball control.",
SPECIALABILITY = "Right click to perform a super jump for 100 energy.",
SPECIALABILITY_COST = 25000,
HEALTH = 80,
SPEED = 300,
MODEL = "models/player/mossman.mdl",
JUMPOWER = 500
}
Classes[4] = {
NAME = "Hitman",
COST = 20000,
WEAPON = "hitman_gun",
DESCRIPTION = "This class is armed with a scout sniper rifle. With only one shot per magazine, you must use precision and accuracy to take down enemies from a distance.",
SPECIALABILITY,
SPECIALABILITY_COST,
HEALTH = 100,
SPEED = 250,
MODEL = "models/player/breen.mdl",
JUMPOWER = 200
}
Classes[5] = {
NAME = "Golem",
COST = 25000,
WEAPON = "golem_gun",
DESCRIPTION = "This is a very tanky class armed with an M249 LMG holding 75 rounds.",
SPECIALABILITY = "Reduce damage you take by 50% for \n4 seconds at the cost of 100 energy.",
SPECIALABILITY_COST = 45000,
HEALTH = 150,
SPEED = 150,
MODEL = "models/player/monk.mdl",
JUMPOWER = 200
}
Classes[6] = {
NAME = "Predator",
COST = 55000,
WEAPON = "pred_gun",
DESCRIPTION = "This class weilds a knife, able to kill any enemy with a backstab, and is able to cloak with right click. This class is best used in bases, whether it be defending your own base, or sneaking into an enemy base.",
SPECIALABILITY,
SPECIALABILITY_COST,
HEALTH = 120,
SPEED = 250,
MODEL = "models/player/gman_high.mdl",
JUMPOWER = 200
}
Classes[7] = {
NAME = "Juggernaught",
COST = 60000,
WEAPON = "jugg_gun",
DESCRIPTION = "This class is the tankiest of them all, weilding an M3 pump shotgun. This defensive class is best used in close quarters, and is great for guarding a base.",
SPECIALABILITY,
SPECIALABILITY_COST,
HEALTH = 200,
SPEED = 150,
MODEL = "models/player/odessa.mdl",
JUMPOWER = 200
}
Classes[8] = {
NAME = "Bomber",
COST = 70000,
WEAPON = "bomber_gun",
DESCRIPTION = "This class uses C4 to blow himself and surrounding enemies up. He is best in close quarters, and also deals significant damage to bases.",
SPECIALABILITY = "Place a destroyable bomb on the ground that \ndetonates after 8 seconds. These small bombs deal heavy damage \nto props. Consumes 100 energy.",
SPECIALABILITY_COST = 40000,
HEALTH = 180,
SPEED = 230,
MODEL = "models/player/Eli.mdl",
JUMPOWER = 200
}
Classes[9] = {
NAME = "Swat",
COST = 50000,
WEAPON = "swat_gun",
DESCRIPTION = "This class is armed with an M4A1, able to deal significant damage at medium distances. This class will generally do well on any map, and is best played offensively.",
SPECIALABILITY = "Your M4A1 can now launch grenades at the cost of 100 energy.",
SPECIALABILITY_COST = 45000,
HEALTH = 100,
SPEED = 230,
MODEL = "models/player/Combine_Super_Soldier.mdl",
JUMPOWER = 200
}
Classes[10] = {
NAME = "Terrorist",
COST = 55000,
WEAPON = "terrorist_gun",
DESCRIPTION = "This class carries an AK47, comparable to Swat's M4A1. In comparison to Swat, this class has slightly more damage, but less accuracy. Terrorist also has slightly more health.",
SPECIALABILITY = "Continue firing after your magazine \nhas emptied at the cost of 20 energy per bullet.",
SPECIALABILITY_COST = 35000,
HEALTH = 120,
SPEED = 220,
MODEL = "models/player/Combine_Soldier_PrisonGuard.mdl",
JUMPOWER = 200
}
Classes[11] = {
NAME = "Sorcerer",
COST = 50000,
WEAPON = "sorcerer_gun",
DESCRIPTION = "This mage type class uses energy to shoot bolts of lightning accurately at long distances. With good aim, this class can be deadly.",
SPECIALABILITY = "Toggles seeking for a target that is 500 units \nor closer, then casting chain lightning dealing 70 damage to \nthe first target hit, and 50% damage to a second target.\nConsumes 100 energy.",
SPECIALABILITY_COST = 50000,
HEALTH = 80,
SPEED = 230,
MODEL = "models/player/soldier_stripped.mdl",
JUMPOWER = 200
}
Classes[12] = {
NAME = "Neo",
COST = 70000,
WEAPON = "neo_gun",
DESCRIPTION = "This class is armed with rapid firing dual elites and the ability to use energy to jump far distances. Gravity is not Neo's friend, so be careful of high falls. This class is best used for ball control.",
SPECIALABILITY,
SPECIALABILITY_COST,
HEALTH = 90,
SPEED = 230,
MODEL = "models/player/charple.mdl",
JUMPOWER = 200
}
Classes[13] = {
NAME = "Assassin",
COST = 60000,
WEAPON = "assassin_gun",
DESCRIPTION = "This class is similar to hitman, but has 3 bullets in his sniper's magazine, and is able to fire rapidly. Assassin is most effective in a high spot, or sniping from a distance.",
SPECIALABILITY = "Enables a second level of zoom on your \nsniper, also allows you to reload twice as fast for 100 energy.",
SPECIALABILITY_COST = 35000,
HEALTH = 100,
SPEED = 170,
MODEL = "models/player/gman_high.mdl",
JUMPOWER = 200
}
Classes[14] = {
NAME = "Advancer",
COST = 45000,
WEAPON = "advancer_gun",
DESCRIPTION = "This class is armed with a slow firing P90 and moves very slowly. Advancer's special ability is a must have, allowing this class to be one of the most agile, and is great for ball control.",
SPECIALABILITY = "While crouched, double tap A or D to launch \nyou in that direction at the cost of 50 energy.",
SPECIALABILITY_COST = 30000,
HEALTH = 120,
SPEED = 120,
MODEL = "models/player/charple.mdl",
JUMPOWER = 200
}
Classes[15] = {
NAME = "RocketMan",
COST = 60000,
WEAPON = "arena_rocket",
DESCRIPTION = "This class uses a rocket launcher, able to deal huge damage with a direct hit. Due to his rockets swaying in the wind, it isn't easy hitting players from a long distance. Bases are bigger though, so Rocketman is great at taking down bases with a barrage of rockets from a distance.",
SPECIALABILITY = "Attach a laser pointer to your rocket launcher \nallowing your next rocket to be laser-guided. Consumes 100 energy.",
SPECIALABILITY_COST = 30000,
HEALTH = 160,
SPEED = 120,
MODEL = "models/player/odessa.mdl",
JUMPOWER = 200
}
Classes[16] = {
NAME = "Grenadier",
COST = 60000,
WEAPON = "grenade_gun",
DESCRIPTION = "This class tosses grenades, able to deal lethal explosive damage in a small area around the grenade. This class is best used in close quarters with multiple targets to toss grenades at.",
SPECIALABILITY = "Throw a grenade with extra velocity \nthat will explode on contact. Consumes 100 energy.",
SPECIALABILITY_COST = 40000,
HEALTH = 80,
SPEED = 120,
MODEL = "models/player/odessa.mdl",
JUMPOWER = 200
}
Classes[17] = {
NAME = "Raider",
COST = 10000,
WEAPON = "raider_gun",
DESCRIPTION = "This class is agile and weilds a MAC-10. Raider is a good budget offensive class.",
SPECIALABILITY = "Increase running speed by 200% \nfor the cost of 25 energy per second.",
SPECIALABILITY_COST = 40000,
HEALTH = 80,
SPEED = 250,
MODEL = "models/player/Group03/male_03.mdl",
JUMPOWER = 200
}
Classes[18] = {
NAME = "Guardian",
COST = 12000,
WEAPON = "guardian_gun",
DESCRIPTION = "This class has a double barrel shotgun and is able to deal devistating damage in close range, but has a slow reload time. This class is a good budget defensive class, and is great for guarding a base.",
SPECIALABILITY,
SPECIALABILITY_COST,
HEALTH = 130,
SPEED = 150,
MODEL = "models/player/police.mdl",
JUMPOWER = 200
}
Classes[19] = {
NAME = "PumpkinMan",
COST = 75000,
WEAPON = "pumpkinman_gun",
DESCRIPTION = "Throw pumpkins that seek for enemys ! If it hits an enemy, you will throw an additional pumpkin for 50 energy.",
SPECIALABILITY = "You laugh out loud at your enemys... \n \n how humiliating ! MUAHAHAHA !",
SPECIALABILITY_COST = 25000,
HEALTH = 60,
SPEED = 200,
MODEL = "models/player/monk.mdl",
JUMPOWER = 200
} |
-- Created by Elfansoer
--[[
Ability checklist (erase if done/checked):
- Scepter Upgrade
- Break behavior
- Linken/Reflect behavior
- Spell Immune/Invulnerable/Invisible behavior
- Illusion behavior
- Stolen behavior
]]
--------------------------------------------------------------------------------
modifier_monkey_king_tree_dance_lua = class({})
--------------------------------------------------------------------------------
-- Classifications
function modifier_monkey_king_tree_dance_lua:IsHidden()
return false
end
function modifier_monkey_king_tree_dance_lua:IsDebuff()
return false
end
function modifier_monkey_king_tree_dance_lua:IsStunDebuff()
return false
end
function modifier_monkey_king_tree_dance_lua:IsPurgable()
return false
end
--------------------------------------------------------------------------------
-- Initializations
function modifier_monkey_king_tree_dance_lua:OnCreated( kv )
-- references
self.perch_height = self:GetAbility():GetSpecialValueFor( "perched_spot_height" )
self.dayvision = self:GetAbility():GetSpecialValueFor( "perched_day_vision" )
self.nightvision = self:GetAbility():GetSpecialValueFor( "perched_night_vision" )
self.stun = self:GetAbility():GetSpecialValueFor( "unperched_stunned_duration" )
-- reference above is fake news
self.perch_height = 256
if not IsServer() then return end
-- get data
self.parent = self:GetParent()
self.tree = EntIndexToHScript( kv.tree )
self.origin = self.tree:GetOrigin()
-- apply still motion
if not self:ApplyHorizontalMotionController() then
self.interrupted = true
self:Destroy()
end
if not self:ApplyVerticalMotionController() then
self.interrupted = true
self:Destroy()
end
-- set spring ability as active
self.spring = self:GetCaster():FindAbilityByName( 'monkey_king_primal_spring_lua' )
if self.spring then
self.spring:SetActivated( true )
end
-- Start interval check for tree cur
self:StartIntervalThink( 0.1 )
self:OnIntervalThink()
-- play effects
local sound_cast = "Hero_MonkeyKing.TreeJump.Tree"
EmitSoundOn( sound_cast, self.parent )
end
function modifier_monkey_king_tree_dance_lua:OnRefresh( kv )
end
function modifier_monkey_king_tree_dance_lua:OnRemoved()
end
function modifier_monkey_king_tree_dance_lua:OnDestroy()
if not IsServer() then return end
-- set spring ability as inactive
if self.spring then
self.spring:SetActivated( false )
end
-- preserve height
local pos = self:GetParent():GetOrigin()
self:GetParent():RemoveHorizontalMotionController( self )
self:GetParent():RemoveVerticalMotionController( self )
-- preserve height
if not self.unperched then
self:GetParent():SetOrigin( pos )
end
end
--------------------------------------------------------------------------------
-- Modifier Effects
function modifier_monkey_king_tree_dance_lua:DeclareFunctions()
local funcs = {
MODIFIER_EVENT_ON_ORDER,
MODIFIER_PROPERTY_FIXED_DAY_VISION,
MODIFIER_PROPERTY_FIXED_NIGHT_VISION,
}
return funcs
end
function modifier_monkey_king_tree_dance_lua:OnOrder( params )
if params.unit~=self.parent then return end
-- right click, switch position
if params.order_type==DOTA_UNIT_ORDER_MOVE_TO_POSITION or
params.order_type==DOTA_UNIT_ORDER_MOVE_TO_TARGET or
params.order_type==DOTA_UNIT_ORDER_ATTACK_TARGET
then
-- dont do anything if on cooldown
if not self:GetAbility():IsCooldownReady() then
local order = {
UnitIndex = self.parent:entindex(),
OrderType = DOTA_UNIT_ORDER_STOP,
}
ExecuteOrderFromTable( order )
return
end
-- don't do anything if casting primal spring
if self.spring and self.spring:IsChanneling() then return end
-- get target
local pos = params.new_pos
if params.target then pos = params.target:GetOrigin() end
local direction = (pos-self.parent:GetOrigin())
direction.z = 0
direction = direction:Normalized()
-- set facing
self.parent:SetForwardVector( direction )
-- jump arc
local arc = self.parent:AddNewModifier(
self.parent, -- player source
self:GetAbility(), -- ability source
"modifier_generic_arc_lua", -- modifier name
{
dir_x = direction.x,
dir_y = direction.y,
distance = 150,
speed = 550,
height = 1,
start_offset = self.perch_height,
fix_end = false,
isForward = true,
} -- kv
)
arc:SetEndCallback(function()
-- find clear space
FindClearSpaceForUnit( self.parent, self.parent:GetOrigin(), true )
end)
-- play effects
self:PlayEffects( arc )
-- self destroy
self:Destroy()
end
end
function modifier_monkey_king_tree_dance_lua:GetFixedDayVision()
return self.dayvision
end
function modifier_monkey_king_tree_dance_lua:GetFixedNightVision()
return self.nightvision
end
--------------------------------------------------------------------------------
-- Status Effects
function modifier_monkey_king_tree_dance_lua:CheckState()
local state = {
-- [MODIFIER_STATE_FLYING] = true,
-- [MODIFIER_STATE_FLYING_FOR_PATHING_PURPOSES_ONLY] = true,
[MODIFIER_STATE_DISARMED] = true,
}
return state
end
--------------------------------------------------------------------------------
-- Interval Effects
function modifier_monkey_king_tree_dance_lua:OnIntervalThink()
-- temp tree
if not self.tree.IsStanding then
if self.tree:IsNull() then
self:Destroy()
end
return
end
-- check if the tree is still standing
if self.tree:IsStanding() then return end
-- destroy modifier and stun
local mod = self.parent:AddNewModifier(
self.parent, -- player source
self:GetAbility(), -- ability source
"modifier_generic_stunned_lua", -- modifier name
{ duration = self.stun } -- kv
)
-- add tag
self.unperched = true
self:Destroy()
end
--------------------------------------------------------------------------------
-- Motion Effects
function modifier_monkey_king_tree_dance_lua:UpdateHorizontalMotion( me, dt )
me:SetOrigin( self.origin )
end
function modifier_monkey_king_tree_dance_lua:UpdateVerticalMotion( me, dt )
-- if temp tree destroyed, destroy
if not self.tree.IsStanding then
if self.tree:IsNull() then
self:Destroy()
end
return
end
local pos = self.tree:GetOrigin()
pos.z = pos.z + self.perch_height
me:SetOrigin( pos )
end
function modifier_monkey_king_tree_dance_lua:OnVerticalMotionInterrupted()
self:Destroy()
end
function modifier_monkey_king_tree_dance_lua:OnHorizontalMotionInterrupted()
self:Destroy()
end
--------------------------------------------------------------------------------
-- Graphics & Animations
function modifier_monkey_king_tree_dance_lua:PlayEffects( modifier )
-- Get Resources
local particle_cast = "particles/units/heroes/hero_monkey_king/monkey_king_jump_trail.vpcf"
-- Create Particle
local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_ABSORIGIN_FOLLOW, self:GetCaster() )
-- buff particle
modifier:AddParticle(
effect_cast,
false, -- bDestroyImmediately
false, -- bStatusEffect
-1, -- iPriority
false, -- bHeroEffect
false -- bOverheadEffect
)
end |
SPRITES = {}
SPRITES.atlas = love.graphics.newImage("res/sprites/atlas.png")
local sw = SPRITES.atlas:getWidth()
local sh = SPRITES.atlas:getHeight()
SPRITES.cell1 = love.graphics.newQuad(1024, 512, 512, 512, sw, sh)
SPRITES.cell2 = love.graphics.newQuad(1024, 1024, 512, 512, sw, sh)
SPRITES.cell3 = love.graphics.newQuad(512, 1024, 512, 512, sw, sh)
SPRITES.cell4 = love.graphics.newQuad(0, 1024, 512, 512, sw, sh)
SPRITES.cell5 = love.graphics.newQuad(512, 512, 512, 512, sw, sh)
SPRITES.exit = love.graphics.newQuad(256, 1536, 256, 256, sw, sh)
SPRITES.goalCell = love.graphics.newQuad(1024, 0, 512, 512, sw, sh)
SPRITES.greyCell = love.graphics.newQuad(0, 512, 512, 512, sw, sh)
SPRITES.music = love.graphics.newQuad(0, 1536, 256, 256, sw, sh)
SPRITES.play = love.graphics.newQuad(512, 0, 512, 512, sw, sh)
SPRITES.restart = love.graphics.newQuad(512, 1536, 256, 256, sw, sh)
SPRITES.border = love.graphics.newQuad(0, 0, 512, 512, sw, sh)
|
-- All Sprites (images)
Sprites = {}
--Sprites.background = love.graphics.newImage()
--Sprites.player_img = love.graphics.newImage("assets/sp.png")
Sprites.coin_image = love.graphics.newImage("assets/coin_item-1.png")
Sprites.player_image = love.graphics.newImage("assets/Spaceship_01_ORANGE.png")
Sprites.enemy_image = love.graphics.newImage("assets/Spaceship_02_RED.png")
Sprites.enemy_fighter_image = love.graphics.newImage("assets/Spaceship_02_RED.png")
Sprites.particle_image = love.graphics.newImage("assets/particle.png")
background = love.graphics.newImage("assets/space.jpg")
-- Font time
Fonts = {}
Fonts.arcade_font = love.graphics.newFont("assets/fonts/ARCADECLASSIC.TTF", 40)
-- Sounds
Sounds = {}
Sounds.hit_1 = love.audio.newSource("assets/sounds/hit_1.wav", "static")
Sounds.hit_2 = love.audio.newSource("assets/sounds/hit_2.wav", "static")
-- Tile Maps
Maps = {}
Maps.test_map = Sti("assets/maps/test_map.lua", {'bump'})
ITEM_PIX_WIDTH = 32 |
-----------------------------------
-- Shining Blade
-- Sword weapon skill
-- Skill Level: 100
-- Deals light elemental damage to enemy. Damage varies with TP.
-- Aligned with the Soil Gorget.
-- Aligned with the Soil Belt.
-- Element: Light
-- Modifiers: STR:40% MND:40%
-- 100%TP 200%TP 300%TP
-- 1.125 2.222 3.523
-----------------------------------
require("scripts/globals/magic")
require("scripts/globals/status")
require("scripts/globals/settings")
require("scripts/globals/weaponskills")
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar)
local params = {}
params.numHits = 1
params.ftp100 = 1 params.ftp200 = 2 params.ftp300 = 2.5
params.str_wsc = 0.2 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.2 params.chr_wsc = 0.0
params.ele = tpz.magic.ele.LIGHT
params.skill = tpz.skill.SWORD
params.includemab = true
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.ftp100 = 1.125 params.ftp200 = 2.222 params.ftp300 = 3.523
params.str_wsc = 0.4 params.mnd_wsc = 0.4
end
local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, params, tp, action, primary)
return tpHits, extraHits, criticalHit, damage
end
|
--[[
CONTENTS_EMPTY = 0
CONTENTS_SOLID = 0x1
CONTENTS_WINDOW = 0x2
CONTENTS_AUX = 0x4
CONTENTS_GRATE = 0x8
CONTENTS_SLIME = 0x10
CONTENTS_WATER = 0x20
CONTENTS_BLOCKLOS = 0x40
CONTENTS_OPAQUE = 0x80
CONTENTS_TESTFOGVOLUME = 0x100
CONTENTS_UNUSED = 0x200
CONTENTS_UNUSED6 = 0x400
CONTENTS_TEAM1 = 0x800
CONTENTS_TEAM2 = 0x1000
CONTENTS_IGNORE_NODRAW_OPAQUE = 0x2000
CONTENTS_MOVEABLE = 0x4000
CONTENTS_AREAPORTAL = 0x8000
CONTENTS_PLAYERCLIP = 0x10000
CONTENTS_MONSTERCLIP = 0x20000
CONTENTS_CURRENT_0 = 0x40000
CONTENTS_CURRENT_90 = 0x80000
CONTENTS_CURRENT_180 = 0x100000
CONTENTS_CURRENT_270 = 0x200000
CONTENTS_CURRENT_UP = 0x400000
CONTENTS_CURRENT_DOWN = 0x800000
CONTENTS_ORIGIN = 0x1000000
CONTENTS_MONSTER = 0x2000000
CONTENTS_DEBRIS = 0x4000000
CONTENTS_DETAIL = 0x8000000
CONTENTS_TRANSLUCENT = 0x10000000
CONTENTS_LADDER = 0x20000000
CONTENTS_HITBOX = 0x40000000
]]--
laserTraceMask = 0x1 + 0x4000 + 0x80 + 0x2000000 --MASK_OPAQUE_AND_NPCS
ptfxTypes = {
--[0] = "particles/portal_laser.vpcf";
--[1] = "particles/portal_laser_redirected.vpcf";
--[2] = "particles/portal_laser_redirected_traced.vpcf";
[0] = "particles/portal_laser_new_hit.vpcf";
[1] = "particles/portal_laser_new_reflhit.vpcf";
[2] = "particles/portal_laser_new_nohit.vpcf"; --parented
}
laserReactables = {
{
condition = function (ent, model, class, laserhitpos)
return class == "prop_physics" and (model == "models/props/reflection_cube.vmdl" or model == "models/props/reflection_cube_rusted.vmdl")
end;
getRedirectionInfo = function(self, ent, laserForward, laserImpact)
return ent:GetOrigin(), ent:GetForwardVector()
end;
redirectLaser = function(self, laserindex, ent, laserForward, laserImpact, ignoredEnts, doDamage)
local origin, forward = self:getRedirectionInfo(ent, laserForward, laserImpact)
return TraceLaser(laserindex + 1, ent:GetOrigin(), ent:GetForwardVector(), ent, ignoredEnts, nil, ent, doDamage)
end;
hasLaserInput = true;
fxtype = 2;
};
{
condition = function (ent, model, class, laserhitpos)
return class == "prop_dynamic" and model == "models/props/reflective_panel.vmdl"
end;
getRedirectionInfo = function(self, ent, laserForward, laserImpact)
local reflectionDirection = ent:GetForwardVector()
local reflectedForward = laserForward - (2 * (laserForward:Dot(reflectionDirection)) * reflectionDirection)
return laserImpact, reflectedForward
end;
redirectLaser = function(self, laserindex, ent, laserForward, laserImpact, ignoredEnts, doDamage)
local origin, forward = self:getRedirectionInfo(ent, laserForward, laserImpact)
return TraceLaser(laserindex + 1, origin, forward, ent, ignoredEnts, nil, nil, doDamage)
end;
dontIgnoreAfterRedirection = true;
hasLaserInput = false;
fxtype = 1;
};
{
condition = function (ent, model, class, laserhitpos)
if class == "prop_dynamic" then
local targetpos
local targetdist
if model == "models/props/laser_catcher.vmdl" then
targetpos = ent:GetOrigin() + ent:GetForwardVector() * 14 - ent:GetUpVector() * 14
targetdist = 14
elseif model == "models/props/laser_catcher_center.vmdl" then
targetpos = ent:GetOrigin() + ent:GetForwardVector() * 14
targetdist = 26
else
return false
end
return (laserhitpos - targetpos):Length() < targetdist
end
return false
end;
hasLaserInput = true;
fxtype = 2;
};
{
condition = function (ent, model, class)
return class == "npc_turret_floor"
end;
hasLaserInput = true;
fxtype = 0;
};
{
condition = function (ent, model, class)
return class == "prop_physics" and model == "models/combine_turrets/floor_turret_dead.vmdl"
end;
hasLaserInput = true;
fxtype = 0;
};
{
condition = function (ent, model, class, laserhitpos)
if PortalManager.BluePortalGroup[1] == nil or PortalManager.OrangePortalGroup[1] == nil then
return false
end
local bluePortal = PortalManager.BluePortalGroup[1]
if bluePortal == nil then
return false
end
local pos = bluePortal:TransformPointWorldToEntity(laserhitpos)
local entMins = pos
local entMaxs = pos
local blueportalBBoxResult = BBoxIntersect( entMins, entMaxs,mins,maxs )
if blueportalBBoxResult then
return true
else
return false
end
end;
getRedirectionInfo = function(self, ent, laserForward, laserImpact)
local orangePortal = PortalManager.BluePortalGroup[1]
local bluePortal = PortalManager.OrangePortalGroup[1]
local orangePortalRelativePosition = orangePortal:TransformPointWorldToEntity(laserImpact)
local orangePortalRelativeDirectionPosition = orangePortal:TransformPointWorldToEntity(laserImpact - laserForward)
local newforward = bluePortal:TransformPointEntityToWorld(orangePortalRelativeDirectionPosition) - bluePortal:TransformPointEntityToWorld(orangePortalRelativePosition)
return bluePortal:TransformPointEntityToWorld(orangePortalRelativePosition), newforward:Normalized()
end;
redirectLaser = function(self, laserindex, ent, laserForward, laserImpact, ignoredEnts, doDamage)
if laserindex > 32 then
return laserindex, {}
end
local origin, forward = self:getRedirectionInfo(ent, laserForward, laserImpact)
return TraceLaser(laserindex + 1, origin, forward, PortalManager.BluePortalGroup[1], ignoredEnts, nil, nil, doDamage)
end;
dontIgnoreAfterRedirection = true;
hasLaserInput = false;
fxtype = 1;
};
{
condition = function (ent, model, class, laserhitpos)
if PortalManager.BluePortalGroup[1] == nil or PortalManager.OrangePortalGroup[1] == nil then
return false
end
local bluePortal = PortalManager.OrangePortalGroup[1]
if bluePortal == nil then
return false
end
local pos = bluePortal:TransformPointWorldToEntity(laserhitpos)
local entMins = pos
local entMaxs = pos
local blueportalBBoxResult = BBoxIntersect( entMins, entMaxs,mins,maxs )
if blueportalBBoxResult then
return true
else
return false
end
end;
getRedirectionInfo = function(self, ent, laserForward, laserImpact)
local orangePortal = PortalManager.OrangePortalGroup[1]
local bluePortal = PortalManager.BluePortalGroup[1]
local orangePortalRelativePosition = orangePortal:TransformPointWorldToEntity(laserImpact)
local orangePortalRelativeDirectionPosition = orangePortal:TransformPointWorldToEntity(laserImpact - laserForward)
local newforward = bluePortal:TransformPointEntityToWorld(orangePortalRelativeDirectionPosition) - bluePortal:TransformPointEntityToWorld(orangePortalRelativePosition)
return bluePortal:TransformPointEntityToWorld(orangePortalRelativePosition), newforward:Normalized()
end;
redirectLaser = function(self, laserindex, ent, laserForward, laserImpact, ignoredEnts, doDamage)
if laserindex > 32 then
return laserindex, {}
end
local origin, forward = self:getRedirectionInfo(ent, laserForward, laserImpact)
return TraceLaser(laserindex + 1, origin, forward, PortalManager.OrangePortalGroup[1], ignoredEnts, nil, nil, doDamage)
end;
dontIgnoreAfterRedirection = true;
hasLaserInput = false;
fxtype = 1;
};
}
function BBoxIntersect(mins1, maxs1, mins2, maxs2)
local intersect = true
for i = 1, 3, 1 do
if mins1[i] > maxs2[i] or maxs1[i] < mins2[i] then
intersect = false
end
end
return intersect
end
local laserPtfxs = {}
local entityInputs = {}
local relays = {}
local restoreListener = nil
function Activate(activateType)
if activateType == 2 then
if restoreListener == nil then
restoreListener = ListenToGameEvent("player_activate", Restore, nil)
end
else
UpdateRelays()
end
end
function Restore()
StopListeningToGameEvent(restoreListener)
thisEntity:SetThink("UpdateRelays", "UpdateRelaysThink", 0.15)
if thisEntity:GetContext("LaserOn") == "on" then
thisEntity:SetThink("LaserThinkFunc", "LaserThink", 0.15)
end
end
function UpdateRelays()
for k,v in pairs(Entities:FindAllByName("laser_relay_point")) do
table.insert(relays, {
pos = (v:GetUpVector() * 19) + v:GetOrigin();
ent = v;
})
end
end
function EnableLaser()
thisEntity:EmitSound("Portal.LaserEmitter.On")
thisEntity:StopSound("Portal.LaserEmitter.Off")
LaserThinkFunc()
thisEntity:SetThink("LaserThinkFunc", "LaserThink", 0.15)
thisEntity:SetContext("LaserOn", "on", 0)
end
function DisableLaser()
thisEntity:EmitSound("Portal.LaserEmitter.Off")
thisEntity:StopSound("Portal.LaserEmitter.On")
thisEntity:StopThink("LaserThink")
ClearEntityInputs()
RemoveLaserPtfxs()
thisEntity:SetContext("LaserOn", "off", 0)
end
function ClearEntityInputs()
for k, v in pairs(entityInputs) do
RemoveLaserInputEntity(k)
end
entityInputs = {}
end
function RemoveLaserPtfxs()
for k, v in pairs(laserPtfxs) do
ParticleManager:DestroyParticle(v.ptfx, false)
ParticleManager:ReleaseParticleIndex(v.ptfx)
laserPtfxs[k] = nil
end
laserPtfxs = {}
end
function SetLaserPtfxContext()
local contextString = ""
for k, v in pairs(laserPtfxs) do
contextString = contextString..tostring(v.ptfx).."a"
end
if contextString ~= "" then
contextString = contextString:sub(0,-2)
end
thisEntity:SetContext("LaserPtfxs", contextString, 0)
end
local laserThinkTickCounter = 0
function LaserThinkFunc()
--[[if laserThinkTickCounter % 7 == 0 then
local lastUsedIndex, newInputs = TraceLaser(1, thisEntity:GetOrigin(), thisEntity:GetForwardVector(), nil, {})
for k, v in pairs(laserPtfxs) do
if k > lastUsedIndex and v ~= nil then
ParticleManager:DestroyParticle(v.ptfx, false)
laserPtfxs[k] = nil
end
end
for k, v in pairs(entityInputs) do
if not newInputs[k] and not k:IsNull() then
RemoveLaserInputEntity(k)
end
end
for k, v in pairs(newInputs) do
if not entityInputs[k] and not k:IsNull() then
AddLaserInputEntity(k)
end
end
entityInputs = newInputs
laserThinkTickCounter = 1
else
laserThinkTickCounter = laserThinkTickCounter + 1
for k, v in pairs(laserPtfxs) do
UpdateLaserPtfx(k)
end
end
return 0.015]]--
local doDamage = false
laserThinkTickCounter = laserThinkTickCounter + 1
if laserThinkTickCounter == 25 then
doDamage = true
laserThinkTickCounter = 0
end
local lastUsedIndex, newInputs = TraceLaser(1, thisEntity:GetOrigin(), thisEntity:GetForwardVector(), nil, {}, nil, nil, doDamage)
for k, v in pairs(laserPtfxs) do
if k > lastUsedIndex and v ~= nil then
ParticleManager:DestroyParticle(v.ptfx, false)
ParticleManager:ReleaseParticleIndex(v.ptfx)
laserPtfxs[k] = nil
end
end
for k, v in pairs(entityInputs) do
if not newInputs[k] and not k:IsNull() then
RemoveLaserInputEntity(k)
end
end
for k, v in pairs(newInputs) do
if not entityInputs[k] and not k:IsNull() then
AddLaserInputEntity(k)
end
end
entityInputs = newInputs
SetLaserPtfxContext()
return 0.015
end
function LaserTraceLine(traceOrigin, forward, selfEnt)
local traceTable =
{
startpos = traceOrigin;
endpos = traceOrigin + forward * 2048;
ignore = selfEnt;
mask = laserTraceMask;
}
TraceLine(traceTable)
return traceTable
end
function TraceLaser(index, origin, forwarddir, selfEnt, ignoredEnts, laserStart, laserEmitterEnt, doDamage)
if laserStart == nil then
laserStart = origin
end
--[[if laserEmitterEnt == nil then
laserEmitterEnt = selfEnt
end]]
local traceTable = LaserTraceLine(origin, forwarddir, selfEnt)
local returnval = index
local returntable = {}
local endPos = traceTable.endpos
--DebugDrawSphere(endPos, Vector(0,0,255), 255, 8, false, 0.333)
local endtarget = nil
local endentity = nil
local endtraced = true
local fxtype = 0
local normal = forwarddir * -1
if traceTable.hit then
normal = traceTable.normal
endPos = traceTable.pos
--DebugDrawLine(origin, traceTable.pos, 255, 0, 0, false, 0.15)
local ent = traceTable.enthit
if ent ~= nil then
local model = ent:GetModelName()
local class = ent:GetClassname()
local reactableInfo = nil
for k,v in pairs(laserReactables) do
if v.condition(ent,model,class,endPos) then
reactableInfo = v
break
end
end
if reactableInfo == nil then
if doDamage and (ent:IsNPC() or ent:IsPlayer()) then
ent:TakeDamage(CreateDamageInfo(thisEntity, thisEntity, Vector(0,0,0), traceTable.pos, 7, 0))
end
else
if reactableInfo.redirectLaser then
if not ignoredEnts[ent] or reactableInfo.dontIgnoreAfterRedirection then
ignoredEnts[ent] = true
returnval, returntable = reactableInfo:redirectLaser(index, ent, forwarddir, endPos, ignoredEnts, doDamage)
end
end
if reactableInfo.hasLaserInput then
returntable[ent] = true
end
fxtype = reactableInfo.fxtype
end
end
end
for k, v in pairs(relays) do
if not returntable[v.ent] then
--DebugDrawSphere(v.pos, Vector(255,255,0), 255, 14, false, 0.015 * 3)
if (v.pos - LineClosestPointToPoint(origin, endPos, v.pos)):Length() < 14 then
returntable[v.ent] = true
end
end
end
SetLaserPtfx(index, laserStart, tracepos, forwarddir, laserEmitterEnt, endPos, normal, fxtype)
return returnval, returntable
end
function AddLaserInputEntity(ent)
if entityInputs[ent] then return end
--entityInputs[ent] = true
if ent ~= nil then
ent:GetOrCreatePrivateScriptScope():AddLaserInput()
end
end
function RemoveLaserInputEntity(ent)
if not entityInputs[ent] then return end
--entityInputs[ent] = false
if ent ~= nil then
ent:GetOrCreatePrivateScriptScope():RemoveLaserInput()
end
end
function UpdateLaserPtfx(index)
local data = laserPtfxs[index]
local traceTable
if data.parent then
data.pos = data.parent:GetOrigin()
data.forward = data.parent:GetForwardVector()
end
traceTable = LaserTraceLine(data.pos, data.forward, data.parent)
if traceTable.hit then
data.endpos = traceTable.pos
data.normal = traceTable.normal
else
data.endpos = traceTable.endpos
data.normal = data.forward * -1
end
laserPtfxs[index] = data
--local newForward = (traceTable.endpos - traceTable.startpos):Normalized()
--DebugDrawLine(data.pos, data.endpos, 255, 0, 0, false, 0.03)
--DebugDrawSphere(data.pos, Vector(255,0,0), 255, 8, false, 0.03)
--DebugDrawSphere(data.endpos, Vector(255,255,0), 255, 8, false, 0.03)
SetLaserPtfxControlPoints(data)
--DebugDrawSphere(LineClosestPointToPoint(data.pos, data.endpos, Entities:GetLocalPlayer():GetOrigin()), Vector(0,0,255), 255, 16, false, 0.03)
end
function SetLaserPtfxControlPoints(ptfxData)
if ptfxData.parent then
ParticleManager:SetParticleControlEnt(ptfxData.ptfx, 1, ptfxData.parent, 1, nil, Vector(0,0,0), true)
else
ParticleManager:SetParticleControl(ptfxData.ptfx, 1, ptfxData.pos)
ParticleManager:SetParticleControlForward(ptfxData.ptfx, 1, ptfxData.forward)
end
ParticleManager:SetParticleControl(ptfxData.ptfx, 3, ptfxData.endpos)
ParticleManager:SetParticleControlForward(ptfxData.ptfx, 3, ptfxData.normal)
end
function SetLaserPtfx(index, pos, tracepos, forward, parent, endpos, normal, ptfxtype)
local fx = laserPtfxs[index]
local rerouted = endtarget ~= nil
if fx == nil or fx.fxtype ~= ptfxtype or fx.parent ~= parent then
if fx ~= nil then
ParticleManager:DestroyParticle(fx.ptfx, false)
ParticleManager:ReleaseParticleIndex(fx.ptfx)
end
local fxName = ptfxTypes[ptfxtype]
fx = {
ptfx = ParticleManager:CreateParticle(fxName, 1, parent or Entities:GetLocalPlayer());
fxtype = ptfxtype;
}
end
fx.pos = pos
fx.forward = forward
fx.parent = parent
fx.tracepos = tracepos
fx.endpos = endpos
fx.normal = normal
laserPtfxs[index] = fx
--DebugDrawLine(fx.pos, fx.endpos, 0, 255, 0, false, 0.03)
--DebugDrawSphere(fx.pos, Vector(255,0,0), 255, 8, false, 0.03)
--DebugDrawSphere(fx.endpos, Vector(255,255,0), 255, 8, false, 0.03)
SetLaserPtfxControlPoints(fx)
--DebugDrawSphere(LineClosestPointToPoint(fx.pos, fx.endpos, Entities:GetLocalPlayer():GetOrigin()), Vector(0,0,255), 255, 16, false, 0.03)
end
function LineClosestPointToPoint(linestart, lineend, point)
local d = (lineend - linestart):Normalized()
local point = linestart + (d * (point - linestart):Dot(d))
local tV = (point - linestart) / (lineend - linestart)
local t
if tV.x == tV.x and math.floor(linestart.x * 100 + 0.5) ~= math.floor(lineend.x * 100 + 0.5) then
t = tV.x
elseif tV.y == tV.y and math.floor(linestart.y * 100 + 0.5) ~= math.floor(lineend.y * 100 + 0.5) then
t = tV.y
elseif tV.z == tV.z then
t = tV.z
else
return linestart
end
if t > 1 then
return lineend
elseif t < 0 then
return linestart
else
return point
end
end |
request = function()
param_value = math.random(1,10000)
path = "/diamond-server/publishConfig?dataId=linname" .. param_value .. "&group=DEFAULT_GROUP" .. param_value .. "&content=wrkpublish" .. param_value
return wrk.format("POST", path)
end |
local chopshop = {}
local myChop = 0
chopshop["x"] = 0
chopshop["y"] = 0
chopshop["z"] = 0
local locationset = false
local plateshop = {}
plateshop["x"] = 0
plateshop["y"] = 0
plateshop["z"] = 0
local lockedplates = {}
local chopshopowner = 9999999
local randstrng = {
[1] = "Just got another hot vehicle, taking it to the garage near ",
[2] = "Bringing the stolen car to ",
[3] = "We just moved the shop, anyone listening its near ",
[4] = "Cops got close, we moved the shop to ",
[5] = "We need cars delivered to "
}
local randstrng2 = {
[1] = "Got some tools, taking it to the garage near ",
[2] = "Bringing the parts to ",
[3] = "We just moved the parts shop, anyone listening its near ",
[4] = "Cops got close, we moved the parts shop to ",
[5] = "We need parts delivered to "
}
local values = {
[1] = { ["text"] = "Engine Parts", ["factor"] = "fInitialDriveMaxFlatVel", ["min"] = 0, ["max"] = 400, ["sales"] = 0, ["item"] = 'EnginePart' },
[2] = { ["text"] = "Suspension Parts", ["factor"] = "fSuspensionForce", ["min"] = 0, ["max"] = 5, ["sales"] = 0, ["item"] = 'SuspensionPart' },
[3] = { ["text"] = "Dampener Parts", ["factor"] = "fSuspensionCompDamp", ["min"] = 0, ["max"] = 2, ["sales"] = 0, ["item"] = 'DampenerPart' },
[4] = { ["text"] = "Tyre Parts", ["factor"] = "fSteeringLock", ["min"] = 18, ["max"] = 40, ["sales"] = 0, ["item"] = 'TyrePart' },
[5] = { ["text"] = "Metal Parts", ["factor"] = "fMass", ["min"] = 0, ["max"] = 3300, ["sales"] = 0 , ["item"] = 'MetalPart' },
[6] = { ["text"] = "Aerodynamics", ["factor"] = "fDownforceModifier", ["min"] = 0, ["max"] = 2, ["sales"] = 0, ["item"] = 'AerodynamicsPart' },
[7] = { ["text"] = "Braking Parts", ["factor"] = "fBrakeForce", ["min"] = 0, ["max"] = 1, ["sales"] = 0, ["item"] = 'BrakingPart' },
[8] = { ["text"] = "Gearbox Parts", ["factor"] = "fClutchChangeRateScaleUpShift", ["min"] = 0, ["max"] = 7, ["sales"] = 0, ["item"] = 'GearboxPart' },
}
local partCoords = {
[1] = { ["x"] = 962.96600341797, ["y"] = -2992.7954101563, ["z"] = -39.646957397461 },
[2] = { ["x"] = 959.38641357422, ["y"] = -2991.6372070313, ["z"] = -39.646957397461 },
[3] = { ["x"] = 959.38641357422, ["y"] = -2991.6372070313, ["z"] = -39.646957397461 },
[4] = { ["x"] = 954.32318115234, ["y"] = -3005.0522460938, ["z"] = -39.646957397461 },
[5] = { ["x"] = 986.08941650391, ["y"] = -2990.4270019531, ["z"] = -39.646957397461 },
[6] = { ["x"] = 1009.0650024414, ["y"] = -3012.1428222656, ["z"] = -39.646942138672 },
[7] = { ["x"] = 986.30316162109, ["y"] = -3015.3999023438, ["z"] = -39.646953582764 },
[8] = { ["x"] = 977.38861083984, ["y"] = -2988.9206542969, ["z"] = -39.646953582764 }
}
blipparts = 0
blipchop = 0
local streetnamesentc = "none"
local streetnamesentp = "none"
RegisterNetEvent("chopshop:updatePlateLocation")
AddEventHandler("chopshop:updatePlateLocation", function(x,y,z)
local rank = GroupRank("parts_shop")
if rank > 1 then
RemoveBlip(blipparts)
blipparts = AddBlipForCoord(x, y, z)
SetBlipSprite(blipparts, 52)
SetBlipScale(blipparts, 0.7)
SetBlipColour(blipparts, 14)
SetBlipAsShortRange(blipparts, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Parts Shop")
EndTextCommandSetBlipName(blipparts)
local dist = #(vector3(x,y,z) - GetEntityCoords(PlayerPedId()))
if dist > 2000.0 then
return
end
plateshop["x"],plateshop["y"],plateshop["z"] = x,y,z
local streetnamesentPP = GetStreetNameAtCoord(plateshop["x"],plateshop["y"],plateshop["z"])
streetnamesentPP = GetStreetNameFromHashKey(streetnamesentPP)
locationset = true
local radiocount = exports["npc-inventory"]:getQuantity("scanner")
if radiocount > 0 and streetnamesentp ~= streetnamesentPP then
streetnamesentp = streetnamesentPP
TriggerEvent("chatMessage", "SCANNER : ", {255, 0, 0}, randstrng2[math.random(#randstrng2)] .. "" .. streetnamesentp)
end
end
end)
local toupdateValues = {}
RegisterNetEvent("chopshop:owner")
AddEventHandler("chopshop:owner", function(newowner)
end)
function GroupRank(groupid)
local rank = 0
local mypasses = exports["isPed"]:isPed("passes")
for i=1, #mypasses do
if mypasses[i]["pass_type"] == groupid then
rank = mypasses[i]["rank"]
end
end
return rank
end
RegisterNetEvent("chopshop:updateLocation")
AddEventHandler("chopshop:updateLocation", function(x,y,z,valuesSent,cidowner)
local cid = exports["isPed"]:isPed("cid")
local rank = GroupRank("chop_shop")
if tonumber(rank) > 1 then
RemoveBlip(blipchop)
blipchop = AddBlipForCoord(x, y, z)
SetBlipSprite(blipchop, 52)
SetBlipScale(blipchop, 0.7)
SetBlipColour(blipchop, 14)
SetBlipAsShortRange(blipchop, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Chop Shop")
EndTextCommandSetBlipName(blipchop)
local dist = #(vector3(x,y,z) - GetEntityCoords(PlayerPedId()))
if dist > 2000.0 then
return
end
chopshop["x"],chopshop["y"],chopshop["z"] = x,y,z
locationset = true
values = valuesSent
end
end)
RegisterNetEvent("chopshop:currentValues")
AddEventHandler("chopshop:currentValues", function()
for i = 1, #values do
local stockvalue = 100 - values[i]["sales"]
local str = values[i]["text"] .. " stock drive " .. stockvalue .. "%"
TriggerEvent("DoLongHudText",str,i)
end
end)
RegisterNetEvent("chopshop:valueVehicle")
AddEventHandler("chopshop:valueVehicle", function()
valueVehicle()
end)
function valueVehicle()
local iAmHorrible = {}
local totalValue = 0
for i = 1, #values do
local factor = values[i]["factor"]
local text = values[i]["text"]
local sales = values[i]["sales"]
local min = values[i]["min"]
local max = values[i]["max"]
local value = GetVehicleHandlingFloat(myChop, 'CHandlingData', factor)
if value > max then
value = max
end
value = ((value / max) * 400)
value = math.ceil(value)
Citizen.Trace(factor .. " = " .. value .. " - " .. sales)
toupdateValues[i] = { ["value"] = math.ceil(value), ["factor"] = factor, ["sales"] = sales }
value = value - sales
value = value / 2.5
if value > 1000 then
value = 1000
end
totalValue = math.ceil(totalValue + value)
TriggerEvent("DoLongHudText", text .. " valued at $" .. value,1 )
end
TriggerServerEvent("server:GroupPayment","chop_shop",totalValue)
TriggerEvent("DoLongHudText", "Total Parts Value: " .. totalValue,1 )
deductValuesTotal(toupdateValues,totalValue)
end
function getKeysSortedByValue(tbl, sortFunction)
local keys = {}
for key in pairs(tbl) do
keys[#keys+1]= key
end
table.sort(keys, function(a, b)
return sortFunction(tbl[a], tbl[b])
end)
local penis = -4
for _, key in ipairs(keys) do
Citizen.Trace(key)
local cocks = values[key]["sales"]
values[key]["sales"] = cocks + penis
Citizen.Trace(values[key]["factor"] .. " new value is now " .. values[key]["sales"])
penis = penis + 1
if penis == 0 then
penis = 1
end
end
return values
end
function chopDeliveryAvailable()
local activeTasks = exports["isPed"]:isPed("tasks")
local taskavailable = false
for i = 1, #activeTasks do
if activeTasks[i] ~= nil then
if activeTasks[i]["Group"] == "chop_shop" and (activeTasks[i]["TaskState"] == 1 or activeTasks[i]["TaskState"] == 2) then
taskavailable = true
end
end
end
return taskavailable
end
function deductValuesTotal(toupdateValues,totalValue)
local newvalues = getKeysSortedByValue(toupdateValues, function(a, b) return a["value"] < b["value"] end)
TriggerServerEvent("chop:ServerCompleteCar",newvalues,totalValue)
end
function DrawText3DTest(x,y,z, text, dicks,power)
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
if onScreen then
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text)) / 370
DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 41, 11, 41, 68)
end
end
taskNumber = 1
inprocess = false
carrying = false
local zz = false
local hotPlates = {}
local hotPlatesReason = {}
RegisterNetEvent("updateHotPlates")
AddEventHandler("updateHotPlates", function(newPlates,newReasons)
hotPlates = newPlates
hotPlatesReason = newReasons
end)
RegisterNetEvent("updateHotPlatesSingle")
AddEventHandler("updateHotPlatesSingle", function(newPlate,newReason)
hotPlates[#hotPlates+1] = newPlate
hotPlatesReason[#hotPlatesReason+1] = newReason
end)
function isHotVehicle(plate)
if hotPlates[string.upper(plate)] ~= nil or hotPlates[string.lower(plate)] ~= nil or hotPlates[plate] ~= nil then
return true
else
return false
end
end
RegisterNetEvent("chopshop:taskItem")
AddEventHandler("chopshop:taskItem", function(z)
zz = z
Citizen.Trace("doing item stuffs heh")
if zz then
RequestAnimDict('anim@heists@box_carry@')
while not HasAnimDictLoaded("anim@heists@box_carry@") do
Citizen.Wait(0)
end
TriggerEvent("attachItemChop",values[taskNumber]["item"])
while zz do
Citizen.Wait(1)
if not IsEntityPlayingAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 3) then
TaskPlayAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
end
else
TriggerEvent("attachRemoveChopShop")
Citizen.Wait(100)
ClearPedTasksImmediately(PlayerPedId())
end
end)
local front = 0
local back = 0
Citizen.CreateThread(function()
--SetEntityCoords(PlayerPedId(),976.81365966797,-3001.3740234375,-39.603717803955)
while true do
Wait(1)
local pos = GetEntityCoords( PlayerPedId() )
if #(vector3(194.74269104004,-1005.3385620117,-98.999961853027) - pos) < 1 then
TriggerEvent("DoShortHudText", "Please Move.",2)
Citizen.Wait(2000)
end
if locationset then
local playerPed = PlayerPedId()
local currentVehicle = GetVehiclePedIsIn(playerPed, false)
local driverPed = GetPedInVehicleSeat(currentVehicle, -1)
local pos = GetEntityCoords( PlayerPedId() )
local posChop = GetEntityCoords( myChop )
local pltcheck = "none"
if taskNumber < 9 and myChop ~= 0 and #(vector3(976.81365966797,-3001.3740234375,-39.603717803955) - pos) < 100.0 then
if not IsPedInVehicle(PlayerPedId(),currentVehicle,false) then
local postup = GetOffsetFromEntityInWorldCoords(myChop, 0.0, 2.5, 0.0)
local postback = GetOffsetFromEntityInWorldCoords(myChop, 0.0, -2.5, 0.0)
local distance = #(postup - pos)
local distanceb = #(postback - pos)
local carDir = GetEntityHeading(myChop)
local myDir = GetEntityHeading(PlayerPedId())
if distance < 1.5 and not inprocess and front == 0 then
if isOppositeDir(carDir,myDir) then
DrawText3DTest(postup["x"],postup["y"],postup["z"], "Press E to remove " .. values[taskNumber]["text"], 255,true)
if IsControlJustReleased(2, 38) then
inprocess = true
playDrill()
Citizen.Wait(200)
end
else
DrawText3DTest(postup["x"],postup["y"],postup["z"], "Face the vehicle to work on it.", 255,true)
end
else
if distance < 5.5 and not inprocess then
DrawText3DTest(postup["x"],postup["y"],postup["z"], "Move to the vehicle to work on it.", 255,true)
end
end
local distance = #(vector3(partCoords[taskNumber]["x"], partCoords[taskNumber]["y"], partCoords[taskNumber]["z"]) - pos)
if inprocess and distance < 55.0 then
-- search and draw task location
DrawText3DTest(partCoords[taskNumber]["x"], partCoords[taskNumber]["y"], partCoords[taskNumber]["z"], "Press E to place your " .. values[taskNumber]["text"], 255,true)
if IsControlJustReleased(2, 38) and distance < 5.0 then
inprocess = false
TriggerEvent("chopshop:taskItem",false)
taskNumber = taskNumber + 1
if taskNumber > 8 then
valueVehicle()
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(myChop))
DeleteVehicle(myChop)
SetEntityCoords(myChop,0.0,0.0,-90.0)
end
Citizen.Wait(200)
end
end
end
end
if IsPedInVehicle(PlayerPedId(),currentVehicle,false) and ( IsThisModelABike( GetEntityModel(currentVehicle) ) or IsThisModelACar( GetEntityModel(currentVehicle) ) ) then
if #(vector3(chopshop["x"],chopshop["y"],chopshop["z"]) - pos) < 12 and locationset and playerPed == driverPed then
local distance = #(vector3(chopshop["x"],chopshop["y"],chopshop["z"]) - pos)
DrawMarker(27,chopshop["x"],chopshop["y"],chopshop["z"],0,0,0,0,0,0,3.001,3.0001,0.9001,0,155,255,50,0,0,0,0)
pltcheck = GetVehicleNumberPlateText(currentVehicle)
local hotVehicle = isHotVehicle(pltcheck)
local selfstolen = false
if lockedplates["plt"..pltcheck] ~= nil then
selfstolen = true
end
if hotVehicle or selfstolen then
if selfstolen then
DrawText3DTest(chopshop["x"],chopshop["y"],chopshop["z"], "We wont take this vehicle, your prints are on it!", 255,true)
else
DrawText3DTest(chopshop["x"],chopshop["y"],chopshop["z"], "That vehicle is too hot, get out of here!", 255,true)
end
else
local cid = exports["isPed"]:isPed("cid")
local rank = GroupRank("chop_shop")
if chopshopowner == 99999 then
DrawText3DTest(chopshop["x"],chopshop["y"],chopshop["z"], "Press E to claim the Chopshop", 255,true)
elseif chopshopowner == cid or rank > 0 then
DrawText3DTest(chopshop["x"],chopshop["y"],chopshop["z"], "Press E to enter the Chopshop", 255,true)
end
if IsControlJustReleased(2, 38) and #(vector3(chopshop["x"],chopshop["y"],chopshop["z"]) - GetEntityCoords(PlayerPedId())) < 5 then
local caisseo = GetClosestVehicle(976.81365966797,-3001.3740234375,-39.603717803955, 4.000, 0, 70)
if DoesEntityExist(caisseo) then
TriggerEvent("DoLongHudText", "They're busy!",2 )
Citizen.Wait(2000)
else
if chopshopowner == 99999 then
TriggerServerEvent("request:chopshop",cid)
elseif rank > 0 then
SetEntityCoords(currentVehicle,976.81365966797,-3001.3740234375,-39.603717803955)
if not chopDeliveryAvailable() then
myChop = currentVehicle
else
TriggerEvent("DoLongHudText","We cant do this vehicle, there is parts needing delivery.",2)
end
Citizen.Wait(2000)
else
SetEntityCoords(currentVehicle,976.81365966797,-3001.3740234375,-39.603717803955)
Citizen.Wait(2000)
end
end
end
end
end
if #(vector3(plateshop["x"],plateshop["y"],plateshop["z"]) - pos) < 12 and locationset and playerPed == driverPed then
local distance = #(vector3(plateshop["x"],plateshop["y"],plateshop["z"]) - pos)
DrawMarker(27,plateshop["x"],plateshop["y"],plateshop["z"]-1,0,0,0,0,0,0,3.001,3.0001,0.9001,0,155,255,50,0,0,0,0)
if hotVehicle then
local rank = GroupRank("parts_shop")
if rank > 0 then
DrawText3DTest(plateshop["x"],plateshop["y"],plateshop["z"], "That vehicle is too hot, get out of here!", 255,true)
end
else
front = 0
back = 0
local rank = GroupRank("parts_shop")
if rank > 0 then
DrawText3DTest(plateshop["x"],plateshop["y"],plateshop["z"], "Press E to enter the Parts Shop", 255,true)
end
if IsControlJustReleased(2, 38) and #(vector3(plateshop["x"],plateshop["y"],plateshop["z"]) - GetEntityCoords(PlayerPedId())) < 5 then
local caisseo = GetClosestVehicle(194.74269104004,-1005.3385620117,-98.999961853027, 4.000, 0, 70)
if DoesEntityExist(caisseo) then
TriggerEvent("DoLongHudText", "They're busy!",2 )
Citizen.Wait(2000)
else
SetEntityCoords(currentVehicle,194.74269104004,-1005.3385620117,-98.999961853027)
myChop = currentVehicle
TriggerEvent("DoLongHudText", "Move your car.",2 )
Citizen.Wait(2000)
end
end
end
end
end
-- if #(vector3(204.9,-995.11,-98.99) - pos) < 10 then
-- local rank = GroupRank("parts_shop")
-- if rank > 0 then
-- DrawText3DTest(204.9,-995.11,-98.99, "Press H to craft", 255,true)
-- if(IsControlJustPressed(1,74)) then
-- TriggerEvent("CraftOpen")
-- end
-- end
-- end
if #(vector3(964.42156982422,-3003.5859375,-39.639896392822) - pos) < 5 then
local distance = #(vector3(964.42156982422,-3003.5859375,-39.639896392822) - pos)
DrawText3DTest(964.42156982422,-3003.5859375,-39.639896392822, "Press E to view City Stock Values", 255,true)
DrawMarker(27,964.42156982422,-3003.5859375,-40.539896392822,0,0,0,0,0,0,1.001,1.0001,0.9001,50,115,155,50,0,0,0,0)
if IsControlJustReleased(2, 38) and #(vector3(964.42156982422,-3003.5859375,-39.639896392822) - pos) < 3 then
TriggerEvent("chopshop:currentValues")
Citizen.Wait(8000)
end
end
if #(vector3(970.81,-2989.2,-39.64) - pos) < 5 then
local distance = #(vector3(970.81,-2989.2,-39.64) - pos)
DrawText3DTest(970.81,-2989.2,-39.64, "Press E to leave", 255,true)
DrawMarker(27,970.81,-2989.2,-39.64,0,0,0,0,0,0,1.001,1.0001,0.9001,50,115,155,50,0,0,0,0)
if IsControlJustReleased(2, 38) and #(vector3(970.81,-2989.2,-39.64) - pos) < 3 then
if IsPedInVehicle(PlayerPedId(),currentVehicle,false) then
SetEntityCoords(currentVehicle,chopshop["x"],chopshop["y"],chopshop["z"])
else
SetEntityCoords(PlayerPedId(),chopshop["x"],chopshop["y"],chopshop["z"])
end
endVars()
Citizen.Wait(2000)
end
end
if #(vector3(201.28433227539,-1004.8858032227,-98.999961853027) - pos) < 5 then
local distance = #(vector3(201.28433227539,-1004.8858032227,-98.999961853027) - pos)
DrawText3DTest(201.28433227539,-1004.8858032227,-98.999961853027, "Press E to leave", 255,true)
DrawMarker(27,201.28433227539,-1004.8858032227,-98.999961853027,0,0,0,0,0,0,1.001,1.0001,0.9001,50,115,155,50,0,0,0,0)
if IsControlJustReleased(2, 38) and #(vector3(201.28433227539,-1004.8858032227,-98.999961853027) - pos) < 3 then
if IsPedInVehicle(PlayerPedId(),currentVehicle,false) then
SetEntityCoords(currentVehicle,plateshop["x"],plateshop["y"],plateshop["z"])
else
SetEntityCoords(PlayerPedId(),plateshop["x"],plateshop["y"],plateshop["z"])
end
endVars()
Citizen.Wait(2000)
end
end
else
Wait(10000)
end
end
end)
RegisterNetEvent("chopshop:requestpassupdate")
AddEventHandler("chopshop:requestpassupdate", function()
local rank = GroupRank("chop_shop")
if rank > 0 then
TriggerServerEvent("updatePasses")
end
end)
RegisterNetEvent("partshop:requestpassupdate")
AddEventHandler("partshop:requestpassupdate", function()
local rank = GroupRank("parts_shop")
if rank > 0 then
TriggerServerEvent("updatePasses")
end
end)
RegisterNetEvent("chop:plateoff")
AddEventHandler("chop:plateoff", function(newplate)
if lockedplates["plt"..newplate] == nil then
lockedplates["plt"..newplate] = true
end
end)
RegisterNetEvent("chopshop:closed")
AddEventHandler("chopshop:closed", function()
local pos = GetEntityCoords( PlayerPedId() )
if #(vector3(976.81365966797,-3001.3740234375,-39.603717803955) - pos) < 70 then
TriggerEvent("DoLongHudText","Chop Shop is shut, its too hot here - check your radio shortly.")
TaskLeaveVehicle(PlayerPedId(), myChop, 0)
Citizen.Wait(10)
Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(myChop))
DeleteVehicle(myChop)
SetEntityCoords(myChop,0.0,0.0,-90.0)
SetEntityCoords(PlayerPedId(),chopshop["x"],chopshop["y"],chopshop["z"])
endVars()
end
end)
function endVars()
taskNumber = 1
inprocess = false
carrying = false
zz = false
myChop = 0
back = 0
front = 0
end
function animCar()
RequestAnimDict('mp_car_bomb')
while not HasAnimDictLoaded("mp_car_bomb") do
Citizen.Wait(0)
end
if not IsEntityPlayingAnim(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic", 3) then
TaskPlayAnim(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
Citizen.Wait(2200)
ClearPedTasks(PlayerPedId())
end
function playDrill2()
FreezeEntityPosition(PlayerPedId(), true)
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
front = math.random(11111111,99999999)
FreezeEntityPosition(PlayerPedId(), false)
end
function playDrill3()
FreezeEntityPosition(PlayerPedId(), true)
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
back = front
FreezeEntityPosition(PlayerPedId(), false)
SetVehicleNumberPlateText(myChop, back)
TriggerEvent("keys:addNew",myChop,back)
end
function playDrill()
FreezeEntityPosition(PlayerPedId(),true)
animCar()
for i = 1, 6 do
SetVehicleDoorOpen(myChop, i, 0, 0)
end
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCar()
animCar()
TriggerEvent("chopshop:taskItem",true)
FreezeEntityPosition(PlayerPedId(),false)
end
function isOppositeDir(a,b)
local result = 0
if a < 90 then
a = 360 + a
end
if b < 90 then
b = 360 + b
end
if a > b then
result = a - b
else
result = b - a
end
if result > 110 then
return true
else
return false
end
end |
local lm = require "luamake"
--the generated file must store into different directory
local defined = require "compile.luajit.defined"
local arch = defined.arch
local LUAJIT_ENABLE_LUA52COMPAT = defined.LUAJIT_ENABLE_LUA52COMPAT
local LUAJIT_NUMMODE = defined.LUAJIT_NUMMODE
local luajitDir = defined.luajitDir
local LUAJIT_TARGET = string.format("LUAJIT_TARGET=LUAJIT_ARCH_%s", string.upper(arch))
local LJ_ARCH_HASFPU = "LJ_ARCH_HASFPU=1"
local LJ_ABI_SOFTFP = "LJ_ABI_SOFTFP=0"
lm:executable("minilua") {
rootdir = luajitDir,
defines = {
LUAJIT_TARGET,
LJ_ARCH_HASFPU,
LJ_ABI_SOFTFP,
LUAJIT_ENABLE_LUA52COMPAT,
LUAJIT_NUMMODE
},
sources = { "host/minilua.c" },
links = { "m" }
}
local arch_flags = {
"-D", "ENDIAN_LE",
"-D", "P64",
"-D", "JIT",
"-D", "FFI",
"-D", "FPU",
"-D", "HFABI",
"-D", "VER=80",
"-D", "DUALNUM"
}
lm:build("builvm_arch.h") {
deps = "minilua",
lm.bindir .. "/minilua",
luajitDir .. "/../dynasm/dynasm.lua",
arch_flags,
"-o", "$out", "$in",
input = luajitDir .. string.format("/vm_%s.dasc", arch),
output = lm.bindir .. "/buildvm_arch.h"
}
lm:executable("buildvm") {
rootdir = luajitDir,
deps = "builvm_arch.h",
objdeps = { lm.bindir .. "/buildvm_arch.h" },
defines = {
LUAJIT_TARGET,
LJ_ARCH_HASFPU,
LJ_ABI_SOFTFP,
LUAJIT_ENABLE_LUA52COMPAT,
LUAJIT_NUMMODE
},
sources = {
"host/*.c",
"!host/minilua.c"
},
includes = {
".",
"../../../../" .. lm.bindir
}
} |
--[[
TODO:
* Require module from client once required from server.
--]] |
------------------------------------------------------------
------------------------ yrp_drugs -------------------------
------------------------------------------------------------
--------------------- Created by Flap ----------------------
------------------------------------------------------------
----------------- YourRolePlay Development -----------------
---------- Thank you for using this drugs system -----------
----- Regular updates and lots of interesting scripts ------
--------- discord -> https://discord.gg/hqZEXc8FSE ---------
------------------------------------------------------------
Config = {}
Config.Locale = 'en'
Config.Zones = {
DrugsCraft = {x = 3369.95, y = 5490.37, z= 22.32},
DrugsCraft2 = {x = -486.07, y = 1580.23, z= 371.05},
DrugsCraft3 = {x = 2864.71, y = 1629.15, z= 22.98},
DrugsCraft4 = {x = -486.07, y = 1580.23, z= 371.05},
DrugsPackage = {x = -1618.35, y = 3180.84, z= 30.32},
DrugsPackage2 = {x = 2665.14, y = -861.5, z= 26.83},
DrugsPackage3 = {x = -473.13, y = 6098.57, z= 29.74},
DrugsPackage4 = {x = 1570.44, y = -2176.8, z= 77.42}
}
Config.general_config_settings = {
--ESX
esx = 'esx:getSharedObject', -- default : esx:getSharedObject
-- whitelist job ( see all drugs )
acces_to_all_drugs = {
["lostmc"] = true,
["rusmafie"] = true,
["lafamilia"] = true,
["taxi"] = true,
},
-- draw3dtext settings
draw_text = '[E] Interakce',
-- marker settings
marker_drawDistace = 10,
--big marker
ZoneSize_bigMarker = {x = 5.0, y = 5.0, z = 0.7},
ZoneColorG_bigMarker = {r = 100, g = 204, b = 100},
MarkerType_bigMarker = 1,
--small marker
ZoneSize_smallMarker = {x = 0.7, y = 0.7, z = 0.7},
ZoneColorO_smallMarker = {r = 255, g = 204, b = 100},
ZoneColorG_smallMarker = {r = 100, g = 204, b = 100},
MarkerType_smallMarker = 22,
}
|
local function isInvalid(arg)
local from, to, err = ngx.re.find(arg, ".*(shell|bash|root|select .* from).*", "jo")
if not from then
return false
end
return true
end
local arg = ngx.req.get_uri_args()
for k,v in pairs(arg) do
if isInvalid(k) or isInvalid(v) then
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
end
ngx.req.read_body() -- 解析 body 参数之前一定要先读取 body
local arg = ngx.req.get_post_args()
for k,v in pairs(arg) do
if isInvalid(k) or isInvalid(v) then
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
end
ngx.log(ngx.INFO, "waf check success") |
-- Lua
--[=x=] 行コメント
print ("I said \"Hello.\" to him.")
print ('that\'s good.')--Hello World!と画面に表示する
print "Hello World!" --[[この部分が
コメントとなります]]
for i = 1, 9 do
array = {}
for j = 1, 9 do
table.insert(array , i*j)
io.write( string.format("%3d", array[j]) )
end
io.write("\n")
end
io.write
--[===[ コメント
print([[
Hello World!
こんにちは世界
]])
]===]
local ls = [[
最初の改行は文字列の一部とはならない。
つまり、この文字列は2行である。]]
-- 等号を使った記法(ネスト可能)
local lls = [==[
この記法は、Windowsのパスを表現する場合にも便利である。
local path = [=[C:\Windows\Fonts]=]
-- コメントではない行
]==]
|
-- Loaders
data.raw.item["transport-belt-loader"].subgroup = "transport-dead-loader"
data.raw.item["transport-belt-loader"].order = "a"
data.raw.item["fast-transport-belt-loader"].subgroup = "transport-dead-loader"
data.raw.item["fast-transport-belt-loader"].order = "b"
data.raw.item["express-transport-belt-loader"].subgroup = "transport-dead-loader"
data.raw.item["express-transport-belt-loader"].order = "c"
data.raw.recipe["transport-belt-loader"].subgroup = "transport-dead-loader"
data.raw.recipe["transport-belt-loader"].order = "a"
data.raw.recipe["fast-transport-belt-loader"].subgroup = "transport-dead-loader"
data.raw.recipe["fast-transport-belt-loader"].order = "b"
data.raw.recipe["express-transport-belt-loader"].subgroup = "transport-dead-loader"
data.raw.recipe["express-transport-belt-loader"].order = "c"
-- Beltbox
data.raw.item["transport-belt-beltbox"].subgroup = "transport-dead-beltbox"
data.raw.item["transport-belt-beltbox"].order = "a"
data.raw.item["fast-transport-belt-beltbox"].subgroup = "transport-dead-beltbox"
data.raw.item["fast-transport-belt-beltbox"].order = "b"
data.raw.item["express-transport-belt-beltbox"].subgroup = "transport-dead-beltbox"
data.raw.item["express-transport-belt-beltbox"].order = "c"
data.raw.recipe["transport-belt-beltbox"].subgroup = "transport-dead-beltbox"
data.raw.recipe["transport-belt-beltbox"].order = "a"
data.raw.recipe["fast-transport-belt-beltbox"].subgroup = "transport-dead-beltbox"
data.raw.recipe["fast-transport-belt-beltbox"].order = "b"
data.raw.recipe["express-transport-belt-beltbox"].subgroup = "transport-dead-beltbox"
data.raw.recipe["express-transport-belt-beltbox"].order = "c" |
project "Test Lua"
language "C#"
kind "ConsoleApp"
files { "../src/testLua/**.cs" }
links { "System", "Lua"}
location "testLua"
vpaths { ["*"] = "../src/testLua" }
|
local coordsVisible = false
ShowNotificationTicker = function(message)
BeginTextCommandThefeedPost('STRING')
AddTextComponentSubstringPlayerName(message)
EndTextCommandThefeedPostTicker(0, 1)
end
RegisterCommand('copycoords', function() --Copy coords command. You can change the command to what you want.
local coords, heading = GetEntityCoords(PlayerPedId()), GetEntityHeading(PlayerPedId())
SendNUIMessage({
type = 'clipboard',
data = '' .. vec(coords.x, coords.y, coords.z, heading)
})
ShowNotificationTicker('Copied to coords clipboard! ' .. vec(coords.x, coords.y, coords.z, heading))
end)
RegisterCommand("showcoords", function() --Show coords command. You can change the command to what you want.
ToggleCoords()
end)
function DrawTxt(text) --Coords Text Config
SetTextColour(255, 186, 186, 255)
SetTextFont(9)
SetTextScale(0.478, 0.478)
SetTextWrap(0.0, 1.0)
SetTextCentre(false)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 205)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(0.35, 0.80)
end
function DrawGenericText(text)
SetTextColour(186, 186, 186, 255)
SetTextFont(7)
SetTextScale(0.478, 0.478)
SetTextWrap(0.0, 1.0)
SetTextCentre(false)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 205)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(0.88, 0.00)
end
Citizen.CreateThread(function()
while true do
local sleepThread = 250
if coordsVisible then
sleepThread = 5
local playerPed = PlayerPedId()
local playerX, playerY, playerZ = table.unpack(GetEntityCoords(playerPed))
local playerH = GetEntityHeading(playerPed)
DrawTxt(("~b~X~w~: %s ~b~Y~w~: %s ~b~Z~w~: %s ~b~H~w~: %s"):format(FormatCoord(playerX), FormatCoord(playerY), FormatCoord(playerZ), FormatCoord(playerH)))
DrawGenericText("~w~Kasper Coords~s~ ")
end
Citizen.Wait(sleepThread)
end
end)
FormatCoord = function(coord)
if coord == nil then
return "unknown"
end
return tonumber(string.format("%.2f", coord))
end
ToggleCoords = function()
coordsVisible = not coordsVisible
end |
-- AudioTest
-- Author:LuatTest
-- CreateDate:20200717
-- UpdateDate:20210830
module(..., package.seeall)
local waitTime1 = 3000
local waitTime2 = 1000
--音频播放优先级,数值越大,优先级越高
local PWRON, CALL, SMS, TTS, REC = 4, 3, 2, 1, 0
local playVol = 0
local micVol = 0
local count = 1
local speed = 4
local ttsStr = "上海合宙通信科技有限公司欢迎您"
local streamRecordFile
local tAudioFile =
{
[audiocore.WAV] = "call.wav",
[audiocore.AMR] = "tip.amr",
[audiocore.SPX] = "record.spx",
-- [audiocore.PCM] = "alarm_door.pcm",
[audiocore.MP3] = "sms.mp3"
}
local function audioStreamPlayTest(streamType)
sys.taskInit(
function()
log.info("AudioTest.AudioStreamTest", "AudioStreamPlay Start", tAudioFile[streamType])
local fileHandle = io.open("/lua/" .. tAudioFile[streamType], "rb")
if fileHandle == nil then
log.error("AudioTest.AudioStreamTest", "Open file fail")
return
end
while true do
local data = fileHandle:read(streamType == audiocore.SPX and 1200 or 1024)
if not data then
fileHandle:close()
while audiocore.streamremain() ~= 0 do
sys.wait(20)
end
sys.wait(1000)
audiocore.stop()
log.info("AudioTest.AudioStreamTest", "AudioStreamPlay Over")
return
end
local data_len = string.len(data)
local curr_len = 1
while true do
curr_len = curr_len + audiocore.streamplay(streamType, string.sub(data, curr_len, -1))
if curr_len >= data_len then
break
elseif curr_len == 0 then
log.error("AudioTest.AudioStreamTest", "AudioStreamPlay Error", tAudioFile[streamType])
audiocore.stop()
return
end
sys.wait(10)
end
sys.wait(10)
end
end
)
end
local function recordPlayCb(result)
log.info("AudioTest.RecordTest.PlayCb", result)
log.info("AudioTest.RecordTest", "录音播放结束")
record.delete()
sys.publish("FileRecordTestFinish")
end
function recordCb1(result, size)
log.info("AudioTest.RecordTest.RecordCb", "录音结束")
log.info("AudioTest.RecordTest.RecordCb.result, size", result, size)
if result == true then
log.info("AudioTest.RecordTest.RecordCb", "录制成功SUCCESS")
log.info("AudioTest.RecordTest.GetData", record.getData(0, size))
log.info("AudioTest.RecordTest.GetSize", record.getSize())
log.info("AudioTest.RecordTest.Exists", record.exists())
log.info("AudioTest.RecordTest.IsBusy", record.isBusy())
log.info("AudioTest.RecordTest.filePath", record.getFilePath())
-- local mountRes = io.mount(io.SDCARD)
-- if mountRes == 1 then
-- log.info("挂载SD卡SUCCESS")
-- io.writeFile("/sdcard0/record.amr",io.readFile("/record.amr"))
-- else
-- log.error("挂载SD卡FAIL")
-- end
-- io.unmount(io.SDCARD)
--播放录音内容
log.info("AudioTest.RecordTest", "开始播放录音")
audio.play(REC, "FILE", record.getFilePath(), playVol, recordPlayCb)
else
log.info("AudioTest.RecordTest.RecordCb", "录制失败FAIL")
sys.publish("FileRecordTestFinish")
end
end
local streamRecordBuffer = ""
function streamRecordCb(result, size, tag)
log.info("AudioTest.RecordTest.streamRecordCb", result, size, tag)
if tag == "STREAM" then
streamRecordBuffer = streamRecordBuffer .. audiocore.streamrecordread(size)
if #streamRecordBuffer > 4096 then
streamRecordFile:write(streamRecordBuffer)
streamRecordBuffer = ""
end
elseif tag == "END" then
streamRecordFile:write(streamRecordBuffer)
streamRecordFile:close()
streamRecordBuffer = ""
log.info("AudioTest.RecordTest.StreamPlay", "开始流录音播放")
audio.play(REC, "FILE", "/streamRecordFile.amr", playVol, function () log.info("AudioTest.RecordTest.StreamPlay", "流录音播放结束") sys.publish("StreamRecordTestFinish") end)
else
log.error("AudioTest.RecordTest", "流录音FAIL")
end
end
-- audioPlayTestCb回调
local function audioPlayTestCb(result)
local tag = "AudioTest.audioPlayTestCb"
if result == 0 then
log.info(tag, "播放成功SUCCESS")
elseif result == 1 then
log.info(tag, "播放出错FAIL")
elseif result == 2 then
log.info(tag, "播放优先级不够,没有播放")
elseif result == 3 then
log.info(tag, "传入的参数出错,没有播放")
elseif result == 4 then
log.info(tag, "被新的播放请求中止")
elseif result == 5 then
log.info(tag, "调用audio.stop接口主动停止")
end
end
-- playStopCb回调
local function playStopCb(result)
local tag = "AudioTest.playStopCb"
if result == 0 then
log.info(tag, "SUCCESS")
elseif result == 1 then
log.info(tag, "please wait")
end
end
local function headsetCb(msg)
if msg.type == 1 then
log.info("音频通道切换为耳机")
audiocore.setchannel(1, 0)
elseif msg.type == 2 then
log.info("音频通道切换为喇叭")
audiocore.setchannel(2, 0)
elseif msg.type == 3 then
log.info("耳机按键按下")
elseif msg.type == 4 then
log.info("耳机按键弹起")
end
end
--注册core上报的rtos.MSG_AUDIO消息的处理函数
-- rtos.on(rtos.MSG_HEADSET, headsetCb)
-- audiocore.headsetinit(0)
sys.taskInit(
function()
sys.wait(1000)
audio.setChannel(2, 0)
-- 耳机插拔,音频通道自动切换
-- audiocore.headsetinit(1)
local isTTSVersion = rtos.get_version():upper():find("TS")
while true do
-- audiocore.playdata(audioData,audioFormat[,audioLoop]) demo中没有
-- audiocore.setpa(audioClass) audiocore.getpa() audiocore.pa(gpio,devout,[plus_count],[plus_period]) 不清楚什么意思
audio.setVolume(playVol)
log.info("AudioTest.当前播放音量", playVol)
local setMicResult = audio.setMicGain("record", micVol)
if setMicResult == true then
log.info("AudioTest.SetMicGain", "SUCCESS")
else
log.error("AudioTest.SetMicGain", "FAIL")
end
if LuaTaskTestConfig.audioTest.audioPlayTest then
-- 播放音频文件
log.info("AudioTest.AudioPlayTest.PlayFileTest", "第" .. count .. "次")
audio.play(CALL, "FILE", "/lua/sms.mp3", playVol, audioPlayTestCb, true)
sys.wait(waitTime1)
audio.stop(playStopCb)
log.info("AudioTest.AudioPlayTest.Stop", "播放中断")
sys.wait(waitTime1)
-- tts播放时,请求播放新的tts
if isTTSVersion then
log.info('AudioTest.AudioPlayTest.speed', speed)
log.info("AudioTest.AudioPlayTest.PlayTtsTest", "第" .. count .. "次")
-- TODO 验证速度的值
audio.setTTSSpeed(speed)
--设置优先级相同时的播放策略,1表示停止当前播放,播放新的播放请求
-- audio.setStrategy(1)
audio.play(TTS, "TTS", ttsStr, playVol, audioPlayTestCb)
sys.wait(waitTime2)
log.info("AudioTest.AudioPlayTest.PlayTtsTest", "相同优先级停止当前播放")
audio.play(TTS, "TTS", ttsStr, playVol, audioPlayTestCb)
sys.wait(10000)
--设置优先级相同时的播放策略,0表示继续播放正在播放的音频,忽略请求播放的新音频
-- audio.setStrategy(0)
audio.play(TTS, "TTS", ttsStr, playVol, audioPlayTestCb)
sys.wait(waitTime2)
log.info("AudioTest.AudioPlayTest.PlayTtsTest", "当前播放不会被打断")
audio.play(TTS, "TTS", ttsStr, playVol, audioPlayTestCb)
sys.wait(10000)
end
-- 播放冲突1
log.info("AudioTest.AudioPlayTest.PlayConflictTest1", "第" .. count .. "次")
-- 循环播放来电铃声
log.info("AudioTest.AudioPlayTest.PlayConflictTest1", "优先级: ", CALL)
audio.play(CALL, "FILE", "/lua/sms.mp3", playVol, audioPlayTestCb, true)
sys.wait(waitTime1)
--3秒钟后,播放开机铃声
log.info("AudioTest.AudioPlayTest.PlayConflictTest1", "优先级较高的开机铃声播放")
log.info("AudioTest.AudioPlayTest.PlayConflictTest1", "优先级: ", PWRON)
audio.play(PWRON, "FILE", "/lua/sms.mp3", playVol, audioPlayTestCb)
sys.wait(waitTime1)
-- 播放冲突2
log.info("AudioTest.AudioPlayTest.PlayConflictTest2", "第" .. count .. "次")
-- 播放来电铃声
log.info("AudioTest.AudioPlayTest.PlayConflictTest2", "优先级: ", CALL)
audio.play(CALL, "FILE", "/lua/sms.mp3", playVol, audioPlayTestCb, true)
sys.wait(waitTime1)
--3秒钟后,尝试循环播放新短信铃声,但是优先级不够,不会播放
log.info("AudioTest.AudioPlayTest.PlayConflictTest2", "优先级较低的短信铃声不能播放")
log.info("AudioTest.AudioPlayTest.PlayConflictTest2", "优先级: ", SMS)
audio.play(SMS, "FILE", "/lua/sms.mp3", playVol, audioPlayTestCb)
sys.wait(waitTime1)
audio.stop(playStopCb)
sys.wait(waitTime1)
end
if LuaTaskTestConfig.audioTest.audioStreamTest then
log.info("AudioTest.AudioStreamTest.WAVFilePlayTest", "Start")
audioStreamPlayTest(audiocore.WAV)
sys.wait(30000)
log.info("AudioTest.AudioStreamTest.AMRFilePlayTest", "Start")
audioStreamPlayTest(audiocore.AMR)
sys.wait(30000)
log.info("AudioTest.AudioStreamTest.SPXFilePlayTest", "Start")
audioStreamPlayTest(audiocore.SPX)
sys.wait(30000)
-- log.info("AudioTest.AudioStreamTest.PCMFilePlayTest", "Start")
-- audioStreamPlayTest(audiocore.PCM)
-- sys.wait(30000)
log.info("AudioTest.AudioStreamTest.MP3FilePlayTest", "Start")
audioStreamPlayTest(audiocore.MP3)
sys.wait(30000)
end
if LuaTaskTestConfig.audioTest.recordTest then
log.info("AudioTest.RecordTest", "当前MIC音量:", micVol)
log.info("AudioTest.RecordTest", "开始普通录音")
record.start(5, recordCb1, "FILE", 1, 1)
sys.waitUntil("FileRecordTestFinish")
log.info("AudioTest.RecordTest", "开始流录音")
os.remove("/streamRecordFile.amr")
streamRecordFile = io.open("/streamRecordFile.amr", "a+")
if streamRecordFile == nil then
log.error("AudioTest.RecordTest", "创建录音文件FAIL")
else
record.start(10, streamRecordCb, "STREAM", 1, 1)
sys.waitUntil("StreamRecordTestFinish", 30000)
end
sys.wait(50000)
end
local getPlayVol = audio.getVolume()
if getPlayVol == playVol then
log.info("AudioTest.PlayVolCheck", "SUCCESS")
else
log.error("AudioTest.PlayVolCheck", "FAIL")
end
count = count + 1
playVol = (playVol == 7) and 0 or (playVol + 1)
micVol = (micVol == 7) and 0 or (micVol + 1)
speed = (speed == 100) and 4 or (speed + 16)
end
end)
if LuaTaskTestConfig.audioTest.audioParamTest then
local tag = "AudioParamTest"
sys.taskInit(
function()
while true do
sys.wait(5000)
local USERNVM_DIR = "/usernvm"
local USERNVM_AUDIOCALIB_FILE_PATH = USERNVM_DIR .. "/user_audio_calib.bin"
local USERNVM_AUDIOCALIB_SET_FILE_PATH = USERNVM_DIR .. "/user_audio_calib_flag.bin"
if rtos.make_dir(USERNVM_DIR) then
if io.exists(USERNVM_AUDIOCALIB_SET_FILE_PATH) then
if io.exists(USERNVM_AUDIOCALIB_FILE_PATH) then
log.error(tag, "audioParam USERNVM_AUDIOCALIB_FILE_PATH FAIL")
else
log.info(tag, "SUCCESS")
end
else
os.remove(USERNVM_AUDIOCALIB_FILE_PATH)
local userAudioParam = io.readFile("/lua/audio_calib.bin")
io.writeFile(USERNVM_AUDIOCALIB_FILE_PATH, pack.pack("<i",userAudioParam:len()))
io.writeFile(USERNVM_AUDIOCALIB_FILE_PATH, userAudioParam, "ab")
io.writeFile(USERNVM_AUDIOCALIB_SET_FILE_PATH, "1")
log.info(tag, "audioParam write completed, prepar to restart")
sys.restart(tag)
end
else
log.error(tag, ".make_dir", "FAIL")
end
end
end
)
end |
-- chatbox/messageManager.lua by Bonyoze
-- Manager formatting messages and player avatars
bsuChat.imageDataCache = {}
function bsuChat.formatMsg(...) -- formats regular print message data table for use in html
local msg = {}
for k, arg in pairs({...}) do
if type(arg) == "string" then
table.Add(msg, bsuChat.formatPlyMsg(arg))
elseif type(arg) == "table" then
table.insert(msg,
{
type = "color",
value = arg
}
)
elseif type(arg) == "Player" and arg:IsPlayer() then
table.Add(msg,
{
{
type = "color",
value = team.GetColor(arg:Team())
},
{
type = "text",
value = arg:Nick()
}
}
)
elseif type(arg) == "Entity" then
table.insert(msg,
{
type = "text",
value = tostring(arg)
}
)
end
end
return msg
end
function bsuChat.formatPlyMsg(text, oldData, oldPos) -- formats player-sent message for use in html
local data = oldData or {}
local pos = oldPos or 0
local index1, index2
while true do
index1 = string.find(text, "[", pos, true)
if index1 then
index2 = string.find(text, "]", pos, true)
if index2 then
local sub = string.sub(text, index1 + 1, index2 - 1)
if not (pos == 0 and index1 - 1 == 0) and #string.sub(text, pos, index1 - 1) > 0 then
table.insert(data,
{
type = "text",
value = string.sub(text, pos, index1 - 1)
}
)
end
local type, value
local splitPos = string.find(sub, ":", 0, true)
if splitPos then
type = string.lower(string.Trim(string.sub(sub, 0, splitPos - 1)))
value = string.Trim(string.Replace(string.Replace(string.sub(sub, splitPos + 1), "\"", ""), "'", ""))
else
type = string.lower(string.Trim(sub))
end
local bool, newValue
if type[1] ~= "/" then
bool = true
else
bool = false
type = string.sub(type, 2)
end
local newValue
if type == "url" or type == "link" or type == "hyperlink" then
if value then
local args = string.Split(value, ",")
local url, text = string.Trim(args[1]), (args[2] and #string.Trim(args[2]) > 0) and string.Trim(args[2]) or nil
local domain = (string.sub(string.lower(url), 0, 7) == "http://" and string.sub(url, 8)) or (string.sub(string.lower(url), 0, 8) == "https://" and string.sub(url, 9)) or nil
if domain and #string.Split(domain, ".") >= 2 then
newValue = {url = url, text = text} -- url and link name
type = "hyperlink"
end
end
elseif type == "img" or type == "image" then
if value then
local domain = (string.sub(string.lower(value), 0, 7) == "http://" and string.sub(value, 8)) or (string.sub(string.lower(value), 0, 8) == "https://" and string.sub(value, 9)) or nil
if domain and #string.Split(domain, ".") >= 2 then
newValue = value
type = "image"
end
end
elseif type == "hex" then
if value then
local hex = value:gsub("#", "");
pcall(function()
newValue = Color(tonumber("0x" .. hex:sub(1, 2)), tonumber("0x" .. hex:sub(3, 4)), tonumber("0x" .. hex:sub(5, 6))) -- some color
type = "color"
end)
else
newValue = color_white -- default color
type = "color"
end
elseif type == "rgb" then
if value then
local r, g, b = string.match(value, "([^,]+),([^,]+),([^,]+)")
pcall(function()
newValue = Color(r, g, b) -- some color
type = "color"
end)
else
newValue = color_white -- default color
type = "color"
end
elseif type == "i" or type == "italic" or type == "italics" then
newValue = bool -- italics or no italics
type = "italic"
elseif type == "b" or type == "bold" then
newValue = bool -- bold or no bold
type = "bold"
elseif type == "strike" or type == "strikethrough" then
newValue = bool -- strikethrough or no strikethrough
type = "strikethrough"
end
if newValue ~= nil then
table.insert(data,
{
type = type,
value = newValue
}
)
else
table.insert(data,
{
type = "text",
value = "[" .. sub .. "]"
}
)
end
pos = index2 + 1
continue
end
end
if pos <= #text then
table.insert(data,
{
type = "text",
value = string.sub(text, pos)
}
)
end
break
end
for _, obj in ipairs(data) do
if obj.type == "text" or obj.type == "hyperlink" or obj.type == "image" then
return data
end
end
return {
{
type = "text",
value = text
}
}
end
function bsuChat.loadPlyAvatarIcon(ply, data) -- gets player's avatar in base64
data.avatar = "data:image/jpeg;base64," .. util.Base64Encode(BSU:GetPlayerAvatarData(ply), false)
bsuChat.send(data)
end |
-- gruvbox-material
vim.g.gruvbox_material_background = 'hard'
vim.g.gruvbox_material_palette = 'material'
vim.g.gruvbox_material_enable_italic = 1
vim.g.gruvbox_material_disable_italic_comment = 0
vim.g.gruvbox_material_enable_bold = 1
vim.g.gruvbox_material_visual = 'green background'
vim.g.gruvbox_material_menu_selection_background = 'green'
vim.g.gruvbox_material_sign_column_background = 'none'
vim.g.gruvbox_material_current_word = 'underline'
vim.g.gruvbox_material_statusline_style = 'original'
vim.g.gruvbox_material_better_performance = 1
|
turtle.select(16)
turtle.refuel(16)
turtle.select(1)
for i = 1, 32 do
turtle.dig()
turtle.forward()
turtle.digUp()
os.sleep(0.5)
turtle.digDown()
turtle.turnLeft()
for u = 1, 2 do
turtle.dig()
turtle.forward()
turtle.digUp()
os.sleep(0.5)
turtle.digDown()
end
turtle.turnRight()
turtle,dig()
turtle.forward()
turtle.digUp()
os.sleep(0.5)
turtle.digDown()
for y = 1, 2 do
turtle.dig()
turtle.forward()
turtle.digUP()
os.sleep(0.5)
turtle.digDown()
end
turtle.turnLeft()
end
|
#!/usr/bin/env lua
--[[
local map = {
["apple"] = "蘋果",
["banana"] = "香蕉",
["cherry"] = "櫻桃"
}
--]]
local map = {
apple = "蘋果",
banana = "香蕉",
cherry = "櫻桃"
}
-- set
map["apple"] = "這是蘋果。"
map["banana"] = "這是香蕉。"
map["cherry"] = "這是櫻桃。"
print(map["apple"])
print(map["banana"])
print(map["cherry"])
|
object_tangible_loot_creature_loot_collections_ig_88_head = object_tangible_loot_creature_loot_collections_shared_ig_88_head:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_ig_88_head, "object/tangible/loot/creature/loot/collections/ig_88_head.iff")
|
util.AddNetworkString("net_enable_celshading_on_players")
util.AddNetworkString("net_enable_gm13halos_on_players")
net.Receive("net_enable_celshading_on_players", function(_, ply)
if not ply:IsAdmin() then return end
RunConsoleCommand("enable_celshading_on_players", net.ReadString())
end)
net.Receive("net_enable_gm13halos_on_players", function(_, ply)
if not ply:IsAdmin() then return end
RunConsoleCommand("enable_gm13_for_players", net.ReadString())
end)
hook.Add("PlayerSay","cst.callpanel.2020",function(ply, text, team)
if string.sub(text,1,4) == "!cst" then
ply:ConCommand("cel_menu")
end
end) |
--------------------------------------------------------------------------
-- cours exported from GestionPtfEfficienceMarko.txt
--------------------------------------------------------------------------
GestionPtfEfficienceMarko = Tmv(GESTION_PTF_EFFICIENCE_MARKO_TITLE_ID,GESTION_PTF_EFFICIENCE_MARKO_TITLE_HEADER_ID)
function GestionPtfEfficienceMarko:performCalc()
self:appendToResult("")
self:appendTitleToResult("Gestion de ptf efficience Markowitz")
self:appendToResult("\n")
self:appendToResult("Markowitz : ")
self:appendMathToResult("Rp - "..c_theta.."/2 "..c_sigma.."(P)^2")
self:appendToResult(" -> max \n")
self:appendToResult("ici pour obtenir la composition du ptf on aura:\n")
self:appendToResult("")
self:appendMathToResult("Rp - "..c_theta.."/2 * "..c_sigma.."(P)^2")
self:appendToResult(" -> max donc ")
self:appendMathToResult("rf + Xm(R-rf)-"..c_theta.."/2 *(Xm*"..c_sigma.."(M))^2")
self:appendToResult(" -->max et donc en dérivant on aura\n")
self:appendToResult("")
self:appendMathToResult("Xm=(R(M)-rf)/("..c_theta.." * "..c_sigma.."(M)^2)")
self:appendToResult("\n")
self:appendToResult("\n")
self:appendToResult("")
self:appendMathToResult(""..c_sigma.."(P)^2 = X(A)^2*"..c_sigma.."(P)^2+ X(B)^2*"..c_sigma.."(B)^2+2*"..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B) ")
self:appendToResult("\n")
self:appendToResult("et le ptf qui minimise le risque on mimnimise \n")
self:appendToResult("")
self:appendMathToResult(""..c_sigma.."(P)= (X(A)^2*"..c_sigma.."(A)^2+ X(B)^2*"..c_sigma.."(B)^2+2*"..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B))^(1/2) ")
self:appendToResult("\n")
self:appendToResult("on dérivant par X(A) on aura \n")
self:appendToResult("pour "..c_rho.." entre {-1 et 1} ")
self:appendMathToResult(" X(A)= ("..c_sigma.."(B)^2 - "..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B))/("..c_sigma.."(A)^2+"..c_sigma.."(B)^2-2*"..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B))")
self:appendToResult(" \n")
self:appendToResult("pour "..c_rho.." = -1 la composition du ptf Z et tel que ")
self:appendMathToResult("X(A) = "..c_sigma.."(B) / ("..c_sigma.."(A) + "..c_sigma.."(B))")
self:appendMathToResult(" \n")
self:appendToResult("et donc par ex Z= {3/5 A ; 2/5 B} alors Rz=(3/5)*Ra+(2/5)*Rb \n")
self:appendToResult(" \n")
self:appendToResult("le ptf parfait en fct de "..c_theta.." on ")
self:appendMathToResult("Rp - "..c_theta.."/2 "..c_sigma.."(P)^2")
self:appendToResult("-> max \n")
self:appendToResult("")
self:appendMathToResult("X(A)*R(A) + (1-X(A))*R(B) - ("..c_theta.."/2) (X(A)^2*"..c_sigma.."(A)^2+ X(B)^2*"..c_sigma.."(B)^2+2*"..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B)) ")
self:appendToResult(" \n")
self:appendToResult("")
self:appendMathToResult("X(A)=(R(A)-R(B)+"..c_theta.."*("..c_sigma.."(B)^2-"..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B)))/("..c_theta.."*("..c_sigma.."(A)^2 + "..c_sigma.."(B)^2-2*"..c_rho.."*"..c_sigma.."(A)*"..c_sigma.."(B)))")
self:appendToResult(" \n")
self:appendToResult(" \n")
self:appendToResult("Quand on a une VAD le risque du ptf peut etre superieur au risques de tous les actifs qui le composent. \n")
end
|
object_tangible_loot_creature_loot_kashyyyk_loot_uwari_fluid = object_tangible_loot_creature_loot_kashyyyk_loot_shared_uwari_fluid:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_kashyyyk_loot_uwari_fluid, "object/tangible/loot/creature_loot/kashyyyk_loot/uwari_fluid.iff") |
-- =============================================================
-- Copyright Roaming Gamer, LLC. 2009-2015
-- =============================================================
-- License
-- =============================================================
--[[
> SSK is free to use.
> SSK is free to edit.
> SSK is free to use in a free or commercial game.
> SSK is free to use in a free or commercial non-game app.
> SSK is free to use without crediting the author (credits are still appreciated).
> SSK is free to use without crediting the project (credits are still appreciated).
> SSK is NOT free to sell for anything.
> SSK is NOT free to credit yourself with.
]]
-- =============================================================
--
-- DO NOT MODIFY THIS FILE. MODIFY "data/labels.lua" instead.
--
-- =============================================================
--
-- labelsInit.lua - Create Label Presets
--
local mgr = require "ssk.interfaces.labels"
-- ============================
-- =============== DEFAULT
-- ============================
local params =
{
font = native.systemFont,
fontSize = 12,
textColor = { 255,255,255, 255 },
}
mgr:addLabelPreset( "default", params )
|
-- Disable imaps (using Ultisnips)
vim.g.vimtex_imaps_enabled = 0
-- Do not open pdfviwer on compile
vim.g.vimtex_view_automatic = 0
-- Disable conceal
vim.g.vimtex_syntax_conceal = {
accents = 0,
cites = 0,
fancy = 0,
greek = 0,
math_bounds = 0,
math_delimiters = 0,
math_fracs = 0,
math_super_sub = 0,
math_symbols = 0,
sections = 0,
styles = 0,
}
-- Disable quickfix auto open
vim.g.vimtex_quickfix_ignore_mode = 0
-- PDF viewer settings
vim.g.vimtex_view_general_viewer = "SumatraPDF"
vim.g.vimtex_view_general_options = "-reuse-instance -forward-search @tex @line @pdf"
-- Do not auto open quickfix on compile erros
vim.g.vimtex_quickfix_mode = 0
-- Latex warnings to ignore
vim.g.vimtex_quickfix_ignore_filters = {
"Command terminated with space",
"LaTeX Font Warning: Font shape",
"Package caption Warning: The option",
[[Underfull \\hbox (badness [0-9]*) in]],
"Package enumitem Warning: Negative labelwidth",
[[Overfull \\hbox ([0-9]*.[0-9]*pt too wide) in]],
[[Package caption Warning: Unused \\captionsetup]],
"Package typearea Warning: Bad type area settings!",
[[Package fancyhdr Warning: \\headheight is too small]],
[[Underfull \\hbox (badness [0-9]*) in paragraph at lines]],
"Package hyperref Warning: Token not allowed in a PDF string",
[[Overfull \\hbox ([0-9]*.[0-9]*pt too wide) in paragraph at lines]],
}
vim.g.vimtex_fold_enabled = 1
vim.g.vimtex_fold_manual = 1
vim.g.vimtex_fold_types = {
cmd_addplot = {
cmds = { "addplot[+3]?" },
},
cmd_multi = {
cmds = {
"%(re)?new%(command|environment)",
"providecommand",
"presetkeys",
"Declare%(Multi|Auto)?CiteCommand",
"Declare%(Index)?%(Field|List|Name)%(Format|Alias)",
},
},
cmd_single = {
cmds = { "hypersetup", "tikzset", "pgfplotstableread", "lstset" },
},
cmd_single_opt = {
cmds = { "usepackage", "includepdf" },
},
comments = {
enabled = 0,
},
env_options = vim.empty_dict(),
envs = {
blacklist = {},
whitelist = { "figure", "frame", "table", "example", "answer" },
},
items = {
enabled = 0,
},
markers = vim.empty_dict(),
preamble = {
enabled = 0,
},
sections = {
parse_levels = 0,
parts = { "appendix", "frontmatter", "mainmatter", "backmatter" },
sections = {
"%(add)?part",
"%(chapter|addchap)",
"%(section|section\\*)",
"%(subsection|subsection\\*)",
"%(subsubsection|subsubsection\\*)",
"paragraph",
},
},
}
|
dantari_chief = Creature:new {
objectName = "@mob/creature_names:dantari_raider_chief",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "dantari_raiders",
faction = "dantari_raiders",
level = 42,
chanceHit = 0.44,
damageMin = 345,
damageMax = 400,
baseXp = 4188,
baseHAM = 9300,
baseHAMmax = 11300,
armor = 0,
resists = {35,50,50,-1,70,70,-1,0,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0.0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/dantari_male.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 4000000},
{group = "loot_kit_parts", chance = 3000000},
{group = "armor_attachments", chance = 500000},
{group = "clothing_attachments", chance = 500000},
{group = "wearables_all", chance = 2000000}
}
}
},
weapons = {"primitive_weapons"},
conversationTemplate = "",
attacks = merge(pikemanmaster,fencermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(dantari_chief, "dantari_chief")
|
--[[
This file contains an alternative pfilter(...) implementation in pure Lua (utilizing moonbridge_io). This implementation is currently not used since extos already comes with a C implementation (extos.pfilter), which is independent of moonbridge_io and thus preferred to the implementation below.
data_out, -- string containing stdout data, or nil in case of error
data_err, -- string containing error or stderr data
status = -- exit code, or negative code in case of abnormal termination
pfilter(
data_in, -- string containing stdin data
filename, -- executable
arg1, -- first (non-zero) argument to executable
arg2, -- second argument to executable
...
)
Executes the executable given by "filename", passing optional arguments. A given string may be fed into the program as stdin. On success 3 values are returned: A string containing all stdout data of the sub-process, a string containing all stderr data of the sub-process, and a status code. The status code is negative, if the program didn't terminate normally. By convention a status code of zero indicates success, while positive status codes indicate error conditions. If program execution was not possible at all, then nil is returned as first value and an error string as second value.
--]]
return function(data_in, ...)
local process, errmsg = moonbridge_io.exec(...)
if not process then return nil, errmsg end
local read_fds = {[process.stdout] = true, [process.stderr] = true}
local write_fds = {[process.stdin] = true}
local function read(socket, chunks)
if read_fds[socket] then
local chunk, status = socket:read_nb()
if not chunk then
socket:close()
read_fds[socket] = nil
else
chunks[#chunks+1] = chunk
if status == "eof" then
socket:close()
read_fds[socket] = nil
end
end
end
end
local function write(...)
if write_fds[process.stdin] then
local buffered = process.stdin:flush_nb(...)
if not buffered or buffered == 0 then
process.stdin:close()
write_fds[process.stdin] = nil
end
end
end
write(data_in or "")
local stdout_chunks, stderr_chunks = {}, {}
while next(read_fds) or next(write_fds) do
moonbridge_io.poll(read_fds, write_fds)
read(process.stdout, stdout_chunks)
read(process.stderr, stderr_chunks)
write()
end
return
table.concat(stdout_chunks),
table.concat(stderr_chunks),
process:wait()
end
|
----------------------------------
-- Area: Lower Jeuno
-- NPC: Mesukiki
-- Type: Item Deliverer
-- !pos -19.832 -0.101 -39.075 245
--
-----------------------------------
local ID = require("scripts/zones/Lower_Jeuno/IDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
player:showText(npc, ID.text.ITEM_DELIVERY_DIALOG);
player:openSendBox();
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
end;
|
package.path = 'C:/Program Files (x86)/HTTPD/htdocs/TrainMobileFile/LuaCode/lib/?.lua;C:/Program Files (x86)/HTTPD/htdocs/TrainMobileFile/LuaCode/namepipe/?.lua'
--idlcpp for apache.
--url format: fs_namepipe_client_get_data.php?id=xx&key=xx&pop=1/0...
function handle(r)
r.content_type = "text/plain"
if r.method == 'GET' or r.method == 'POST' then
local reg_table = {}
for k, v in pairs( r:parseargs() ) do
reg_table[k] = v
end
local uid = reg_table["id"]
local ukey = reg_table["key"]
local upop = reg_table["pop"]
if nil == uid or nil == ukey or nil == upop then
r:puts("{\"result\":\"Unsupported http method.id,key,pop should be here.\",\"code\":0,\"method\":\"namepipe_client_get_data\"}")
r.status = 405
return apache2.OK
end
require "paflua"
paf.pafcore.System.LoadDLL("LuaNamepipeClient.dll")
local nps_name = require "nps_name"
local npc = paf.Namepipe.Client()
local main_nps = "\\\\localhost\\pipe\\"..nps_name
local client_npc = "\\\\localhost\\pipe\\user_"..uid
local client_nps = "\\\\.\\pipe\\user_"..uid
local npc_login_ret = npc:LoginNamepipeServer(main_nps,client_nps,client_npc)._
if true == npc_login_ret then
local umsg = paf.char._nullPtr_
local client_gm_ret = npc:GetServerSideMessage(ukey,umsg,tonumber(upop) == 1)._
r:puts("{\"result\":"..(client_gm_ret and umsg._ or "\"no data.\"")..",\"key\":\""..ukey.."\",\"code\":1,\"method\":\"namepipe_client_get_data\"}")
else
r:puts("{\"result\":\"namepipe not found.\",\"code\":0,\"method\":\"namepipe_client_get_data\"}")
end
elseif r.method == 'PUT' then
-- use our own Error contents
r:puts("{\"result\":\"Unsupported http method.\",\"code\":0,\"method\":\"namepipe_client_get_data\"}")
r.status = 405
return apache2.OK
else
-- use the ErrorDocument
return 501
end
return apache2.OK
end
|
--
-- default.lua
-- Default Configs
--
local default_config = {}
-- =============================================================================
-- Default applications
-- =============================================================================
default_config.apps = {
terminal = "iTerm",
browser = "Brave Browser",
}
-- =============================================================================
-- Keybindings
-- =============================================================================
default_config.keybindings = {
-- hyper key
hyper = "f18",
-- key to override hyper with
hyper_override = "alt",
}
-- =============================================================================
-- Window manager
-- =============================================================================
default_config.wm = {
-- yabai path
yabai_path = "/usr/local/bin/yabai",
-- units to move each time
move_step = 50,
-- units to resize each time
resize_step = 50,
}
-- =============================================================================
-- Floating Terminal
-- =============================================================================
default_config.floating_terminal = {
-- spawn command
command = "/usr/local/bin/alacritty --title floatingterm &",
-- terminal application name
name = "alacritty",
-- window title
title = "floatingterm",
}
-- =============================================================================
-- Spaces menu bar widget
-- =============================================================================
default_config.spaces = {
-- icon_size
icon_size = 21,
}
-- =============================================================================
-- Layouts menu bar widget
-- =============================================================================
default_config.layouts = {
-- icon_size
icon_size = 20,
}
-- =============================================================================
-- Paths
-- =============================================================================
default_config.paths = {
library = hs.configdir .. "/libraries",
icons = hs.configdir .. "/icons",
}
return default_config
|
spy_rogue = {
cast = function(player, target)
if not player:canCast(1, 1, 0) then
return
end
if (player.magic < 30) then
player:sendMinitext("You do not have enough mana.")
return
end
if target.level > player.level then
player:sendMinitext("Target player must be lower level than you for you to use this spell")
return
end
local popupText = ""
if (target.class < 5) then
popupText = popupText .. target.className .. " " .. target.name
elseif (target.class > 5) then
popupText = popupText .. target.classNameMark .. " " .. target.name
else
return
end
popupText = popupText .. " Level " .. target.level .. "\n"
if (player.title ~= "") then
popupText = popupText .. target.title .. "\n"
else
popupText = popupText .. "\n"
end
popupText = popupText .. "Might: " .. target.might .. " Will: " .. target.will .. " Grace: " .. target.grace .. "\n"
popupText = popupText .. "Items: "
for i = 0, 52 do
local item = target:getInventoryItem(i)
if (item ~= nil and item.name ~= "??") then
popupText = popupText .. item.name .. " "
end
end
player:sendAnimation(12)
player:popUp(popupText)
end,
requirements = function(player)
local level = 28
local items = {"acorn", "red_fox_fur", 0}
local itemAmounts = {100, 15, 200}
local description = "Shows a target person's strength, will, and grace as well as their level and title. Also shows their inventory. Only works on players lower than your level, or on anyone if you are level 99."
return level, items, itemAmounts, description
end
}
spiritual_guide_rogue = {
cast = function(player, target)
if not player:canCast(1, 1, 0) then
return
end
if (player.magic < 30) then
player:sendMinitext("You do not have enough mana.")
return
end
if target.level > player.level then
player:sendMinitext("Target player must be lower level than you for you to use this spell")
return
end
local popupText = ""
if (target.class < 5) then
popupText = popupText .. target.className .. " " .. target.name
elseif (target.class > 5) then
popupText = popupText .. target.classNameMark .. " " .. target.name
else
return
end
popupText = popupText .. " Level " .. target.level .. "\n"
if (player.title ~= "") then
popupText = popupText .. target.title .. "\n"
else
popupText = popupText .. "\n"
end
popupText = popupText .. "Might: " .. target.might .. " Will: " .. target.will .. " Grace: " .. target.grace .. "\n"
popupText = popupText .. "Items: "
for i = 0, 52 do
local item = target:getInventoryItem(i)
if (item ~= nil and item.name ~= "??") then
popupText = popupText .. item.name .. " "
end
end
player:sendAnimation(12)
player:popUp(popupText)
end,
requirements = function(player)
local level = 28
local items = {"acorn", "red_fox_fur", 0}
local itemAmounts = {100, 15, 200}
local description = "Shows a target person's strength, will, and grace as well as their level and title. Also shows their inventory. Only works on players lower than your level, or on anyone if you are level 99."
return level, items, itemAmounts, description
end
}
natures_handiwork_rogue = {
cast = function(player, target)
if not player:canCast(1, 1, 0) then
return
end
if (player.magic < 30) then
player:sendMinitext("You do not have enough mana.")
return
end
if target.level > player.level then
player:sendMinitext("Target player must be lower level than you for you to use this spell")
return
end
local popupText = ""
if (target.class < 5) then
popupText = popupText .. target.className .. " " .. target.name
elseif (target.class > 5) then
popupText = popupText .. target.classNameMark .. " " .. target.name
else
return
end
popupText = popupText .. " Level " .. target.level .. "\n"
if (player.title ~= "") then
popupText = popupText .. target.title .. "\n"
else
popupText = popupText .. "\n"
end
popupText = popupText .. "Might: " .. target.might .. " Will: " .. target.will .. " Grace: " .. target.grace .. "\n"
popupText = popupText .. "Items: "
for i = 0, 52 do
local item = target:getInventoryItem(i)
if (item ~= nil and item.name ~= "??") then
popupText = popupText .. item.name .. " "
end
end
player:sendAnimation(12)
player:popUp(popupText)
end,
requirements = function(player)
local level = 28
local items = {"acorn", "red_fox_fur", 0}
local itemAmounts = {100, 15, 200}
local description = "Shows a target person's strength, will, and grace as well as their level and title. Also shows their inventory. Only works on players lower than your level, or on anyone if you are level 99."
return level, items, itemAmounts, description
end
}
judgement_day_rogue = {
cast = function(player, target)
if not player:canCast(1, 1, 0) then
return
end
if (player.magic < 30) then
player:sendMinitext("You do not have enough mana.")
return
end
if target.level > player.level then
player:sendMinitext("Target player must be lower level than you for you to use this spell")
return
end
local popupText = ""
if (target.class < 5) then
popupText = popupText .. target.className .. " " .. target.name
elseif (target.class > 5) then
popupText = popupText .. target.classNameMark .. " " .. target.name
else
return
end
popupText = popupText .. " Level " .. target.level .. "\n"
if (player.title ~= "") then
popupText = popupText .. target.title .. "\n"
else
popupText = popupText .. "\n"
end
popupText = popupText .. "Might: " .. target.might .. " Will: " .. target.will .. " Grace: " .. target.grace .. "\n"
popupText = popupText .. "Items: "
for i = 0, 52 do
local item = target:getInventoryItem(i)
if (item ~= nil and item.name ~= "??") then
popupText = popupText .. item.name .. " "
end
end
player:sendAnimation(12)
player:popUp(popupText)
end,
requirements = function(player)
local level = 28
local items = {"acorn", "red_fox_fur", 0}
local itemAmounts = {100, 15, 200}
local description = "Shows a target person's strength, will, and grace as well as their level and title. Also shows their inventory. Only works on players lower than your level, or on anyone if you are level 99."
return level, items, itemAmounts, description
end
}
|
local component = require("component")
if component.isAvailable("experience") == true then
print("Current experience level " .. component.experience.level())
end |
require("Globals")
local Tas = require("Tas");
require("util")
local Gui = require("Gui")
local GuiEvents = require("GuiEvents")
inspect = require("inspect")
script.on_init( function()
-- Dont capture and print error, players won't see it as they haven't been added to the game
-- Instead collect the traceback in err and rethrow to display it in the main menu.
local _, err = xpcall(function()
log_error({"TAS-info-generic", "Calling script.on_init"}, true)
Tas.init_globals()
util.init_globals()
global.gui_events = GuiEvents.new()
global.gui = Gui.new(global.gui_events)
Gui.set_metatable(global.gui)
-- this is totally optional and increases load time, but catches some loading bugs
end, debug.traceback, event)
if err then
error(err)
end
end )
script.on_load( function()
-- Dont capture and print error, printing will result in another error because `game` is nil.
-- (resulting in loss of the initial stacktrace).
-- Instead collect the traceback in err and rethrow to display it in the main menu.
local _, err = xpcall(function()
log_error({"TAS-info-generic", "Calling script.on_load"}, true)
Gui.set_metatable(global.gui)
end, debug.traceback, event)
if err then
error(err)
end
end )
script.on_event(defines.events.on_player_created, function(event)
local _, err = xpcall(function(event)
global.gui:init_player(event.player_index)
end, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_player_created", err } end
end )
script.on_event(defines.events.on_gui_click, function(event)
local _, err = xpcall(function (event)
global.gui_events:on_click(event)
-- gui:on_click is deprecated, use gui_events in the future
global.gui:on_click(event)
end, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_gui_click", err } end
end )
script.on_event(defines.events.on_gui_checked_state_changed, function(event)
local _, err = xpcall(function (event) global.gui_events:on_check_changed(event) end, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_check_changed", err } end
end )
script.on_event(defines.events.on_gui_selection_state_changed, function(event)
local _, err = xpcall(function (event) global.gui_events:on_dropdown_selection_changed(event) end, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_dropdown_selection_changed", err } end
end )
script.on_event(defines.events.on_built_entity, function(event)
local _, err = xpcall(Tas.on_built_entity, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_built_entity", err } end
end )
script.on_event(defines.events.on_pre_player_mined_item, function(event)
local _, err = xpcall(Tas.on_pre_mined_entity, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_preplayer_mined_item", err } end
end )
script.on_event(defines.events.on_robot_pre_mined, function(event)
local _, err = xpcall(Tas.on_pre_mined_entity, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_robot_pre_mined", err } end
end )
script.on_event(defines.events.on_player_crafted_item, function(event)
local _, err = xpcall(Tas.on_crafted_item, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_crafted_item", err } end
end )
script.on_event("tas-select-hotkey", function(event)
local _, err = xpcall(Tas.on_left_click, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "tas-select-hotkey", err } end
end )
script.on_event(defines.events.on_tick, function(event)
local _, err = xpcall(Tas.on_tick, debug.traceback, event)
if err then log_error { "TAS-exception-specific", "on_tick", err } end
end ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.