content
stringlengths
5
1.05M
local class = require "lib.middleclass" local tiny = require "lib.tiny" local config = require "src.config" local Tracker = require "src.debug.tracker" local DebugTrackerSystem = tiny.system(class("DebugTrackerSystem")) DebugTrackerSystem.isPostDrawSystem = true function DebugTrackerSystem:update() if not config.debug.showTracker then return end Tracker:update() love.graphics.setFont(assets.fonts.monogram(16)) Tracker:draw(0, 80) end return DebugTrackerSystem
tArgs={...} tHistory={} nHistory=0 tFiles={} sPath=tArgs[1] or "Apps/" nScroll=0 oldScroll=0 sFile=nil x=0 y=0 tMenu={" Rename "," Delete "," Open "," Edit "} function drawBrowser(sPath,bMode,selected) if fs.exists(sPath) and fs.isDir(sPath) then tFiles=fs.list(sPath) if #tFiles==0 then tFiles[1]="Folder is empty" end else tFiles={"Folder not found"} end if not bMode then for i=1,#tFiles do if tFiles[i] then if tFiles[i]:sub(1,1)=="." then table.remove(tFiles,i) end end end end if tHistory[#tHistory-1]~=sPath or tHistory[#tHistory]~=sPath then tHistory[#tHistory+1]=sPath nHistory=nHistory+1 end local function cleanHistory(tHistory) if tHistory[#tHistory]==tHistory[#tHistory-1] then table.remove(tHistory,#tHistory) nHistory=nHistory-1 cleanHistory(tHistory) end end cleanHistory(tHistory) if nHistory<1 then nHistory=1 end if nHistory>#tHistory then nHistory=#tHistory end term.clear(1) paintutils.drawFilledBox(1,1,Screen.Width,2,256) Draw.isVisible(true) Draw.setStatusColor(256) term.setCursorPos(2,1) if #sPath>Screen.Width-10 then sLocalPath=sPath:sub(1,Screen.Width-13).."..." else sLocalPath=sPath end term.blit(" < > "..sLocalPath.." ","888888888"..string.rep("8",#sLocalPath).."ff","000008880"..string.rep("0",#sLocalPath).."08") term.setCursorPos(3,1) if nHistory>1 and nHistory==#tHistory then term.blit("< > ","b08f","0008") elseif nHistory>1 and nHistory~=#tHistory then term.blit("< > ","b0bf","0008") elseif nHistory==1 and #tHistory>1 then term.blit("< > ","80bf","0008") end nSize=Screen.Height-5 term.setCursorPos(1,4) if nSize>#tFiles then nSize=#tFiles end for i=1,nSize do if tFiles[i+nScroll] then if fs.isDir(sPath..tFiles[i+nScroll]) then term.setCursorPos(1,3+i) term.write("_",1,16) else term.setCursorPos(1,3+i) term.write("_",1,256) end term.setCursorPos(2,i+3) if tFiles[i+nScroll]==selected then term.write(" "..tFiles[i+nScroll],2048,1) else term.write(" "..tFiles[i+nScroll],32768,1) end end end term.setCursorPos(Screen.Width/2-2,Screen.Height) term.write("Exit",256,1) end files=true drawBrowser(sPath) while files do tEvent={os.pullEventRaw()} if tEvent[1]=="mouse_click" then oldx,oldy=x,y x,y=tEvent[3],tEvent[4] if tEvent[2]==1 then if x==3 and y==1 then if nHistory~=1 then sPath=tHistory[nHistory-1] nHistory=nHistory-1 nScroll=0 drawBrowser(sPath) end elseif x>10 and x<=#sLocalPath+10 and y==1 then paintutils.drawLine(10,1,#sLocalPath+11,1,1) term.setCursorPos(11,1) term.write("",256,1) sPath=read(nil,tHistory) if sPath:sub(-1,-1)~="/" then sPath=sPath.."/" end drawBrowser(sPath) elseif x==5 and y==1 then if #tHistory>nHistory then sPath=tHistory[nHistory+1] nHistory=nHistory+1 nScroll=0 drawBrowser(sPath) end elseif y>=3 and (oldx~=x or oldy~=y) and y<Screen.Height then if tFiles[nScroll+y-3] then drawBrowser(sPath,nil,tFiles[nScroll+y-3]) selected=tFiles[nScroll+y-3] else selected=nil drawBrowser(sPath) end elseif y>=3 and oldx==x and oldy==y and y<Screen.Height then if tFiles[nScroll+y-3] then if fs.exists(sPath..tFiles[nScroll+y-3]) then if not fs.isDir(sPath..tFiles[nScroll+y-3]) then shell.run(sPath..tFiles[nScroll+y-3]) else sPath=sPath..tFiles[nScroll+y-3].."/" x=0 y=0 drawBrowser(sPath) end end end elseif y==Screen.Height and oldy==y then files=false end end elseif tEvent[1]=="mouse_scroll" then oldScroll=nScroll if tEvent[2]==1 then nScroll=nScroll+3 end if tEvent[2]==-1 then nScroll=nScroll-3 end if nScroll>#tFiles-Screen.Height+6 then nScroll=#tFiles-Screen.Height+6 end if nScroll<0 then nScroll=0 end if nScroll~=oldScroll then drawBrowser(sPath) end elseif tEvent[1]=="key" then --if tEvent[2]==keys.enter and selected then if not fs.isDir(selected) then files=false shell.run(selected) else sPath=sPath..selected drawBrowser(sPath) end end end end
--- @module Image local Buffer = require("public.buffer") local File = require("public.file") local Table = require("public.table") local T = Table.T local validExtensions = { png = true, jpg = true, } local Image = {} local loadedImages = T{} --- Attempts to load the specified image, reusing previously-loaded images. -- @param path string The path to an image -- @return number|boolean A buffer number, or `false` if it couldn't load the image. Image.load = function(path) if loadedImages[path] then return loadedImages[path] end local buffer = Buffer.get() local ret = gfx.loadimg(buffer, path) if ret > -1 then loadedImages[path] = buffer return buffer else error("Couldn't load image: " .. path) Buffer.release(buffer) end return false end --- Unloads an image, clearing and releasing its buffer -- @param path string The path that was used to load the image Image.unload = function(path) local buffer = loadedImages[path] if buffer then Buffer.release(buffer) gfx.setimgdim(buffer, -1, -1) loadedImages[path] = nil end end --- Checks if an image file can be loaded by Reaper -- @param path string The path to an image -- @return boolean Image.hasValidImageExtension = function(path) local ext = path:match("%.(.-)$") return validExtensions[ext] end --- Loads all of the valid images in a folder -- @param path string The path to a set of images -- @return hash An object of the form `{ path = path, images = {["/path/image.png"] = 4} }` Image.loadFolder = function(path) local folderTable = {path = path, images = T{}} for _, file in File.files(path) do if Image.hasValidImageExtension(file) then local buffer = Image.load(path.."/"..file) if buffer then folderTable.images[file] = buffer end end end return folderTable end --- Unloads all of the images in a given folder -- @param folderTable hash An object of the form `{ path = path, images = {["/path/image.png"] = 4} }`, -- as returned by `Image.loadFolder`. Image.unloadFolder = function(folderTable) for k in pairs(folderTable.images) do Image.unload(folderTable.path.."/"..k) end end --- Attemps to find the path associated with a given buffer -- @param buffer number A graphics buffer -- @return string|boolean Returns the image path if found, otherwise returns `nil`. Image.getPathFromBuffer = function(buffer) local path = loadedImages:find(function(v, k) return (v == buffer) and k end) if not path then error("Graphics buffer " .. buffer .. " has not been used by an image file.") end return path end return Image
--[[ File name: level.lua Description: calculate xp to level up, and other stuff Author: oldmilk --]] local module = {} local gui = require(game.ReplicatedStorage:WaitForChild("modules").client.gui) -- xpToLevelUp: compute how much exp the player needs to level up module.xpToLevelUp = function(currentLevel) -- thanks devfourm return math.round(100*(2.45^currentLevel)) end -- xpToLevels: convert the given xp into levels module.xpToLevels = function(xp, currentLevel) -- return value: --[[ { levels = 56, extraXp = 10 } --]] local xpToLevelUp = module.xpToLevelUp(currentLevel) local levels = 0 local extraXp = 0 end return module
package("mono") set_homepage("https://www.mono-project.com/") set_description("Cross platform, open source .NET development framework") set_urls("https://download.mono-project.com/sources/mono/mono-$(version).tar.xz", {version = function (version) return version:gsub("%+", ".") end}) add_versions("6.8.0+123", "e2e42d36e19f083fc0d82f6c02f7db80611d69767112af353df2f279744a2ac5") add_includedirs("include/mono-2.0") on_install("macosx", "linux", function (package) local configs = {"--disable-silent-rules", "--enable-nls=no"} import("package.tools.autoconf").install(package, configs) end) on_test(function (package) assert(package:has_cfuncs("mono_object_get_class", {includes = "mono/metadata/object.h"})) end)
local helper = require("optpack.lib.testlib.helper") local optpack = helper.require("optpack") describe("optpack.update()", function() local git_server lazy_setup(function() git_server = helper.git_server() git_server:create_repository("account1/test1", { "commit1", "commit2" }) git_server:create_repository("account2/test2", { "commit3", "commit4" }) end) lazy_teardown(function() git_server:teardown() end) before_each(helper.before_each) after_each(helper.after_each) it("installs plugins if directories do not exist", function() helper.set_packpath() optpack.add("account1/test1", { fetch = { base_url = git_server.url } }) optpack.add("account2/test2", { fetch = { base_url = git_server.url } }) local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() assert.exists_dir(helper.packpath_name .. "/pack/optpack/opt/test1") assert.exists_dir(helper.packpath_name .. "/pack/optpack/opt/test2") assert.window_count(2) assert.exists_pattern([[\v^\> Start updating\.$]]) assert.exists_pattern([[\v^test1 \> Installed\.$]]) assert.exists_pattern([[\v^test2 \> Installed\.$]]) assert.current_line([[> Finished updating.]]) end) it("updates plugins if directories exist", function() git_server.client:clone("account1/test1", helper.plugin_dir("test1")) git_server.client:reset_hard("HEAD~~", helper.plugin_dir("test1")) git_server.client:clone("account2/test2", helper.plugin_dir("test2")) helper.set_packpath() optpack.add("account1/test1", { fetch = { base_url = git_server.url } }) optpack.add("account2/test2", { fetch = { base_url = git_server.url } }) local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() assert.exists_pattern([[test1 > Updated.]]) assert.no.exists_pattern([[test2 > Updated.]]) end) it("can update plugins that are matched with pattern", function() git_server.client:clone("account1/test1", helper.plugin_dir("test1")) git_server.client:reset_hard("HEAD~~", helper.plugin_dir("test1")) git_server.client:clone("account2/test2", helper.plugin_dir("test2")) git_server.client:reset_hard("HEAD~~", helper.plugin_dir("test2")) helper.set_packpath() optpack.add("account1/test1", { fetch = { base_url = git_server.url } }) optpack.add("account2/test2", { fetch = { base_url = git_server.url } }) local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished, pattern = "test2" }) on_finished:wait() assert.no.exists_pattern([[test1 > Updated.]]) assert.exists_pattern([[test2 > Updated.]]) end) it("shows error if non-git repository directory exists", function() helper.create_plugin_dir("test1") helper.set_packpath() optpack.add("account1/test1", { fetch = { base_url = git_server.url } }) local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() assert.exists_pattern([[test1 > git --git-dir ]]) assert.exists_pattern([[test1 > fatal: not a git repository]]) end) it("does not raise an error event if output buffer already exists", function() do local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() end do local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() end assert.buffer_name("optpack://optpack-update") end) it("can set default option by optpack.set_default()", function() optpack.set_default({ install_or_update = { pattern = "invalid" } }) helper.set_packpath() optpack.add("account1/test1", { fetch = { base_url = git_server.url } }) local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() assert.no.exists_pattern([[test1 > Installed.]]) end) it("exexutes post_update hook", function() git_server.client:clone("account1/test1", helper.plugin_dir("test1")) git_server.client:reset_hard("HEAD~~", helper.plugin_dir("test1")) helper.set_packpath() local updated optpack.add("account1/test1", { fetch = { base_url = git_server.url }, hooks = { post_update = function(plugin) updated = plugin.name end, }, }) local on_finished = helper.on_finished() optpack.update({ on_finished = on_finished }) on_finished:wait() assert.equal("test1", updated) end) it("raises an error if pattern is invalid", function() optpack.update({ pattern = [[\(test]] }) assert.exists_message([[invalid pattern]]) end) end)
dofile("bignat.lua") --#pragma region utility local function expect(num, bytes) local nl = num.length assert(num.at(nl + 1) == nil) for i = 1, nl, 1 do local p = num.at(i) assert(p ~= nil) assert(p >= 0) assert(p < 256) end local expected_len = #bytes assert(nl == expected_len) for idx = 1, expected_len, 1 do local v = bytes[idx] local actual = num.at(idx) if actual ~= v then error("idx " .. idx .. " expected " .. v .. " got " .. actual) end end end --#pragma endregion --#pragma region common local zero = bignat(0) expect(zero, {}) local one = bignat(1) expect(one, {1}) local two = bignat(2) expect(two, {2}) local position_max = bignat(255) expect(position_max, {255}) local power_1 = bignat(256) expect(power_1, {0, 1}) --#pragma endregion --#pragma region addition do local r1 = zero + zero expect(r1, {}) local r2 = zero + one expect(r2, {1}) local r3 = one + zero expect(r3, {1}) local r4 = one + one expect(r4, {2}) local r5 = power_1 + power_1 expect(r5, {0, 2}) local r6 = position_max + one expect(r6, {0, 1}) local r7 = position_max + two expect(r7, {1, 1}) local r8 = power_1 + one expect(r8, {1, 1}) end --#pragma endregion --[[ local r1 = bignat(0) - bignat(0) assert(r1.length == 0) assert(zero.try_sub(bignat(1)) == nil) assert(one.try_sub(two) == nil) assert(one.try_sub(bignat(258)) == nil) --assert(one.try_sub(bignat(257)) == nil) --assert(one.try_sub(bignat(256)) == nil) local r2 = one - zero assert(r2.length == 1) assert(r2.at(1) == 1) local r3 = two - one assert(r3.length == 1) assert(r3.at(1) == 1) local r4 = power_1 - one assert(r4.length == 1) assert(r4.at(1) == 255) ]]
require 'torch' fg = {} require('factorgraph/src/Node') require('factorgraph/src/Variable') require('factorgraph/src/Factor') require('factorgraph/src/FactorGraph') return fg
local config = { {from = 1, to = 1644, itemId = 18394}, {from = 1645, to = 3189, itemId = 2158}, {from = 3190, to = 4725, itemId = 18391}, {from = 4726, to = 6225, itemId = 18414, count = 5}, {from = 6226, to = 7672, itemId = 18418, count = 10}, {from = 7673, to = 9083, itemId = 18413, count = 10}, {from = 9084, to = 9577, itemId = 2445}, {from = 9578, to = 9873, itemId = 8878}, {from = 9874, to = 9999, itemId = 18450} } function onUse(player, item, fromPosition, target, toPosition, isHotkey) if target.itemid ~= 18396 then return false end local chance, randomItem = math.random(9999) for i = 1, #config do randomItem = config[i] if chance >= randomItem.from and chance <= randomItem.to then if toPosition.x == CONTAINER_POSITION then target:getParent():addItem(randomItem.itemId, randomItem.count or 1, INDEX_WHEREEVER, FLAG_NOLIMIT) else Game.createItem(randomItem.itemId, randomItem.count or 1, toPosition) end target:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS) target:remove(1) item:remove(1) break end end return true end
local skynet = require "skynet" local log = require "chestnut.skynet.log" local service = require("service") local loader = require("sdataloader") local CMD = {} -- function CMD.start( ... ) -- -- body -- -- 更新数据 -- local config = AppConfig.new() -- if config:LoadFile() then -- for k,v in pairs(config.config) do -- builder.new(k, v) -- end -- return true -- end -- return false -- end -- function CMD.init_data() -- return true -- end -- function CMD.close( ... ) -- -- body -- return true -- end -- function CMD.kill( ... ) -- -- body -- skynet.exit() -- end function CMD.reload( ... ) -- body end service.init { init = function () loader() end, command = CMD }
local InventoryFunctions = require "util/inventoryfunctions" local function OnHungerDirty(inst) if inst._parent ~= nil and inst.currenthunger:value() == 0 then local item = ThePlayer.components.actioncontroller:GetItemFromCategory("FOOD") if item then InventoryFunctions:UseItemFromInvTile(item) end end end local function Init() if not ThePlayer or not ThePlayer.player_classified then return end ThePlayer.player_classified:ListenForEvent("hungerdirty", OnHungerDirty) end return Init
local FileSystemItem = require("FileSystemItem"); local FileSystem = {} setmetatable(FileSystem, { __call = function(self, ...) return self:create(...); end, }); local FileSystem_mt = { __index = FileSystem; } FileSystem.init = function(self, starting) local obj = { RootItem = FileSystemItem({Name = starting}); }; setmetatable(obj, FileSystem_mt); return obj; end FileSystem.create = function(self, starting) return self:init(starting); end FileSystem.getItem = function(self, pattern) for item in self.RootItem:items(pattern) do return item; end return nil; end FileSystem.getItems = function(self, pattern) return self.RootItem:items(pattern); end return FileSystem;
--------------------------------------------------------------------------------------------------- -- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md -- -- Description: Check that SDL provides appropriate display capabilities in `GetSystemCapability` response -- in case two Apps have different display capabilities -- -- Preconditions: -- 1) SDL and HMI are started -- 2) 2 Apps are registered -- 3) HMI provides different display capabilities data through `OnSystemCapabilityUpdated` notification to each App -- Steps: -- 1) Each App sends `GetSystemCapability` request to SDL for DISPLAYS capabilities -- SDL does: -- - proceed with request successfully -- - provide up-to-date corresponding DISPLAYS data to each App in response --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local common = require('test_scripts/WidgetSupport/common') --[[ Local Variables ]] local appParams = {} for i = 1, 2 do appParams[i] = common.getOnSystemCapabilityParams(i) local disCap = appParams[i].systemCapability.displayCapabilities[1] disCap.windowCapabilities[1].windowID = i end --[[ Local Functions ]] local function sendOnSCU(pAppId, pParams) local paramsToSDL = common.cloneTable(pParams) paramsToSDL.appID = common.getHMIAppId(pAppId) common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", paramsToSDL) common.getMobileSession(pAppId):ExpectNotification("OnSystemCapabilityUpdated", pParams) end local function sendGetSC(pAppId, pParams) local cid = common.getMobileSession(pAppId):SendRPC("GetSystemCapability", { systemCapabilityType = "DISPLAYS" }) common.getMobileSession(pAppId):ExpectResponse(cid, { success = true, resultCode = "SUCCESS", systemCapability = pParams.systemCapability }) end --[[ Scenario ]] common.Title("Precondition") common.Step("Clean environment and Back-up/update PPT", common.precondition) common.Step("Start SDL, HMI, connect Mobile, start Session", common.start) common.Step("App 1 registration", common.registerAppWOPTU, { 1 }) common.Step("App 2 registration", common.registerAppWOPTU, { 2 }) common.Step("SDL transfers OnSCU notification for 1st app", sendOnSCU, { 1, appParams[1] }) common.Step("SDL transfers OnSCU notification for 2nd app", sendOnSCU, { 2, appParams[2] }) common.Title("Test") common.Step("App 1 sends GetSC RPC for DISPLAYS", sendGetSC, { 1, appParams[1] }) common.Step("App 2 sends GetSC RPC for DISPLAYS", sendGetSC, { 2, appParams[2] }) common.Title("Postconditions") common.Step("Stop SDL, restore SDL settings and PPT", common.postcondition)
local rc = require("rc") local fs = require("filesystem") local shell = require("shell") local function loadConfig() local env = {} local result, reason = loadfile('/etc/rc.cfg', 't', env) if result then result, reason = xpcall(result, debug.traceback) if result then return env end end return nil, reason end local function saveConfig(conf) local file, reason = io.open('/etc/rc.cfg', 'w') if not file then return nil, reason end for key, value in pairs(conf) do file:write(tostring(key) .. " = " .. require("serialization").serialize(value) .. "\n") end file:close() return true end local function load(name, args) if rc.loaded[name] then return rc.loaded[name] end local fileName = fs.concat('/etc/rc.d/', name .. '.lua') local env = setmetatable({args = args}, {__index = _G}) local result, reason = loadfile(fileName, 't', env) if result then result, reason = xpcall(result, debug.traceback) if result then rc.loaded[name] = env return env end end return nil, reason end function rc.unload(name) rc.loaded[name] = nil end local function rawRunCommand(conf, name, cmd, args, ...) local result, what = load(name, args) if result then if not cmd then io.output():write("Commands for service " .. name .. "\n") for command, val in pairs(result) do if type(val) == "function" then io.output():write(tostring(command) .. " ") end end return true elseif type(result[cmd]) == "function" then result, what = xpcall(result[cmd], debug.traceback, ...) if result then return true end elseif cmd == "restart" and type(result["stop"]) == "function" and type(result["start"]) == "function" then result, what = xpcall(result["stop"], debug.traceback, ...) if result then result, what = xpcall(result["start"], debug.traceback, ...) if result then return true end end elseif cmd == "enable" then conf.enabled = conf.enabled or {} for _, _name in ipairs(conf.enabled) do if name == _name then return nil, "Service already enabled" end end conf.enabled[#conf.enabled + 1] = name return saveConfig(conf) elseif cmd == "disable" then conf.enabled = conf.enabled or {} for n, _name in ipairs(conf.enabled) do if name == _name then table.remove(conf.enabled, n) end end return saveConfig(conf) else what = "Command '" .. cmd .. "' not found in daemon '" .. name .. "'" end end return nil, what end local function runCommand(name, cmd, ...) local conf, reason = loadConfig() if not conf then return nil, reason end return rawRunCommand(conf, name, cmd, conf[name], ...) end local function allRunCommand(cmd, ...) local conf, reason = loadConfig() if not conf then return nil, reason end local results = {} for _, name in ipairs(conf.enabled or {}) do results[name] = table.pack(rawRunCommand(conf, name, cmd, conf[name], ...)) end return results end local args = table.pack(...) if #args == 0 then local results,reason = allRunCommand("start") if not results then local msg = "rc failed to start:"..tostring(reason) io.stderr:write(msg) require("event").onError(msg) return end for name, result in pairs(results) do local ok, reason = table.unpack(result) if not ok then io.stderr:write(reason .. "\n") end end else local result, reason = runCommand(table.unpack(args)) if not result then io.stderr:write(reason .. "\n") return 1 end end
--===========================================================================-- -- -- -- System.Collections.Proxy -- -- -- --===========================================================================-- --===========================================================================-- -- Author : [email protected] -- -- URL : http://github.com/kurapica/PLoop -- -- Create Date : 2016/02/28 -- -- Update Date : 2018/05/12 -- -- Version : 1.1.0 -- --===========================================================================-- PLoop(function(_ENV) import "System.Serialization" --- The safe dictionary, it'll create the object as proxy to the real table __Sealed__() __Serializable__() __Arguments__{ AnyType, AnyType }( Any, Any ) __NoNilValue__(false):AsInheritable() __NoRawSet__(false):AsInheritable() class "System.Collections.Proxy" (function (_ENV, keytype, valtype) extend "IDictionary" "ISerializable" local RAW_HOLDER = {} export { ipairs = ipairs, pairs = pairs, GetErrorMessage = Struct.GetErrorMessage, yield = coroutine.yield, List[keytype], List[valtype] } if keytype ~= Any then export { kvalid = getmetatable(keytype).ValidateValue, rawset = rawset } end if valtype ~= Any then export { vvalid = getmetatable(valtype).ValidateValue, rawset = rawset } end ----------------------------------------------------------- -- serialization -- ----------------------------------------------------------- function Serialize(self, info) local key = {} local val = {} local idx = 1 for k, v in self:GetIterator() do key[idx]= k val[idx]= v idx = idx + 1 end info:SetValue(1, List[keytype](key)) info:SetValue(2, List[valtype](val)) end __Arguments__{ SerializationInfo } function __new(_, info) local key = info:GetValue(1, List[keytype]) local val = info:GetValue(2, List[valtype]) return this(_, key, val) end ----------------------------------------------------------- -- method -- ----------------------------------------------------------- function GetIterator(self) return pairs(self[RAW_HOLDER]) end --- Update the dictionary if keytype == Any and valtype == Any then __Arguments__{ RawTable } function Update(self, dict) for k, v in pairs(dict) do self[RAW_HOLDER][k] = v end return self end __Arguments__{ IDictionary } function Update(self, dict) for k, v in dict:GetIterator() do self[RAW_HOLDER][k] = v end return self end __Arguments__{ Callable, System.Any/nil, System.Any/nil } function Update(self, iter, obj, idx) for k, v in iter, obj, idx do self[RAW_HOLDER][k] = v end return self end elseif keytype == Any and valtype ~= Any then __Arguments__{ RawTable } function Update(self, dict) for k, v in pairs(dict) do local ret, msg = vvalid(valtype, v, true) if not msg then self[RAW_HOLDER][k] = v end end return self end __Arguments__{ IDictionary } function Update(self, dict) for k, v in dict:GetIterator() do local ret, msg = vvalid(valtype, v, true) if not msg then self[RAW_HOLDER][k] = v end end return self end __Arguments__{ Callable, System.Any/nil, System.Any/nil } function Update(self, iter, obj, idx) for k, v in iter, obj, idx do local ret, msg = vvalid(valtype, v, true) if not msg then self[RAW_HOLDER][k] = v end end return self end elseif keytype ~= Any and valtype == Any then __Arguments__{ RawTable } function Update(self, dict) for k, v in pairs(dict) do local ret, msg = kvalid(keytype, k, true) if not msg then self[RAW_HOLDER][k] = v end end return self end __Arguments__{ IDictionary } function Update(self, dict) for k, v in dict:GetIterator() do local ret, msg = kvalid(keytype, k, true) if not msg then self[RAW_HOLDER][k] = v end end return self end __Arguments__{ Callable, System.Any/nil, System.Any/nil } function Update(self, iter, obj, idx) for k, v in iter, obj, idx do local ret, msg = kvalid(keytype, k, true) if not msg then self[RAW_HOLDER][k] = v end end return self end else __Arguments__{ RawTable } function Update(self, dict) for k, v in pairs(dict) do local ret, msg = kvalid(keytype, k, true) if not msg then ret, msg = vvalid(valtype, v, true) if not msg then self[RAW_HOLDER][k] = v end end end return self end __Arguments__{ IDictionary } function Update(self, dict) for k, v in dict:GetIterator() do local ret, msg = kvalid(keytype, k, true) if not msg then ret, msg = vvalid(valtype, v, true) if not msg then self[RAW_HOLDER][k] = v end end end return self end __Arguments__{ Callable, System.Any/nil, System.Any/nil } function Update(self, iter, obj, idx) for k, v in iter, obj, idx do local ret, msg = kvalid(keytype, k, true) if not msg then ret, msg = vvalid(valtype, v, true) if not msg then self[RAW_HOLDER][k] = v end end end return self end end ----------------------------------------------------------- -- property -- ----------------------------------------------------------- --- Gets or sets the value associated with the specified key __Indexer__(keytype ~= Any and keytype or nil) property "Item" { get = function(self, key) return self[RAW_HOLDER][key] end, set = function(self, key, value) self[RAW_HOLDER][key] = value end, type = valtype ~= Any and valtype or nil, } ----------------------------------------------------------- -- constructor -- ----------------------------------------------------------- __Arguments__{ } function __new() return { [RAW_HOLDER] = {} } end __Arguments__{ RawTable } function __new(_, dict) return { [RAW_HOLDER] = dict }, true end __Arguments__{ RawTable + IList, RawTable + IList } function __new(_, lstKey, lstValue) local dict = {} local iter, o, idx, value = (lstValue.GetIterator or ipairs)(lstValue) for _, key in (lstValue.GetIterator or ipairs)(lstKey) do idx, value = iter(o, idx) if idx then dict[key] = value else break end end return { [RAW_HOLDER] = dict }, true end __Arguments__{ IDictionary } function __new(_, dict) local dict = {} for key, value in dict:GetIterator() do dict[key] = value end return { [RAW_HOLDER] = dict }, true end __Arguments__{ Callable, Any/nil, Any/nil } function __new(_, iter, obj, idx) local dict = {} for key, value in iter, obj, idx do dict[key] = value end return { [RAW_HOLDER] = dict }, true end if keytype ~= Any and valtype ~= Any then function __ctor(self) local msg for k, v in self:GetIterator() do k, msg = kvalid(keytype, k) if msg then throw(GetErrorMessage(msg, "field")) end v, msg = vvalid(valtype, v) if msg then throw(GetErrorMessage(msg, "value")) end self[k]= v end end elseif keytype ~= Any then function __ctor(self) local msg for k, v in self:GetIterator() do k, msg = kvalid(keytype, k) if msg then throw(GetErrorMessage(msg, "field")) end end end elseif valtype ~= Any then function __ctor(self) local msg for k, v in self:GetIterator() do v, msg = vvalid(valtype, v) if msg then throw(GetErrorMessage(msg, "value")) end self[k]= v end end end ----------------------------------------------------------- -- meta-method -- ----------------------------------------------------------- if keytype ~= Any or valtype ~= Any then __Arguments__{ keytype, valtype } end function __newindex(self, key, val) self[RAW_HOLDER][key]= val end function __index(self, key) return self[RAW_HOLDER][key] end end) end)
local test_env = require("spec.util.test_env") local testing_paths = test_env.testing_paths test_env.unload_luarocks() test_env.setup_specs() local dir = require("luarocks.dir") describe("Luarocks dir test #unit", function() local runner setup(function() runner = require("luacov.runner") runner.init(testing_paths.testrun_dir .. "/luacov.config") runner.tick = true end) teardown(function() runner.shutdown() end) describe("dir.is_basic_protocol", function() it("checks whether the arguments represent a valid protocol and returns the result of the check", function() assert.truthy(dir.is_basic_protocol("http")) assert.truthy(dir.is_basic_protocol("https")) assert.truthy(dir.is_basic_protocol("ftp")) assert.truthy(dir.is_basic_protocol("file")) assert.falsy(dir.is_basic_protocol("git")) assert.falsy(dir.is_basic_protocol("git+https")) assert.falsy(dir.is_basic_protocol("invalid")) end) end) describe("dir.deduce_base_dir", function() assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3.zip")) assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.zip")) assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.gz")) assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.bz2")) assert.are.same("parser.moon", dir.deduce_base_dir("git://example.com/Cirru/parser.moon")) assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3")) end) end)
---@class CS.UnityEngine.AssetBundleCreateRequest : CS.UnityEngine.AsyncOperation ---@field public assetBundle CS.UnityEngine.AssetBundle ---@type CS.UnityEngine.AssetBundleCreateRequest CS.UnityEngine.AssetBundleCreateRequest = { } ---@return CS.UnityEngine.AssetBundleCreateRequest function CS.UnityEngine.AssetBundleCreateRequest.New() end return CS.UnityEngine.AssetBundleCreateRequest
local util = require 'lspconfig.util' local bin_name = 'clarity-lsp' if vim.fn.has 'win32' == 1 then bin_name = bin_name .. '.cmd' end return { default_config = { cmd = { bin_name }, filetypes = { 'clar', 'clarity' }, root_dir = util.root_pattern '.git', }, docs = { description = [[ `clarity-lsp` is a language server for the Clarity language. Clarity is a decidable smart contract language that optimizes for predictability and security. Smart contracts allow developers to encode essential business logic on a blockchain. To learn how to configure the clarity language server, see the [clarity-lsp documentation](https://github.com/hirosystems/clarity-lsp). ]], default_config = { root_dir = [[root_pattern(".git")]], }, }, }
local State = require('state') local Type = require('type') local dom = select(1, ...) local Project = Type.declare('Project', State) --- -- Instantiate a new project configuration helper. -- -- @param state -- The project configuration state. -- @returns -- A new project helper instance. --- function Project.new(state) local prj = Type.assign(Project, state) local name = state.projects[1] prj.name = name prj.filename = prj.filename or name prj.location = prj.location or prj.baseDir or os.getCwd() return prj end --- -- Retrieve the configurations contained by this project. -- -- @param createCallback -- A function with signature `(project, build, platform)` which will be called for -- each build/platform pair found in the project. Return a new `dom.Config` to represent -- the configuration, or `nil` to ignore it. -- @returns -- An array of `dom.Config`. --- function Project.fetchConfigs(self, createCallback) local configs = {} local selectors = dom.Config.fetchConfigPlatformPairs(self) for i = 1, #selectors do local selector = selectors[i] local cfg = createCallback(self, selector.configurations, selector.platforms) configs[i] = cfg configs[cfg.name] = cfg end return configs end return Project
EnemyStatusType = {} EnemyStatusType.Null = "NULL" EnemyStatusType.Alive = "ALIVE" EnemyStatusType.Dead = "DEAD" return EnemyStatusType
local kris = Cutscene.getCharacter("kris") local susie = Cutscene.getCharacter("susie") local ralsei = Cutscene.getCharacter("ralsei") if ralsei then Cutscene.text("* The power of [color:pink]test\ndialogue[color:reset] shines within\nyou.", "starwalker") Cutscene.wait(0.5) Cutscene.text("* Oh [color:red]Fuck[color:reset] it's a bomb") Cutscene.detachCamera() Cutscene.detachFollowers() Cutscene.setSprite(ralsei, "world/dark/up", 1/15) Cutscene.setSpeaker("ralsei") Cutscene.text("* Kris, Susie, look out!!!", "face_23") susie.sprite:set("world/dark/shock_r") --Cutscene.setSprite(susie, "world/dark/shock_r") Cutscene.slideTo(susie, susie.x - 40, susie.y, 8) Cutscene.slideTo(ralsei, kris.x, kris.y, 12) Cutscene.wait(0.2) Cutscene.look(kris, "right") Cutscene.slideTo(kris, kris.x - 40, kris.y, 8) Cutscene.wait(0.3) ralsei:explode() Cutscene.shakeCamera(8) Cutscene.wait(2) Cutscene.text("* Yo what the fuck", "face_15", "susie") Cutscene.wait(2) Cutscene.setSprite(susie, "world/dark") Cutscene.alignFollowers("up") Cutscene.attachFollowers() Cutscene.attachCamera() else Cutscene.text("", "face_15", "susie") end
if not modules then modules = { } end modules ['cldf-bas'] = { version = 1.001, comment = "companion to cldf-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -- -- speedtest needed: -- -- local flush, writer = context.getlogger() -- -- trackers.register("context.trace",function(v) -- flush, writer = context.getlogger() -- end) -- -- function context.bgroup() -- flush(ctxcatcodes,"{") -- end -- -- function context.egroup() -- flush(ctxcatcodes,"}") -- end local tonumber = tonumber local type = type local format = string.format local utfchar = utf.char local concat = table.concat local context = context local ctxcore = context.core local variables = interfaces.variables local nodepool = nodes.pool local new_rule = nodepool.rule local new_glyph = nodepool.glyph local current_attr = nodes.current_attr local current_font = font.current local texgetcount = tex.getcount local texsetcount = tex.setcount -- a set of basic fast ones function context.char(k) -- used as escape too, so don't change to utf if type(k) == "table" then local n = #k if n == 1 then context([[\char%s\relax]],k[1]) elseif n > 0 then context([[\char%s\relax]],concat(k,[[\relax\char]])) end else if type(k) == "string" then k = tonumber(k) end if type(k) == "number" then context([[\char%s\relax]],k) end end end function context.utfchar(k) if type(k) == "string" then k = tonumber(k) end if type(k) == "number" then context(utfchar(k)) end end function context.rule(w,h,d,dir) local rule if type(w) == "table" then rule = new_rule(w.width,w.height,w.depth,w.dir) else rule = new_rule(w,h,d,dir) end rule.attr = current_attr() context(rule) end function context.glyph(id,k) if id then if not k then id, k = current_font(), id end local glyph = new_glyph(id,k) glyph.attr = current_attr() context(glyph) end end local function ctx_par () context("\\par") end local function ctx_space() context("\\space") end context.par = ctx_par context.space = ctx_space ctxcore.par = ctx_par ctxcore.space = ctx_space local function ctx_bgroup() context("{") end local function ctx_egroup() context("}") end context.bgroup = ctx_bgroup context.egroup = ctx_egroup ctxcore.bgroup = ctx_bgroup ctxcore.egroup = ctx_egroup -- not yet used ... but will get variant at the tex end as well local function setboxregister(kind,n) context(type(n) == "number" and [[\setbox%s\%s]] or [[\setbox\%s\%s]],n,kind) end function ctxcore.sethboxregister(n) setboxregister("hbox",n) end function ctxcore.setvboxregister(n) setboxregister("vbox",n) end function ctxcore.setvtopregister(n) setboxregister("vtop",n) end local function startboxregister(kind,n) context(type(n) == "number" and [[\setbox%s\%s{]] or [[\setbox\%s\%s{]],n,kind) end function ctxcore.starthboxregister(n) startboxregister("hbox",n) end function ctxcore.startvboxregister(n) startboxregister("vbox",n) end function ctxcore.startvtopregister(n) startboxregister("vtop",n) end ctxcore.stophboxregister = ctx_egroup ctxcore.stopvboxregister = ctx_egroup ctxcore.stopvtopregister = ctx_egroup function ctxcore.flushboxregister(n) context(type(n) == "number" and [[\box%s ]] or [[\box\%s]],n) end function ctxcore.beginhbox() context([[\hbox{]]) end function ctxcore.beginvbox() context([[\vbox{]]) end function ctxcore.beginvtop() context([[\vtop{]]) end ctxcore.endhbox = ctx_egroup ctxcore.endvbox = ctx_egroup ctxcore.endvtop = ctx_egroup local function allocate(name,what,cmd) local a = format("c_syst_last_allocated_%s",what) local n = texgetcount(a) + 1 if n <= texgetcount("c_syst_max_allocated_register") then texsetcount(a,n) end context("\\global\\expandafter\\%sdef\\csname %s\\endcsname %s\\relax",cmd or what,name,n) return n end context.registers = { -- the number is available directly, the csname after the lua call newdimen = function(name) return allocate(name,"dimen") end, newskip = function(name) return allocate(name,"skip") end, newcount = function(name) return allocate(name,"count") end, newmuskip = function(name) return allocate(name,"muskip") end, newtoks = function(name) return allocate(name,"toks") end, newbox = function(name) return allocate(name,"box","mathchar") end, -- not really a register but kind of belongs here newchar = function(name,u) context([[\chardef\%s=%s\relax]],name,u) end, }
local random = math.random local insert, remove, sort, concat = table.insert, table.remove, table.sort, table.concat local gmatch, match, byte, char = string.gmatch, string.match, string.byte, string.char local format, rep, find, sub = string.format, string.rep, string.find, string.sub local min, max = math.min, math.max local ceil, floor = math.ceil, math.floor -- globals -- function _G.printf(fmt, ...) return print(format(fmt, ...)) end -- table -- function table.count(tbl) local n = 0 for _ in pairs(tbl) do n = n + 1 end return n end function table.deepcount(tbl) local n = 0 for _, v in pairs(tbl) do n = type(v) == 'table' and n + table.deepcount(v) or n + 1 end return n end function table.find(tbl, value) for k, v in pairs(tbl) do if v == value then return k end end end function table.reverse(tbl) for i = 1, #tbl do insert(tbl, i, remove(tbl)) end end function table.reversed(tbl) local ret = {} for i = #tbl, 1, -1 do insert(ret, tbl[i]) end return ret end function table.copy(tbl) local new = {} for k, v in pairs(tbl) do new[k] = v end return new end function table.deepcopy(tbl) local new = {} for k, v in pairs(tbl) do new[k] = type(v) == 'table' and table.deepcopy(v) or v end return new end function table.keys(tbl) local keys = {} for k in pairs(tbl) do insert(keys, k) end return keys end function table.values(tbl) local values = {} for _, v in pairs(tbl) do insert(values, v) end return values end function table.hash(tbl, key) for i, v in ipairs(tbl) do tbl[v[key]] = v tbl[i] = nil end end function table.randomipair(tbl) local i = random(#tbl) return i, tbl[i] end function table.randompair(tbl) local rand = random(table.count(tbl)) local n = 0 for k, v in pairs(tbl) do n = n + 1 if n == rand then return k, v end end end function table.sorted(tbl, fn) local ret = {} for i, v in ipairs(tbl) do ret[i] = v end sort(ret, fn) return ret end function table.transposed(tbl) local ret = {} for _, row in ipairs(tbl) do for i, element in ipairs(row) do local column = ret[i] or {} insert(column, element) ret[i] = column end end return ret end function table.slice(tbl, start, stop, step) local ret = {} for i = start or 1, stop or #tbl, step or 1 do insert(ret, tbl[i]) end return ret end -- string -- function string.split(str, delim) if delim and delim ~= '' then local words = {} for word in gmatch(str .. delim, '(.-)' .. delim) do insert(words, word) end return words else local chars = {} for char in gmatch(str, '.') do insert(chars, char) end return chars end end function string.split2(str, delim) if (not str) or (not delim) or str == "" or delim == "" then return {} else local current = 1 local result = { } while true do local start, finish = find(str, delim, current) if start and finish then insert(result, sub(str, current, start-1)) current = finish + 1 else break end end insert(result, sub(str, current)) return result end end function string.trim(str) return match(str, '^%s*(.-)%s*$') end function string.padleft(str, len, pattern) pattern = pattern or ' ' return rep(pattern, len - #str) .. str end function string.padright(str, len, pattern) pattern = pattern or ' ' return str .. rep(pattern, len - #str) end function string.padcenter(str, len, pattern) pattern = pattern or ' ' local pad = 0.5 * (len - #str) return rep(pattern, floor(pad)) .. str .. rep(pattern, ceil(pad)) end function string.startswith(str, pattern, plain) local start = 1 return find(str, pattern, start, plain) == start end function string.endswith(str, pattern, plain) local start = #str - #pattern + 1 return find(str, pattern, start, plain) == start end function string.levenshtein(str1, str2) if str1 == str2 then return 0 end local len1 = #str1 local len2 = #str2 if len1 == 0 then return len2 elseif len2 == 0 then return len1 end local matrix = {} for i = 0, len1 do matrix[i] = {[0] = i} end for j = 0, len2 do matrix[0][j] = j end for i = 1, len1 do for j = 1, len2 do local cost = byte(str1, i) == byte(str2, j) and 0 or 1 matrix[i][j] = min(matrix[i-1][j] + 1, matrix[i][j-1] + 1, matrix[i-1][j-1] + cost) end end return matrix[len1][len2] end function string.random(len, minValue, maxValue) local ret = {} minValue = minValue or 0 maxValue = maxValue or 255 for _ = 1, len do insert(ret, char(random(minValue, maxValue))) end return concat(ret) end -- math -- function math.clamp(n, minValue, maxValue) return min(max(n, minValue), maxValue) end function math.round(n, i) local m = 10 ^ (i or 0) return floor(n * m + 0.5) / m end
local classes = {} classes.collider = libs.class{ init = function(self, width, height, isTrigger) self.isTrigger = isTrigger or false self.width = width self.height = height end } classes.item = libs.class{ init = function(self, name, description, sprite) self.name = name self.description = description self.sprite = sprite end } return classes
local Object = require "modules.classic" local enemy = Object:extend() function enemy:new(x, y, w, h) self.x = x or math.random(0, 14) * 50 self.y = y or -100 self.w = w or 100 self.h = h or 200 self.speed = 40 self.health = 2 self.score = 1 end function enemy:update(dt) self.x = self.x + math.random(-1, 1) * math.random() self.y = self.y + self.speed * dt end function enemy:draw() love.graphics.setColor(1,1,1) love.graphics.rectangle('line', self.x, self.y, self.w, self.h) end function enemy:damage(d) local damage = d or 1 self.health = self.health - damage return self.health end return enemy
#!lua solution "rae_compiler" configurations { "Debug", "Release" } platforms {"native", "x64", "x32"} project "raec" kind "ConsoleApp" language "C++" targetdir "../bin" -- set to parent dir so that XCode will not bother with it's own build dirs. files { "./src/*.hpp", "./src/*.cpp" } includedirs { "src" } configuration { "windows" } defines { "_CRT_SECURE_NO_DEPRECATE" } -- to use fopen on windows without warnings. configuration "Debug" defines { "DEBUG" } flags { "Symbols" } debugdir "../bin" configuration "Release" defines { "NDEBUG" } flags { "Optimize" } debugdir "../bin"
---@type string local Name = ... ---@type Addon local Addon = select(2, ...) local Comm, Item, Unit, Util = Addon.Comm, Addon.Item, Addon.Unit, Addon.Util ---@class Inspect : Module local Self = Addon.Inspect -- How long before refreshing cache entries (s) Self.REFRESH = 1800 -- How long before checking for requeues Self.QUEUE_DELAY = 60 -- How long between two inspect requests Self.INSPECT_DELAY = 2 -- How many tries per char Self.MAX_PER_CHAR = 10 -- We are not interested in those slots Self.IGNORE = {Item.TYPE_BODY, Item.TYPE_HOLDABLE, Item.TYPE_TABARD, Item.TYPE_RANGEDRIGHT, Item.TYPE_THROWN} Self.cache = {} Self.queue = {} Self.lastQueued = 0 ------------------------------------------------------- -- Read cache -- ------------------------------------------------------- -- Get ivl for given unit and location ---@param unit string ---@param location string ---@return integer function Self.GetLevel(unit, location) return Self.cache[unit] and Self.cache[unit].levels[Item.GetCacheLocation(location)] or 0 end -- Get link(s) for given unit and slot ---@param unit string ---@param slot string ---@return string function Self.GetLink(unit, slot) return Self.cache[unit] and Self.cache[unit].links[slot] or nil end -- Check if an entry exists and isn't out-of-date ---@param unit string function Self.IsValid(unit) return Self.cache[unit] and Self.cache[unit].time + Self.REFRESH > GetTime() end ------------------------------------------------------- -- Update cache -- ------------------------------------------------------- -- Update the cache entry for the given player function Self.Update(unit) unit = Unit.Name(unit) local info = Self.cache[unit] or Util.Tbl.Hash("levels", Util.Tbl.New(), "links", Util.Tbl.New()) local isValid = Self.IsValid(unit) -- Remember when we did this info.time = GetTime() -- Equipped items for equipLoc,slots in pairs(Item.SLOTS) do if not Util.In(equipLoc, Self.IGNORE) then local slotMin for i,slot in pairs(slots) do if GetInventoryItemTexture(unit, slot) then local link = GetInventoryItemLink(unit, slot) or isValid and info.links[slot] if link then info.links[slot] = link if slotMin ~= false then local lvl = Item.GetInfo(link, "quality") == Enum.ItemQuality.Legendary and 0 or Item.GetInfo(link, "maxLevel", unit) slotMin = lvl and min(slotMin or lvl, lvl) or false end else info.links[slot] = false slotMin = false end else info.links[slot] = nil slotMin = slotMin ~= false and 0 or false end end -- Only set it if we got links for all slots equipLoc = Item.GetCacheLocation(equipLoc) if slotMin then info.levels[equipLoc] = max(0, info.levels[equipLoc] or 0, slotMin) elseif not (isValid and info.levels[equipLoc]) then info.levels[equipLoc] = false end end end -- Equipped relics local weapon = Item.GetEquippedArtifact(unit) local relics = weapon and weapon:GetRelicSlots() local uniqueTypes = weapon and weapon:GetRelicSlots(true) if relics and uniqueTypes then relics, uniqueTypes = Util.Tbl.GroupKeys(relics), Util.Tbl.Flip(uniqueTypes) for relicType,slots in pairs(relics) do local slotMin local links = Util.Tbl.New() local isUnique = uniqueTypes[relicType] for i,slot in pairs(slots) do local link = weapon:GetGem(slot) if link then tinsert(links, link) if isUnique and slotMin ~= false then local lvl = Item.GetInfo(link, "realLevel", unit) slotMin = lvl and min(slotMin or lvl, lvl) or false end elseif isUnique then slotMin = false end end -- Only set it if we got links for all slots if slotMin then info.levels[relicType] = max(0, info.levels[relicType] or 0, slotMin) elseif isUnique and not (isValid and info.levels[relicType]) then info.levels[relicType] = false elseif not info.levels[relicType] then info.levels[relicType] = nil end -- Handle links if not info.links[relicType] then info.links[relicType] = links else if slotMin or not isValid or #info.links[relicType] < #links then wipe(info.links[relicType]) Util.Tbl.Merge(info.links[relicType], links) end Util.Tbl.Release(links) end end end Util.Tbl.Release(1, weapon, relics, uniqueTypes) -- Check if the inspect was successfull local failed = Util.Tbl.CountOnly(info.levels, false) + Util.Tbl.CountOnly(info.links, false) > 0 local inspectsLeft = Self.queue[unit] or Self.MAX_PER_CHAR -- Update cache and queue entries Self.cache[unit] = info Self.queue[unit] = failed and inspectsLeft > 1 and inspectsLeft - 1 or nil end -- Clear everything and stop tracking for one or all players ---@param unit string function Self.Clear(unit) if unit then Util.Tbl.Release(true, Self.cache[unit]) Self.cache[unit] = nil Self.queue[unit] = nil else Self.lastQueued = 0 Util.Tbl.Release(true, unpack(Self.cache)) wipe(Self.cache) wipe(Self.queue) end end -- Queue a unit or the entire group for inspection ---@param unit string function Self.Queue(unit) unit = Unit.Name(unit) if not Addon:IsTracking() then return end if unit then Self.queue[unit] = Self.queue[unit] or Self.MAX_PER_CHAR elseif IsInGroup() then -- Queue all group members with missing or out-of-date cache entries local allFound = true for i=1,GetNumGroupMembers() do unit = GetRaidRosterInfo(i) if not unit then allFound = false elseif not (Self.IsValid(unit) or Self.queue[unit]) then Self.queue[unit] = Self.MAX_PER_CHAR end end if allFound then Self.lastQueued = GetTime() end end end -- Start the inspection loop local filterFn = function (i, unit) return CanInspect(unit) end function Self.Loop() -- Check if the loop is already running if Addon:TimerIsRunning(Self.timer) then return end -- Queue new units to inspect if Self.lastQueued + Self.QUEUE_DELAY <= GetTime() then Self.Queue() end -- Get the next unit to inspect (with max inspects left -> wide search, random -> so we don't get stuck on one unit) local units = Util.Tbl.CopyFilter(Self.queue, filterFn, true, nil, true) local unit = next(units) and Util(units):Only(Util.Tbl.Max(units), true):RandomKey()() if unit then Self.target = unit NotifyInspect(unit) end local delay = max(Self.INSPECT_DELAY, Util.Tbl.Count(Self.queue) == 0 and Self.QUEUE_DELAY - (GetTime() - Self.lastQueued) or 0) Self.timer = Addon:ScheduleTimer(Self.Loop, delay) end -- Check if we should start the loop, and then start it function Self.Start() local timerIsRunning = Addon:TimerIsRunning(Self.timer) local delayHasPassed = Self.timer and GetTime() - (Self.timer.ends - Self.timer.delay) > Self.INSPECT_DELAY if Addon:IsTracking() and (not timerIsRunning or delayHasPassed) then Self.Stop() Self.Loop() end end -- Stop the inspection loop function Self.Stop() if Self.timer then Addon:CancelTimer(Self.timer) Self.timer = nil end end ------------------------------------------------------- -- Events/Hooks -- ------------------------------------------------------- function Self:OnEnable() -- Register events Self:RegisterEvent("ENCOUNTER_START", Self.Stop) Self:RegisterEvent("ENCOUNTER_END", Self.Start) Self:RegisterEvent("PARTY_MEMBER_ENABLE") Self:RegisterEvent("INSPECT_READY") Self:RegisterEvent("CHAT_MSG_SYSTEM") Self:RegisterMessage(Addon.EVENT_ACTIVE_CHANGE, "ACTIVE_CHANGE") Self:RegisterMessage(Addon.EVENT_TRACKING_CHANGE, "TRACKING_CHANGE") -- IsInGroup doesn't work correctly right after logging in, so check again a few seconds later if not Self.timer then Self:ScheduleTimer(Self.Start, 10) end end ---@param unit string function Self:PARTY_MEMBER_ENABLE(_, unit) if Addon:IsTracking() then Self.Queue(unit) end end ---@param guid string function Self:INSPECT_READY(_, guid) local _, _, _, _, _, name, realm = GetPlayerInfoByGUID(guid) local unit = realm and realm ~= "" and name .. "-" .. realm or name -- Inspect the unit if unit == Self.target then if Self.queue[unit] and Unit.InGroup(unit) then Self.Update(unit) end ClearInspectPlayer() Self.target = nil end -- Extend a running loop timer if Addon:TimerIsRunning(Self.timer) then Self.timer = Addon:ExtendTimerTo(Self.timer, Self.INSPECT_DELAY) end end ---@param msg string function Self:CHAT_MSG_SYSTEM(_, msg) if not Addon:IsTracking() then return end -- Check if a player joined the group/raid for _,pattern in pairs(Comm.PATTERNS_JOINED) do local unit = msg:match(pattern) if unit then -- Queue inspection Self.Queue(unit) return end end -- Check if a player left the group/raid for _,pattern in pairs(Comm.PATTERNS_LEFT) do local unit = msg:match(pattern) if unit then -- Clear inspect cache Self.Clear(unit) end end end ---@param active boolean function Self:ACTIVE_CHANGE(active) if not active then Self.Clear() end end ---@param tracking boolean function Self:TRACKING_CHANGE(tracking) if tracking then Self.Queue() Self.Start() else Self.Stop() end end
include = { "$", ".+$", }
SCRIPT_TITLE = "RV Shift Notes & Params" paramTypeNames = { "pitchDelta", "vibratoEnv", "loudness", "tension", "breathiness", "voicing", "gender", "toneShift" } local inputForm = { title = SV:T("Shift Notes & Params"), message = SV:T("Workaround for the \"many notes with params shifting crash\"\nshifts everything between 1st and last note selected"), buttons = "OkCancel", widgets = { { name = "cbDirection", type = "ComboBox", label = "Direction", choices = {"Forward", "Backward"}, default = 0 }, { name = "cbUnit", type = "ComboBox", label = "Unit", choices = {"Measure (at 1st note)", "Quarter", "Time (sec)"}, default = 0 }, { name = "slAmount", type = "Slider", label = "How much to shift", format = "%1.0f", minValue = 0, maxValue = 16, interval = 1, default = 0 }, { name = "tbAmount", type = "TextBox", label = "How much to shift (can use floating point numbers)", default = "0" } } } function getClientInfo() return { name = SV:T(SCRIPT_TITLE), author = "[email protected]", category = "Real Voice", versionNumber = 2, minEditorVersion = 65537 } end function process() local timeAxis = SV:getProject():getTimeAxis() local scope = SV:getMainEditor():getCurrentGroup() local group = scope:getTarget() -- determine start and end time local minTime_b, maxTime_b = math.huge, 0 local noteCnt = group:getNumNotes() if noteCnt == 0 then -- no notes in track return else local selection = SV:getMainEditor():getSelection() local selectedNotes = selection:getSelectedNotes() if #selectedNotes == 0 then SV:showMessageBox(SV:T("Nothing selected"), SV:T("Select notes to shift (only a start and end note is enough)")) return else table.sort(selectedNotes, function(noteA, noteB) return noteA:getOnset() < noteB:getOnset() end) for _, note in ipairs(selectedNotes) do local onset_b, nend_b = note:getOnset(), note:getEnd() if onset_b < minTime_b then minTime_b = onset_b end if nend_b > maxTime_b then maxTime_b = nend_b end end end end assert(maxTime_b > minTime_b) -- list of notes to shift local notes = {} for i = 1, group:getNumNotes() do local note = group:getNote(i) local onset_b, nend_b = note:getOnset(), note:getEnd() if nend_b > minTime_b and onset_b < maxTime_b then table.insert(notes, note) end end inputForm.title = inputForm.title.." ("..#notes.." notes)" -- show dialog local dlgResult = SV:showCustomDialog(inputForm) local amount = tonumber(dlgResult.answers.tbAmount) local amountSlider = tonumber(dlgResult.answers.slAmount) if not dlgResult.status or (amount + amountSlider) == 0 then return end -- cancel pressed or no shift local direction = 1 - 2 * dlgResult.answers.cbDirection -- 1 forward, -1 backward amount = (amount + amountSlider) * direction local timeConvert, shift = false, 0 local unit = dlgResult.answers.cbUnit local shift = 0 if unit == 0 then local measure = timeAxis:getMeasureMarkAtBlick(minTime_b) shift = measure.numerator / measure.denominator * 4 * SV.QUARTER * amount -- in blicks elseif unit == 1 then shift = SV.QUARTER * amount else timeConvert = true end -- do the shift for _, note in ipairs(notes) do local onset_b = note:getOnset() local newOnset_b = onset_b if timeConvert then local onset = timeAxis:getSecondsFromBlick(onset_b) newOnset_b = timeAxis:getBlickFromSeconds(onset + amount) else newOnset_b = onset_b + shift end if newOnset_b < 0 then SV:showMessageBox("Error!", "You are about to move notes before zero time!\nFirst make a room by selecting all notes and shifting them forward.") return end note:setOnset(newOnset_b) end -- correction of short pauses and overlap due to rounding if timeConvert then for _, note in ipairs(notes) do local onset_b = note:getOnset() local ni = note:getIndexInParent() local nextNote = group:getNote(ni + 1) if nextNote then if math.abs(nextNote:getOnset() - note:getEnd()) <= 1 then note:setDuration(nextNote:getOnset() - note:getOnset()) end end end end for _, par in ipairs(paramTypeNames) do local am = group:getParameter(par) -- automation track -- save points to list local points = am:getPoints(minTime_b, maxTime_b) -- add boundary points local startval = am:get(minTime_b) table.insert(points, 1, {minTime_b, startval}) local endval = am:get(maxTime_b) table.insert(points, {maxTime_b, endval}) -- remove from track and add boundaries back am:remove(minTime_b, maxTime_b) am:add(minTime_b, startval) am:add(maxTime_b, endval) -- target times local newStartTime_b, newEndTime_b if timeConvert then local minTime = timeAxis:getSecondsFromBlick(minTime_b) newStartTime_b = timeAxis:getBlickFromSeconds(minTime + amount) local maxTime = timeAxis:getSecondsFromBlick(maxTime_b) newEndTime_b = timeAxis:getBlickFromSeconds(maxTime + amount) else newStartTime_b, newEndTime_b = minTime_b + shift, maxTime_b + shift end startval = am:get(newStartTime_b - 1) endval = am:get(newEndTime_b + 1) am:remove(newStartTime_b, newEndTime_b) if amount < 0 or (amount > 0 and newStartTime_b > maxTime_b) then am:add(newStartTime_b - 1, startval) end if amount > 0 or (amount < 0 and newEndTime_b < minTime_b) then am:add(newEndTime_b + 1, endval) end -- place points for _, pt in ipairs(points) do if timeConvert then local onset = timeAxis:getSecondsFromBlick(pt[1]) am:add(timeAxis:getBlickFromSeconds(onset + amount), pt[2]) else am:add(pt[1] + shift, pt[2]) end end end end function main() process() SV:finish() end
love.window.setTitle "Volk"; love.graphics.setDefaultFilter("nearest","nearest") love.graphics.setNewFont(40) love.window.setFullscreen(false) love.window.setMode(0,0,{resizable=false}) love.window.setMode(1920,1440,{resizable = false}) width, height = 320, 200 -- can change up to 640, 600 if feel like it function sratio() return wratio(), hratio() end function wratio() return love.graphics.getWidth()/width end function hratio() return love.graphics.getHeight()/height end
-------------------------------------------------------------------------------- -- Access control and session management -------------------------------------------------------------------------------- function onToggleConfigurationPanel(enabled) if enabled then openBootloaderWindow() requestBootloaderResourceDataList() else closeBootloaderWindow() end end addEvent("Bootloader.toggleConfigurationPanel", true) addEventHandler("Bootloader.toggleConfigurationPanel", resourceRoot, onToggleConfigurationPanel, false) -------------------------------------------------------------------------------- -- Data stream events -------------------------------------------------------------------------------- function requestBootloaderResourceDataList() preBootloaderResourceDataListRequest() triggerServerEvent("BootloaderClient.requestResourceDataList", resourceRoot) end function handleBootloaderResourceDataListBatch(resourceDataBatch) processBootloaderResourceDataBatch(resourceDataBatch) end addEvent("Bootloader.resourceDataListBatch", true) addEventHandler("Bootloader.resourceDataListBatch", resourceRoot, handleBootloaderResourceDataListBatch, false) function handleBootloaderResourceDataListComplete() completeBootloaderResourceDataBatch() end addEvent("Bootloader.resourceDataListComplete", true) addEventHandler("Bootloader.resourceDataListComplete", resourceRoot, handleBootloaderResourceDataListComplete, false) function requestBootloaderResourceToggle(resourceName, enabled) triggerServerEvent("BootloaderClient.toggleBootloaderResource", resourceRoot, resourceName, enabled) end function handleBootloaderResourceDataResponse(resourceName, isEnabled, isRunning) processBootloaderResourceData(resourceName, isEnabled, isRunning) end addEvent("Bootloader.resourceDataResponse", true) addEventHandler("Bootloader.resourceDataResponse", resourceRoot, handleBootloaderResourceDataResponse, false) -------------------------------------------------------------------------------- -- Graphical User Interface -------------------------------------------------------------------------------- local gui = {} local minimumWindowWidth = 400 local minimumWindowHeight = 400 local windowTitle = "Bootloader Configuration" function openBootloaderWindow() if gui.window ~= nil then return end gui.width = 600 gui.height = 600 gui.rows = {} gui.checkboxes = {} gui.resources = {} local innerWidth = gui.width - 20 local screenWidth, screenHeight = guiGetScreenSize() local posX = (screenWidth - gui.width) / 2 local posY = (screenHeight - gui.height) / 2 gui.window = guiCreateWindow(posX, posY, gui.width, gui.height, windowTitle, false) addEventHandler("onClientGUISize", gui.window, onBootloaderWindowResize, false) local function createHeader(x, y, text) local label = guiCreateLabel(x, y, 100, 15, text, false, gui.window) guiLabelSetColor(label, 160, 160, 192) return label end gui.headers = {} gui.headers[1] = createHeader(20, 25, "State") gui.headers[2] = createHeader(75, 25, "Name") gui.headers[3] = createHeader(210, 25, "Description") local function createBackgroundBorder(x, y, width, height) local image = guiCreateStaticImage(x, y, width, height, "dot.bmp", false, gui.window) guiStaticImageSetColor(image, 160, 160, 190, 255) guiSetEnabled(image, false) guiForceSetAlpha(image, 1.0) return image end gui.background = guiCreateStaticImage(10, 42, innerWidth, gui.height - 84, "dot.bmp", false, gui.window) guiStaticImageSetVerticalBackground(gui.background, 40, 40, 70, 200, 0, 0, 0, 200) guiSetEnabled(gui.background, false) guiForceSetAlpha(gui.background, 1.0) gui.backgroundborder_top = createBackgroundBorder(10, 42, innerWidth, 1) gui.backgroundborder_bottom = createBackgroundBorder(10, gui.height - 42, innerWidth, 1) gui.backgroundborder_left = createBackgroundBorder(10, 42, 1, gui.height - 84) gui.backgroundborder_right = createBackgroundBorder(10 + innerWidth, 42, 1, gui.height - 84) local bottomY = gui.height - 35 gui.filters = {} gui.filter_label = guiCreateLabel(10, bottomY + 5, 30, 25, "Filter:", false, gui.window) gui.filter_edit = guiCreateEdit(50, bottomY, gui.width - 260, 25, "", false, gui.window) gui.filter_help = guiCreateLabel(10, 5, gui.width - 260, 25, "Type: #script | State: ~on, ~off | Enabled: @on, @off", false, gui.filter_edit) guiLabelSetColor(gui.filter_help, 60, 60, 60) guiSetEnabled(gui.filter_help, false) addEventHandler("onClientGUIChanged", gui.filter_edit, onBootloaderFilterChanged, false) gui.refresh = guiCreateButton(gui.width - 200, bottomY, 90, 25, "Refresh", false, gui.window) addEventHandler("onClientGUIClick", gui.refresh, onBootloaderRefreshButtonClick, false) gui.close = guiCreateButton(gui.width - 100, bottomY, 90, 25, "Close", false, gui.window) addEventHandler("onClientGUIClick", gui.close, onBootloaderCloseButtonClick, false) showCursor(true) guiSetInputEnabled(true) end function closeBootloaderWindow() destroyElement(gui.window) guiSetInputEnabled(false) showCursor(false) gui = {} end function onBootloaderWindowResize() gui.width, gui.height = guiGetSize(source, false) if gui.width < minimumWindowWidth or gui.height < minimumWindowWidth then gui.width = math.max(minimumWindowWidth, gui.width) gui.height = math.max(minimumWindowWidth, gui.height) return guiSetSize(source, gui.width, gui.height, false) end if gui.scrollpane then guiSetSize(gui.scrollpane, gui.width - 35, gui.height - 100, false) end local innerWidth = gui.width - 20 guiSetSize(gui.background, innerWidth, gui.height - 84, false) guiSetSize(gui.backgroundborder_top, innerWidth, 1, false) guiSetSize(gui.backgroundborder_bottom, innerWidth, 1, false) guiSetSize(gui.backgroundborder_left, 1, gui.height - 84, false) guiSetSize(gui.backgroundborder_right, 1, gui.height - 84, false) guiSetPosition(gui.backgroundborder_bottom, 10, gui.height - 42, false) guiSetPosition(gui.backgroundborder_right, 10 + innerWidth, 42, false) local bottomY = gui.height - 35 guiSetSize(gui.filter_edit, gui.width - 260, 25, false) guiSetPosition(gui.filter_label, 10, bottomY + 5, false) guiSetPosition(gui.filter_edit, 50, bottomY, false) guiSetPosition(gui.refresh, gui.width - 200, bottomY, false) guiSetPosition(gui.close, gui.width - 100, bottomY, false) end function onBootloaderFilterChanged() local filter = guiGetText(gui.filter_edit) or "" local filters = split(utf8.fold(filter), " ") local length = 0 gui.filters = {} if filters then for i = 1, #filters do local filter = { text = utf8.trim(filters[i]), negation = false, } if utf8.sub(filter.text, 1, 1) == "!" then filter.negation = true filter.text = utf8.sub(filter.text, 2) end if filter.text ~= "" then length = length + 1 gui.filters[length] = filter end end end guiSetVisible(gui.filter_help, filter == "") updateBootloaderScrollpaneLayout() end function onBootloaderCloseButtonClick() closeBootloaderWindow() triggerServerEvent("BootloaderClient.closePanel", resourceRoot) end function onBootloaderRefreshButtonClick() requestBootloaderResourceDataList() end function onBootloaderScrollpaneClick() if getElementType(source) == "gui-checkbox" then local row = gui.checkboxes[source] if row ~= nil then local selected = guiCheckBoxGetSelected(source) guiSetEnabled(source, false) requestBootloaderResourceToggle(row.data.name, selected) end end end local spinnersText = { "⢎⡰", "⢎⡡", "⢎⡑", "⢎⠱", "⠎⡱", "⢊⡱", "⢌⡱", "⢆⡱", } local spinnersLength = #spinnersText function updateBootloaderWindowSpinner() gui.spinner = ((gui.spinner + 1) % spinnersLength) + 1 guiSetText(gui.window, ("%s - Loading %s"):format(windowTitle, spinnersText[gui.spinner])) end function preBootloaderResourceDataListRequest() if gui.window == nil then return end clearBootloaderScrollpane() gui.spinner = 0 updateBootloaderWindowSpinner() end function processBootloaderResourceDataBatch(resourceDataBatch) if gui.window == nil then return end if gui.scrollpane == nil then createBootloaderScrollpane() end createBootloaderResourceRows(resourceDataBatch) sortBootloaderResourceRows() updateBootloaderScrollpaneLayout() updateBootloaderWindowSpinner() end function completeBootloaderResourceDataBatch() if gui.window == nil then return end gui.spinner = nil guiSetText(gui.window, windowTitle) end function createBootloaderScrollpane() gui.scrollpane = guiCreateScrollPane(20, 50, gui.width - 35, gui.height - 100, false, gui.window) gui.scrollpadding = guiCreateLabel(0, 0, 1, 1, "", false, gui.scrollpane) addEventHandler("onClientGUIClick", gui.scrollpane, onBootloaderScrollpaneClick) guiSetProperty(gui.scrollpane, "VertStepSize", 0.05) guiForceSetAlpha(gui.scrollpane, 1.0) end function clearBootloaderScrollpane() if gui.scrollpane then destroyElement(gui.scrollpane) gui.scrollpane = nil gui.rows = {} gui.checkboxes = {} gui.resources = {} end end function generateResourceDataFilter(data) return utf8.fold(table.concat({ data.name, "#"..(data.type or "none"), (data.running and "~on" or "~off"), (data.enabled and "@on" or "@off"), }, " ")) end function createBootloaderResourceRows(resourceDataBatch) local rowsLength = #gui.rows for i = 1, #resourceDataBatch do local data = resourceDataBatch[i] -- Trim string values for key, value in pairs(data) do if type(value) == "string" then value = utf8.trim(value) if value == "" then data[key] = false else data[key] = value end end end -- Create table data for row local row = { data = data, filter = generateResourceDataFilter(data), sortableValue = utf8.fold(data.name), widths = {}, gui = {}, } -- Create row gui row.gui.status = guiCreateStaticImage(0, 0, 20, 20, "status.png", false, gui.scrollpane) guiSetEnabled(row.gui.status, false) if data.running then guiStaticImageSetColor(row.gui.status, 100, 255, 100, 255) else guiStaticImageSetColor(row.gui.status, 100, 100, 100, 255) end row.gui.checkbox = guiCreateCheckBox(0, 0, 0, 20, "", data.enabled, false, gui.scrollpane) row.gui.name = guiCreateLabel(0, 0, 0, 20, data.name, false, gui.scrollpane) guiSetEnabled(row.gui.name, false) row.gui.description = guiCreateLabel(0, 0, 0, 20, data.description or "-", false, gui.scrollpane) guiSetEnabled(row.gui.description, false) -- Calculate column widths row.widths.name = guiLabelGetTextExtent(row.gui.name) guiSetSize(row.gui.name, row.widths.name, 20, false) row.widths.description = guiLabelGetTextExtent(row.gui.description) guiSetSize(row.gui.description, row.widths.description, 20, false) -- Store row references gui.rows[i + rowsLength] = row gui.checkboxes[row.gui.checkbox] = row gui.resources[data.name] = row end end function sortBootloaderResourceRows() table.sort(gui.rows, function (rowA, rowB) return rowA.sortableValue < rowB.sortableValue end) end function updateBootloaderScrollpaneLayout() local visible_length = 0 local column_width = { [1] = 55, [2] = 100, [3] = 200, } for i = 1, #gui.rows do local row = gui.rows[i] row.visible = true if gui.filters[1] then for i = 1, #gui.filters do local filter = gui.filters[i] local matched = (utf8.find(row.filter, filter.text, 1, true) ~= nil) if filter.negation then matched = not matched end row.visible = matched if not row.visible then break end end end if row.visible then visible_length = visible_length + 1 local r, g, b = 255, 255, 100 if (visible_length % 2) == 0 then r, g, b = 255, 255, 170 end row.rgb = { r, g, b } if not row.data.running then r = r * 0.5 g = g * 0.5 b = b * 0.5 end guiLabelSetColor(row.gui.name, r, g, b) guiLabelSetColor(row.gui.description, r, g, b) column_width[2] = math.max(column_width[2], row.widths.name) column_width[3] = math.max(column_width[3], row.widths.description) -- Apply the real width to the labels guiSetSize(row.gui.name, row.widths.name, 20, false) guiSetSize(row.gui.description, row.widths.description, 20, false) guiSetSize(row.gui.status, 20, 20, false) else -- Reset the size of the labels because the scrollbars inside the scrollpane -- include invisible items in the scrollbar-visibility calculation guiSetSize(row.gui.name, 0, 0, false) guiSetSize(row.gui.description, 0, 0, false) end for name, element in pairs(row.gui) do guiSetVisible(element, row.visible) if not row.visible then guiSetPosition(element, 0, 0, false) end end end local column_position = {} column_position[1] = 0 column_position[2] = column_position[1] + column_width[1] column_position[3] = 10 + column_position[2] + column_width[2] for i = 1, 3 do local header = gui.headers[i] local px, py = guiGetPosition(header, false) guiSetPosition(header, column_position[i] + 20, py, false) end if visible_length == 0 then guiSetPosition(gui.scrollpadding, 0, 0, false) return end local y = 0 for i = 1, #gui.rows do local row = gui.rows[i] if row.visible then guiSetPosition(row.gui.status, 0, y, false) guiSetPosition(row.gui.checkbox, 30, y, false) guiSetPosition(row.gui.name, column_position[2], y, false) guiSetPosition(row.gui.description, column_position[3], y, false) guiSetSize(row.gui.checkbox, column_width[2] + 25, 20, false) y = y + 20 end end local paddingX = 25 + column_position[3] + column_width[3] local paddingY = y + 20 guiSetPosition(gui.scrollpadding, paddingX, paddingY, false) end function processBootloaderResourceData(resourceName, isEnabled, isRunning) if gui.window == nil then return end local row = gui.resources[resourceName] if row == nil then return end updateBootloaderResourceRow(row, isEnabled, isRunning) end function updateBootloaderResourceRow(row, isEnabled, isRunning) row.data.enabled = isEnabled row.data.running = isRunning row.filter = generateResourceDataFilter(row.data) guiCheckBoxSetSelected(row.gui.checkbox, isEnabled) guiSetEnabled(row.gui.checkbox, true) local r, g, b = unpack(row.rgb) if isRunning then guiStaticImageSetColor(row.gui.status, 100, 255, 100, 255) else guiStaticImageSetColor(row.gui.status, 100, 100, 100, 255) r = r * 0.5 g = g * 0.5 b = b * 0.5 end guiLabelSetColor(row.gui.name, r, g, b) guiLabelSetColor(row.gui.description, r, g, b) end -------------------------------------------------------------------------------- -- Utility and extension functions -------------------------------------------------------------------------------- function utf8.trim(self) assert(type(self) == "string", "expected string at argument 1, got ".. type(self)) local from = utf8.match(self, "^%s*()") return from > utf8.len(self) and "" or utf8.match(self, ".*%S", from) end function guiStaticImageSetColor(guiElement, r, g, b, a) local c = ("%02X%02X%02X%02X"):format(a, r, g, b) local value = ("tl:%s tr:%s bl:%s br:%s"):format(c, c, c, c) guiSetProperty(guiElement, "ImageColours", value) end function guiStaticImageSetVerticalBackground(guiElement, r1, g1, b1, a1, r2, g2, b2, a2) local c1 = ("%02X%02X%02X%02X"):format(a1, r1, g1, b1) local c2 = ("%02X%02X%02X%02X"):format(a2, r2, g2, b2) local value = ("tl:%s tr:%s bl:%s br:%s"):format(c1, c1, c2, c2) guiSetProperty(guiElement, "ImageColours", value) end function guiForceSetAlpha(element, alpha) guiSetProperty(element, "InheritsAlpha", "False") guiSetAlpha(element, alpha) end
--[[ Copyright (C) 2006-2007 Nymbia Copyright (C) 2010-2017 Hendrik "Nevcairiel" Leppkes < [email protected] > This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ]] local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3") local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3") local MODNAME = "Timer" local Timer = Quartz3:NewModule(MODNAME, "AceEvent-3.0") local Mirror = Quartz3:GetModule("Mirror") ---------------------------- -- Upvalues local GetTime = GetTime local unpack, pairs, ipairs, tonumber = unpack, pairs, ipairs, tonumber local table_remove = table.remove local external = Mirror.ExternalTimers local thistimers = {} local getOptions function Timer:ChatHandler(msg) if self:IsEnabled() then if msg:match("^kill") then local name = msg:match("^kill (.+)$") if name then external[name] = nil for k, v in ipairs(thistimers) do if v == name then table_remove(thistimers, k) break end end self:SendMessage("Quartz3Mirror_UpdateCustom") else return Quartz3:Print(L["Usage: /quartztimer timername 60 or /quartztimer kill timername"]) end else local duration = tonumber(msg:match("^(%d+)")) local name if duration then name = msg:match("^%d+ (.+)$") else duration = tonumber(msg:match("(%d+)$")) if not duration then return Quartz3:Print(L["Usage: /quartztimer timername 60 or /quartztimer 60 timername"]) end name = msg:match("^(.+) %d+$") end if not name then return Quartz3:Print(L["Usage: /quartztimer timername 60 or /quartztimer kill timername"]) end local currentTime = GetTime() external[name].startTime = currentTime external[name].endTime = currentTime + duration for k, v in ipairs(thistimers) do if v == name then table_remove(thistimers, k) break end end thistimers[#thistimers+1] = name self:SendMessage("Quartz3Mirror_UpdateCustom") end end end function Timer:OnDisable() for k, v in pairs(thistimers) do external[v] = nil thistimers[k] = nil end self:SendMessage("Quartz3Mirror_UpdateCustom") end local function chatHandler(message) Timer:ChatHandler(message) end function Timer:OnInitialize() self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME)) Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Timer"]) Quartz3:RegisterChatCommand("qt", chatHandler) Quartz3:RegisterChatCommand("quartzt", chatHandler) Quartz3:RegisterChatCommand("quartztimer", chatHandler) end do local newname, newlength local options function getOptions() if not options then options = { type = "group", name = L["Timer"], order = 600, args = { toggle = { type = "toggle", name = L["Enable"], desc = L["Enable"], get = function() return Quartz3:GetModuleEnabled(MODNAME) end, set = function(info, v) Quartz3:SetModuleEnabled(MODNAME, v) end, order = 99, width = "full", }, newtimername = { type = "input", name = L["New Timer Name"], desc = L["Set a name for the new timer"], get = function() return newname or "" end, set = function(info, v) newname = v end, order = 100, }, newtimerlength = { type = "input", name = L["New Timer Length"], desc = L["Length of the new timer, in seconds"], get = function() return newlength or 0 end, set = function(info, v) newlength = tonumber(v) end, usage = L["<Time in seconds>"], order = 101, }, makenewtimer = { type = "execute", name = L["Make Timer"], desc = L["Make a new timer using the above settings. NOTE: it may be easier for you to simply use the command line to make timers, /qt"], func = function() local currentTime = GetTime() external[newname].startTime = currentTime external[newname].endTime = currentTime + newlength for k, v in ipairs(thistimers) do if v == newname then table_remove(thistimers, k) break end end thistimers[#thistimers+1] = newname Timer:SendMessage("Quartz3Mirror_UpdateCustom") newname = nil newlength = nil end, disabled = function() return not (newname and newlength) end, order = -3, }, nl = { type = "description", name = "", order = -2, }, killtimer = { type = "select", name = L["Stop Timer"], desc = L["Select a timer to stop"], get = function() return "" end, set = function(info, name) if name then external[name] = nil for k, v in ipairs(thistimers) do if v == name then table_remove(thistimers, k) break end end Timer:SendMessage("Quartz3Mirror_UpdateCustom") end end, values = thistimers, order = -1, }, }, } end return options end end
-- フリーカメラ local FreeCamera = Class('FreeCamera') local move_distance = 5 -- 初期化処理 function FreeCamera:init() self.camera = Camera.new() self.keys = KeyManager() -- self.keys:register( -- 'w', -- function() -- self.camera:move(0, -move_distance) -- end, -- true, -- 'pressed' -- ) -- self.keys:register( -- 's', -- function() -- self.camera:move(0, move_distance) -- end, -- true -- ) -- self.keys:register( -- 'd', -- function() -- self.camera:move(move_distance, 0) -- end, -- true -- ) -- self.keys:register( -- 'a', -- function() -- self.camera:move(-move_distance, 0) -- end, -- true -- ) self.keys:register( { { key = 'w', func = function() self.camera:move(0, -move_distance) end, rep = true, act = 'pressed' }, { key = 's', func = function() self.camera:move(0, move_distance) end, rep = true }, { key = 'd', func = function() self.camera:move(move_distance, 0) end, rep = true }, { key = 'a', func = function() self.camera:move(-move_distance, 0) end, rep = true } } ) self.active = false end function FreeCamera:update(dt) if self.active then self.keys:update(dt) end end function FreeCamera:getActive() return self.active end function FreeCamera:getPosition() return self.camera.x, self.camera.y end function FreeCamera:attach() self.camera:attach() end function FreeCamera:detach() self.camera:detach() end function FreeCamera:toggle() self.active = not self.active end return FreeCamera
-- **csv(file : str) : table** -- Iterator. Returns rows in a csv files. Converts -- strings to numbers if appropriate. local function csv(file, split,stream,tmp) stream = file and io.input(file) or io.input() tmp = io.read() return function( t) if tmp then tmp = tmp:gsub("[\t\r ]*",""):gsub("#.*","") t = {} for y in string.gmatch(tmp, "([^,]+)") do t[#t+1]=y end tmp = io.read() if #t > 0 then for j,x in pairs(t) do t[j]=tonumber(x) or x end; return t end else io.close(stream) end end end return {csv=csv}
local F, C = unpack(select(2, ...)) local UNITFRAME, cfg = F:GetModule('Unitframe'), C.unitframe function UNITFRAME:AddGCDSpark(self) if not cfg.GCDSpark then return end self.GCD = CreateFrame('Frame', self:GetName()..'_GCD', self) self.GCD:SetWidth(self:GetWidth()) self.GCD:SetHeight(3) self.GCD:SetFrameLevel(self:GetFrameLevel() + 3) self.GCD:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 0) self.GCD.Color = {1, 1, 1} self.GCD.Height = 4 self.GCD.Width = 4 end
IN_FILE_PATH = "..\\..\\SavedVariables\\ArkadiusTradeToolsExports.lua" dofile(IN_FILE_PATH) local cli = require "cliargs" cli:set_name('Arkadius Trade Tools Exports - Convert to CSV') cli:flag('-l, --latest', 'Use the latest export', false) cli:flag('-m, --members', 'Export only members', false) cli:option('-d DIRECTORY, --directory=DIRECTORY', 'Output directory (no trailing slash)', '..\\..\\SavedVariables') cli:option('-o OUTFILE, --out-file=OUTFILE', 'Output filename', 'ArkadiusTradeToolsExports-guildName isMembers startTimeStamp-endTimeStamp') cli:option('-f FORMAT, --date-format=FORMAT', 'Date format to use for the file name', "%Y-%m-%dT%H.%M.%S") local args, err = cli:parse(arg) if err then print(err) os.exit(1) end local useLatest = args.l local useOnlyMembers = args.m local dateFormat = args.f local outFile = args.o local directory = args.d print(outFile) local function escapeQuotes(s) local value = s:gsub("\"", "\"\"") return value end local function WriteLine(args) OUT_FILE:write( args.guildName .. ',' .. args.startTimeStamp .. ',' .. args.endTimeStamp .. ',' .. escapeQuotes(args.displayName) .. ',' .. tostring(args.member) .. ',' .. args.salesVolume .. ',' .. args.purchaseVolume .. ',' .. (args.rankIndex or "") .. ',' .. (args.rankName or "") .. ',' .. args.taxes .. ',' .. args.purchaseTaxes .. ',' .. args.salesCount .. ',' .. args.purchaseCount .. ',' .. args.internalSalesVolume .. ',' .. args.itemCount .. '\n' ) end local servers = {} for k in pairs(ArkadiusTradeToolsExportsData.exports) do servers[#servers + 1] = k end local function isValidServer(input) return servers[input] ~= nil end local input if #servers == 1 then input = 1 end while not isValidServer(input) do io.write('Available Servers:\n') for key, value in pairs(servers) do io.write(key .. ". " .. value .. "\n") end io.write("Which server would you like to use? ") io.flush() input = tonumber(io.read()) end local exports = ArkadiusTradeToolsExportsData.exports[servers[input]] table.sort(exports, function(a, b) if (a.createdTimeStamp == b.createdTimeStamp) then if (a.startTimeStamp == b.startTimeStamp) then if a.endTimeStamp == b.endTimeStamp then return a.guildName < b.guildName end return a.endTimeStamp > b.endTimeStamp end return a.startTimeStamp > b.startTimeStamp end return a.createdTimeStamp > b.createdTimeStamp end) local selectedExport if not useLatest then io.write('Available Exports:\n') for idx, value in ipairs(exports) do io.write(idx .. ". " .. value.guildName .. "\n") io.write(" End Date: ".. os.date('%Y-%m-%dT%H:%M:%S', value.endTimeStamp) .. '\n') io.write(" Start Date: ".. os.date('%Y-%m-%dT%H:%M:%S', value.startTimeStamp) .. '\n\n') end io.write("Which export would you like to use? ") io.flush() selectedExport = tonumber(io.read()) else selectedExport = 1 end local sortedExportsData = exports[selectedExport] table.sort( sortedExportsData.data, function(a, b) if (a.stats.salesVolume == b.stats.salesVolume) then if a.isMember == b.isMember then if a.stats.purchaseVolume == b.stats.purchaseVolume then return a.displayName < b.displayName end return a.stats.purchaseVolume > b.stats.purchaseVolume end return a.isMember end return a.stats.salesVolume > b.stats.salesVolume end ) local headersMap = { "Guild", "Start Timestamp", "End Timestamp", "Display Name", "Member", "Sales", "Purchases", "Rank Index", "Rank Name", "Taxes (Sales)", "Taxes (Purchases)", "Sales Count", "Purchase Count", "Internal Sales Volume", "Sold Items", } local headers = table.concat(headersMap, ',') .. '\n' local startTimeStamp = os.date(dateFormat, sortedExportsData.startTimeStamp) local endTimeStamp = os.date(dateFormat, sortedExportsData.endTimeStamp) local isMembers = useOnlyMembers or sortedExportsData.onlyMembers and "Members" or "All" local outFileName = outFile:gsub('guildName', sortedExportsData.guildName):gsub('isMembers', isMembers):gsub('startTimeStamp', startTimeStamp):gsub('endTimeStamp', endTimeStamp) local newPath = string.format("%s\\%s.csv", directory, outFileName) OUT_FILE_PATH = "..\\..\\SavedVariables\\ArkadiusTradeToolsExports.csv" OUT_FILE = assert(io.open(newPath, "w")) OUT_FILE:write(headers) startTimeStamp = os.date('%Y-%m-%dT%H:%M:%S', sortedExportsData.startTimeStamp) endTimeStamp = os.date('%Y-%m-%dT%H:%M:%S', sortedExportsData.endTimeStamp) for key, data in ipairs(sortedExportsData.data) do local displayName = data.displayName local member = data.isMember local stats = data.stats local purchaseTaxes = stats["purchaseTaxes"] local purchaseVolume = stats["purchaseVolume"] local purchasedItemCount = stats["purchasedItemCount"] local purchaseCount = stats["purchaseCount"] local itemCount = stats["itemCount"] local taxes = stats["taxes"] local salesCount = stats["salesCount"] local internalSalesVolume = stats["internalSalesVolume"] local salesVolume = stats["salesVolume"] if data.isMember or not useOnlyMembers then WriteLine({ guildName = sortedExportsData.guildName , startTimeStamp = startTimeStamp , endTimeStamp = endTimeStamp , displayName = displayName , member = member , stats = stats , rankIndex = data.rankIndex , rankName = data.rankName , purchaseTaxes = purchaseTaxes , purchaseVolume = purchaseVolume , purchasedItemCount = purchasedItemCount , purchaseCount = purchaseCount , itemCount = itemCount , taxes = taxes , salesCount = salesCount , internalSalesVolume = internalSalesVolume , salesVolume = salesVolume }) end end OUT_FILE:close() os.rename(OUT_FILE_PATH, newPath) print(string.format("Saved to %s", newPath))
ardour { ["type"] = "EditorAction", name = "Loop range", license = "MIT", author = "David Healey", description = [[Loop selected range]] } function factory () return function () local sel = Editor:get_selection() -- Get current selection local rangeMarker = sel.markers:table()[1] -- get first selected marker (should be a range marker) if rangeMarker ~= nil then -- get range start and end points local startPos = rangeMarker:position() local endPos local loc = Session:locations():list() for l in loc:iter() do --Each location (range marker) if l:is_range_marker() == true and l:start() == startPos then -- if marker starts at region position endPos = startPos + l:length () break end end if startPos ~= nil and endPos ~= nil then -- assign loop range Editor: set_loop_range (startPos, endPos, "set loop range") Editor:access_action ("Transport", "Loop") -- start playback end end end end
function compass(n) if ROUND.gameMode.hell and ROUND.accumulated then ROUND.accumulated = nil addBlockPoint(ROUND.chair[n].owner) end ROUND.chair[n].compass = ROUND.chair[n].compass or 0 ROUND.chair[n].compass = ROUND.chair[n].compass + 1 if ROUND.chair[n].compass < 3 then showProgress(n) passTurn() batataTimer(n) elseif ROUND.chair[n].compass == 3 then showProgress(n) ROUND.chair[n].action = {name="PLAY"} ROUND.time = os.time() + 10000 addFunctionTimer(function() ROUND.chair[n].action = nil giveCard(n, {ROUND.topCard.card[1],"chest",true,true}, true) missCard(n, {ROUND.topCard.card[1],"chest",true,true}, 2000) passTurn() batataTimer(n) end, 2000) else passTurn() batataTimer(n) end ROUND.chair[n].confuse = false end function showProgress(n) local text = ROUND.chair[n].compass.."/3" ui.addTextArea(7000+n, "<p align='center'><font size='30px' color='#000000'><b>"..text, nil, ROUND.chair[n].x-50, 50, 100, 60, 0, 0, 0, false) ui.addTextArea(7010+n, "<p align='center'><font size='30px' color='#FFD800'><b>"..text, nil, ROUND.chair[n].x-52, 48, 100, 60, 0, 0, 0, false) table.insert(TIMER.txt, {time=os.time()+2000, id=7000+n}) table.insert(TIMER.txt, {time=os.time()+2000, id=7010+n}) explosion(11, ROUND.chair[n].x, 70, 7*ROUND.chair[n].compass, 20) end function chest(n) if ROUND.gameMode.hell and ROUND.accumulated then ROUND.accumulated = nil addBlockPoint(ROUND.chair[n].owner) end endGame(ROUND.chair[n].owner, ROUND.topCard.card) unlockChair(ROUND.chair[n].owner, "falls") end
if not FAdmin or not FAdmin.StartHooks then return end FAdmin.StartHooks["FrenchRP"] = function() -- FrenchRP information: FAdmin.ScoreBoard.Player:AddInformation("Money", function(ply) if LocalPlayer():IsAdmin() then return FrenchRP.formatMoney(ply:getFrenchRPVar("money")) end end) FAdmin.ScoreBoard.Player:AddInformation("Steam name", function(ply) return ply:SteamName() end) FAdmin.ScoreBoard.Player:AddInformation("Wanted", function(ply) if ply:getFrenchRPVar("wanted") then return tostring(ply:getFrenchRPVar("wantedReason") or "N/A") end end) FAdmin.ScoreBoard.Player:AddInformation("Community link", function(ply) return FAdmin.SteamToProfile(ply) end) FAdmin.ScoreBoard.Player:AddInformation("Rank", function(ply) if FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "SeeAdmins") then return ply:GetUserGroup() end end) FAdmin.ScoreBoard.Player:AddInformation("Wanted reason", function(ply) if ply:isWanted() and LocalPlayer():isCP() then return ply:getWantedReason() end end) -- Warrant FAdmin.ScoreBoard.Player:AddActionButton("Warrant", "fadmin/icons/message", Color(0, 0, 200, 255), function(ply) return LocalPlayer():isCP() end, function(ply, button) Derma_StringRequest("Warrant reason", "Enter the reason for the warrant", "", function(Reason) RunConsoleCommand("frenchrp", "warrant", ply:SteamID(), Reason) end) end) --wanted FAdmin.ScoreBoard.Player:AddActionButton(function(ply) return ((ply:getFrenchRPVar("wanted") and "Unw") or "W") .. "anted" end, function(ply) return "fadmin/icons/jail", ply:getFrenchRPVar("wanted") and "fadmin/icons/disable" end, Color(0, 0, 200, 255), function(ply) return LocalPlayer():isCP() end, function(ply, button) if not ply:getFrenchRPVar("wanted") then Derma_StringRequest("wanted reason", "Enter the reason to arrest this player", "", function(Reason) RunConsoleCommand("frenchrp", "wanted", ply:SteamID(), Reason) end) else RunConsoleCommand("frenchrp", "unwanted", ply:UserID()) end end) --Teamban local function teamban(ply, button) local menu = DermaMenu() local Padding = vgui.Create("DPanel") Padding:SetPaintBackgroundEnabled(false) Padding:SetSize(1,5) menu:AddPanel(Padding) local Title = vgui.Create("DLabel") Title:SetText(" Jobs:\n") Title:SetFont("UiBold") Title:SizeToContents() Title:SetTextColor(color_black) menu:AddPanel(Title) local command = "teamban" local uid = ply:UserID() for k,v in SortedPairsByMemberValue(RPExtraTeams, "name") do local submenu = menu:AddSubMenu(v.name) submenu:AddOption("2 minutes", function() RunConsoleCommand("frenchrp", command, uid, k, 120) end) submenu:AddOption("Half an hour", function() RunConsoleCommand("frenchrp", command, uid, k, 1800) end) submenu:AddOption("An hour", function() RunConsoleCommand("frenchrp", command, uid, k, 3600) end) submenu:AddOption("Until restart", function() RunConsoleCommand("frenchrp", command, uid, k, 0) end) end menu:Open() end FAdmin.ScoreBoard.Player:AddActionButton("Ban from job", "fadmin/icons/changeteam", Color(200, 0, 0, 255), function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "FrenchRP_AdminCommands", ply) end, teamban) local function teamunban(ply, button) local menu = DermaMenu() local Padding = vgui.Create("DPanel") Padding:SetPaintBackgroundEnabled(false) Padding:SetSize(1,5) menu:AddPanel(Padding) local Title = vgui.Create("DLabel") Title:SetText(" Jobs:\n") Title:SetFont("UiBold") Title:SizeToContents() Title:SetTextColor(color_black) menu:AddPanel(Title) local command = "teamunban" local uid = ply:UserID() for k,v in SortedPairsByMemberValue(RPExtraTeams, "name") do menu:AddOption(v.name, function() RunConsoleCommand("frenchrp", command, uid, k) end) end menu:Open() end FAdmin.ScoreBoard.Player:AddActionButton("Unban from job", function() return "fadmin/icons/changeteam", "fadmin/icons/disable" end, Color(200, 0, 0, 255), function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "FrenchRP_AdminCommands", ply) end, teamunban) end
local config = {} function config:new() local o = {} setmetatable(o, {__index = self}) return o end function config:global() local c = {} local os_name = vim.loop.os_uname().sysname local home = os.getenv('HOME') c.is_mac = os_name == 'Darwin' c.is_linux = os_name == 'Linux' c.is_windows = os_name == 'Windows' local path_sep = self.is_windows and '\\' or '/' c.vim_path = vim.fn.stdpath('config') c.path_sep = path_sep c.home = home c.data_dir = string.format('%s/site/', vim.fn.stdpath('data')) return c end function config:set_vars(conf) for k, v in pairs(conf) do vim.api.nvim_set_var(k, v) end end function config:set_options(conf) for k, v in pairs(conf) do vim.api.nvim_set_option(k, v) end end --- set for current buffer function config:set_buf_vars(conf) for k, v in pairs(conf) do vim.api.nvim_buf_set_var(0, k, v) end end --- set for current buffer function config:set_buf_options(conf) for k, v in pairs(conf) do vim.api.nvim_buf_set_option(0, k, v) end end return config
function Battlepass:DonatorCompanion(ID, unit_name, js) local hero = PlayerResource:GetPlayer(ID):GetAssignedHero() if hero.companion then hero.companion:ForceKill(false) end -- Disabled companion if unit_name == "" then hero.companion = nil return end -- set mini doom as default companion if something goes wrong if unit_name == nil or unit_name == false then unit_name = "npc_donator_companion_demi_doom" end if UNIQUE_DONATOR_COMPANION[tostring(PlayerResource:GetSteamID(ID))] and not js then unit_name = UNIQUE_DONATOR_COMPANION[tostring(PlayerResource:GetSteamID(ID))] end local model local model_scale for key, value in pairs(LoadKeyValues("scripts/npc/units/companions.txt")) do if key == unit_name then model = value["Model"] model_scale = value["ModelScale"] break end end local companion = CreateUnitByName("npc_donator_companion", hero:GetAbsOrigin() + RandomVector(200), true, hero, hero, hero:GetTeamNumber()) companion:SetModel(model) companion:SetOriginalModel(model) companion:SetOwner(hero) companion:AddNewModifier(companion, nil, "modifier_companion", {}) hero.companion = companion if model == "models/courier/baby_rosh/babyroshan.vmdl" then local particle_name = {} particle_name[0] = "particles/econ/courier/courier_donkey_ti7/courier_donkey_ti7_ambient.vpcf" particle_name[1] = "particles/econ/courier/courier_golden_roshan/golden_roshan_ambient.vpcf" particle_name[2] = "particles/econ/courier/courier_platinum_roshan/platinum_roshan_ambient.vpcf" particle_name[3] = "particles/econ/courier/courier_roshan_darkmoon/courier_roshan_darkmoon.vpcf" -- particles/econ/courier/courier_roshan_darkmoon/courier_roshan_darkmoon_flying.vpcf particle_name[4] = "particles/econ/courier/courier_roshan_desert_sands/baby_roshan_desert_sands_ambient.vpcf" particle_name[5] = "particles/econ/courier/courier_roshan_ti8/courier_roshan_ti8.vpcf" particle_name[6] = "particles/econ/courier/courier_roshan_lava/courier_roshan_lava.vpcf" particle_name[7] = "particles/econ/courier/courier_roshan_frost/courier_roshan_frost_ambient.vpcf" particle_name[8] = "particles/econ/courier/courier_babyroshan_winter18/courier_babyroshan_winter18_ambient.vpcf" particle_name[9] = "particles/econ/courier/courier_babyroshan_ti9/courier_babyroshan_ti9_ambient.vpcf" -- if RandomInt(1, 2) == 2 then -- model = model.."_flying" -- end -- also attach eyes effect later local random_int = RandomInt(0, #particle_name) local particle = ParticleManager:CreateParticle(particle_name[random_int], PATTACH_ABSORIGIN_FOLLOW, companion) if random_int <= 5 then companion:SetMaterialGroup(tostring(random_int)) elseif random_int == 6 or random_int == 7 then companion:SetModel("models/courier/baby_rosh/babyroshan_elemental.vmdl") companion:SetOriginalModel("models/courier/baby_rosh/babyroshan_elemental.vmdl") companion:SetMaterialGroup(tostring(random_int - 5)) elseif random_int == 8 then companion:SetModel("models/courier/baby_rosh/babyroshan_winter18.vmdl") companion:SetOriginalModel("models/courier/baby_rosh/babyroshan_winter18.vmdl") elseif random_int == 9 then companion:SetModel("models/courier/baby_rosh/babyroshan_ti9.vmdl") companion:SetOriginalModel("models/courier/baby_rosh/babyroshan_ti9.vmdl") end elseif unit_name == "npc_donator_companion_suthernfriend" then companion:SetMaterialGroup("1") elseif unit_name == "npc_donator_companion_golden_venoling" then companion:SetMaterialGroup("1") end companion:SetModelScale(model_scale or 100) if DONATOR_COMPANION_ADDITIONAL_INFO[model] and DONATOR_COMPANION_ADDITIONAL_INFO[model][1] then local particle = ParticleManager:CreateParticle(DONATOR_COMPANION_ADDITIONAL_INFO[model][1], PATTACH_ABSORIGIN_FOLLOW, companion) if DONATOR_COMPANION_ADDITIONAL_INFO[model][3] then ParticleManager:SetParticleControlEnt(particle, 0, companion, PATTACH_POINT_FOLLOW, DONATOR_COMPANION_ADDITIONAL_INFO[model][3], companion:GetAbsOrigin(), true) end ParticleManager:ReleaseParticleIndex(particle) end end function DonatorCompanionSkin(id, unit, skin) local hero = PlayerResource:GetPlayer(id):GetAssignedHero() -- print("Material Group:", skin) -- print(hero.companion, hero.companion:GetUnitName(), unit) if hero.companion and hero.companion:GetUnitName() == unit then hero.companion:SetMaterialGroup(tostring(skin)) end end function Battlepass:DonatorStatue(ID, statue_unit) if UNIQUE_DONATOR_STATUE[tostring(PlayerResource:GetSteamID(ID))] and not js then statue_unit = UNIQUE_DONATOR_STATUE[tostring(PlayerResource:GetSteamID(ID))] end local pedestal_name = "npc_donator_pedestal" local hero = PlayerResource:GetSelectedHeroEntity(ID) -- if hero.donator_statue then -- hero.donator_statue:ForceKill(false) -- local unit = CreateUnitByName(statue_unit[2], abs, true, nil, nil, PlayerResource:GetPlayer(ID):GetTeam()) -- unit:SetModelScale(statue_unit[1]) -- unit:SetAbsOrigin(abs + Vector(0, 0, 17)) -- unit:AddNewModifier(unit, nil, "modifier_contributor_statue", {}) -- hero.donator_statue = unit -- return -- end local team = "good" if PlayerResource:GetPlayer(ID):GetTeam() == 3 then team = "bad" end local fillers = { team.."_filler_2", team.."_filler_4", team.."_filler_6", team.."_filler_7", } local model_scale = nil for key, value in pairs(LoadKeyValues("scripts/npc/units/statues.txt")) do if key == statue_unit then model_scale = value["ModelScale"] break end end if model_scale == nil then model_scale = 1.0 end if statue_unit == nil then return end for _, ent_name in pairs(fillers) do local filler = Entities:FindByName(nil, ent_name) if filler then local abs = filler:GetAbsOrigin() filler:RemoveSelf() local unit = CreateUnitByName(statue_unit, abs, true, nil, nil, PlayerResource:GetPlayer(ID):GetTeam()) if unit == nil then return end unit:SetModelScale(model_scale) unit:SetAbsOrigin(abs + Vector(0, 0, 45)) -- unit:AddNewModifier(unit, nil, "modifier_donator_statue", {}) unit:AddNewModifier(unit, nil, "modifier_invulnerable", {}) hero.donator_statue = unit local steam_id = tostring(PlayerResource:GetSteamID(hero:GetPlayerID())) local name = PlayerResource:GetPlayerName(ID) if api:GetDonatorStatus(ID) == 1 then unit:SetCustomHealthLabel(name, 160, 20, 20) pedestal_name = "npc_donator_pedestal_cookies" elseif api:GetDonatorStatus(ID) == 2 then unit:SetCustomHealthLabel("sutherncuck", 0, 204, 255) pedestal_name = "npc_donator_pedestal_developer_"..team elseif api:GetDonatorStatus(ID) == 3 then unit:SetCustomHealthLabel(name, 160, 20, 20) elseif api:GetDonatorStatus(ID) == 4 then unit:SetCustomHealthLabel(name, 240, 50, 50) pedestal_name = "npc_donator_pedestal_ember_"..team elseif api:GetDonatorStatus(ID) == 5 then unit:SetCustomHealthLabel(name, 218, 165, 32) pedestal_name = "npc_donator_pedestal_golden_"..team elseif api:GetDonatorStatus(ID) == 7 then unit:SetCustomHealthLabel(name, 47, 91, 151) pedestal_name = "npc_donator_pedestal_salamander_"..team elseif api:GetDonatorStatus(ID) == 8 then unit:SetCustomHealthLabel(name, 153, 51, 153) pedestal_name = "npc_donator_pedestal_icefrog" elseif api:GetDonatorStatus(ID) then -- 6: donator, 0: lesser donator unit:SetCustomHealthLabel(name, 45, 200, 45) end if statue_unit == "npc_donator_statue_suthernfriend" then unit:SetMaterialGroup("1") elseif statue_unit == "npc_donator_statue_tabisama" then unit:SetAbsOrigin(unit:GetAbsOrigin() + Vector(0, 0, 40)) elseif statue_unit == "npc_donator_statue_zonnoz" then pedestal_name = "npc_donator_pedestal_pudge_arcana" elseif statue_unit == "npc_donator_statue_crystal_maiden_arcana" then local particle = ParticleManager:CreateParticle("particles/econ/items/crystal_maiden/crystal_maiden_maiden_of_icewrack/maiden_arcana_base_ambient.vpcf", PATTACH_ABSORIGIN_FOLLOW, unit) ParticleManager:ReleaseParticleIndex(particle) end local pedestal = CreateUnitByName(pedestal_name, abs, true, nil, nil, PlayerResource:GetPlayer(ID):GetTeam()) pedestal:AddNewModifier(pedestal, nil, "modifier_contributor_statue", {}) pedestal:SetAbsOrigin(abs + Vector(0, 0, 45)) unit.pedestal = pedestal if statue_unit == "npc_donator_statue_zonnoz" then pedestal:SetMaterialGroup("1") end return end end end
version https://git-lfs.github.com/spec/v1 oid sha256:e2ada5f0db7572d88b5078ccac52fa8a197b3ee4a3210ade489c7b8fb11eb423 size 942
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' author 'Frankh®#0856' description 'Sistema di videosorveglia' version '1.0' client_scripts { 'client.lua' }
local _, Addon = ...; local MODEL_KEY = {}; local MODEL_INDEX_KEY = {}; local INDEX_KEY = {}; local ListItem = {}; --[[=========================================================================== | Clears all of the data for this list item, including clearing the | anchors, and hiding the frame. ========================================================================--]] function ListItem:ResetAll() rawset(self, MODEL_KEY, nil); rawset(self, MODEL_INDEX_KEY, nil); rawset(self, INDEX_KEY, nil); self:ClearAllPoints(); self:Hide(); end --[[=========================================================================== | Returns the data/model item this visual is using ========================================================================--]] function ListItem:GetModel() return rawget(self, MODEL_KEY); end --[[=========================================================================== | Sets the mode for this item base, if the model has changed then | OnModelChanged is invoked allowing the item to update itself. ========================================================================--]] function ListItem:SetModel(model) local m = rawget(self, MODEL_KEY); if (m ~= model) then rawset(self, MODEL_KEY, model) local cb = self.OnModelChanged; if (type(cb) == "function") then xpcall(cb, CallErrorHandler, self, model); end end end --[[=========================================================================== | Sets the model index (the index into the model collection) ========================================================================--]] function ListItem:SetModelIndex(modelIndex) rawset(self, MODEL_INDEX_KEY, modelIndex); end --[[=========================================================================== | Retrieves the model index ========================================================================--]] function ListItem:GetModelIndex() return rawget(self, MODEL_INDEX_KEY); end --[[=========================================================================== |Sets the item index (the position in the view) ========================================================================--]] function ListItem:SetItemIndex(index) rawset(self, INDEX_KEY, index); end --[[=========================================================================== | Retrieves the item index for this item. ========================================================================--]] function ListItem:GetItemIndex() return rawget(self, INDEX_KEY) or -1; end --[[=========================================================================== | Checks if this and the specified item have the samde model. ========================================================================--]] function ListItem:IsSameModel(other) return (rawget(self, MODEL_KEY) == rawget(other, MODEL_KEY)); end --[[=========================================================================== | Returns true of the item has the model specified. ========================================================================--]] function ListItem:HasModel(model) local compare = self.CompareModel; if (type(compare) == "function") then return compare(self, model); end return (rawget(self, MODEL_KEY) == model); end --[[=========================================================================== | Compares two items, if the item has a "Compare" functino it is invoked | otherwsie the indexs are compared. ========================================================================--]] function ListItem:CompareTo(other) if (type(self.Compare) == "function") then local success, result = xpcall(self.Compare, CallErrorHandler, self, other); if (success) then return result; end end return (rawget(self, MODEL_INDEX_KEY) or 0) < (rawget(self, MODEL_INDEX_KKEY) or 0); end --[[=========================================================================== | returns true if the item is selected ========================================================================--]] function ListItem:IsSelected() return (self.selected == true); end --[[=========================================================================== | Modifies the selected state of this item ========================================================================--]] function ListItem:SetSelected(selected) if (self.selected ~= selected) then self.selected = selected; local cb = self.OnSelected; if (type(cb) == "function") then xpcall(cb, CallErrorHandler, self, selected); end end end --[[=========================================================================== | Retrieves the list for this item by walking the parent and looking | sentinal which marks the list ========================================================================--]] function ListItem:GetList() local parent = self:GetParent(); if (parent and (rawget(parent, "@@list@@") == true)) then return parent end parent = parent:GetParent() if (parent and (rawget(parent, "@@list@@") == true)) then return parent; end return nil end local HANDLERS = { "OnShow", "OnHide", "OnEnter", "OnLeave", "OnClick" } Addon.Controls = Addon.Controls or {}; Addon.Controls.ListItem = { Attach = function(self, control) local item = Mixin(control, ListItem); for _, name in ipairs(HANDLERS) do if (item:HasScript(name) and (type(item[name]) == "function")) then item:SetScript(name, item[name]) end end return item end };
--[[ strings.lua Strings for ImprovedIgnore. Makes for easy editing and localization. ]] -- Generic strings STR_IIGNORE_ALLOW = "allow" STR_IIGNORE_DENY = "deny" STR_IIGNORE_REMOVE = "remove" STR_IIGNORE_LOCALIZATION_WHISPERS = "whispers" -- localized version of "[Player] whispers:" -- Generic function strings. STR_IIGNORE_FUNC_LOADED = "ImprovedIgnore %s loaded. Type /ii for help." STR_IIGNORE_WHISPER_REMOVE = "%s was on your ignore list and has just been removed." STR_IIGNORE_WHISPER_DENY = "%s is on your ignore list, whisper has been aborted." STR_IIGNORE_WHISPER_ALLOW = "%s is on your ignore list, you will not see any answers." STR_IIGNORE_FUNC_COPYFROMLIST = "Added %s from Blizzard ignore list" -- Help strings. STR_IIGNORE_HELP_HEADER = "ImprovedIgnore %s." STR_IIGNORE_HELP_STATUS = "/ii status - Displays the current settings." STR_IIGNORE_HELP_WHISPER = "/ii whisper <"..STR_IIGNORE_ALLOW.."/"..STR_IIGNORE_DENY.."/"..STR_IIGNORE_REMOVE.."> - What should happen if you whisper to an ignored player?" STR_IIGNORE_HELP_ADD = "/ii add <name> <reason> - Adds a player to ignore list optionally with a reason" STR_IIGNORE_HELP_REMOVE = "/ii remove <name> - Removes a player from the ignore list" STR_IIGNORE_HELP_LIST = "/ii list - Shows a list of all ignored players" STR_IIGNORE_HELP_ALLOW_CHANNEL = "/ii allow <channel name> - Bypass ignore list on this channel." STR_IIGNORE_HELP_DENY_CHANNEL = "/ii deny <channel name> - (default) Ignore players on this channel." -- Status strings. STR_IIGNORE_STATUS_HEADER = "ImprovedIgnore status:" STR_IIGNORE_STATUS_CHANNELS = "Channel bypass settings:" STR_IIGNORE_CHANNEL_SETTING = { [STR_IIGNORE_ALLOW] = STR_IIGNORE_ALLOW, [STR_IIGNORE_DENY] = STR_IIGNORE_DENY } STR_IIGNORE_STATUS_WHISPER = "Whispers to ignored players:" STR_IIGNORE_WHISPER_SETTING = { [STR_IIGNORE_ALLOW] = STR_IIGNORE_ALLOW, [STR_IIGNORE_DENY] = STR_IIGNORE_DENY, [STR_IIGNORE_REMOVE] = STR_IIGNORE_REMOVE } STR_IIGNORE_STATUS_LIST = "The following players are on your ignore list:" STR_IIGNORE_STATUS_ADDED = "Added %s to ignore list." STR_IIGNORE_STATUS_REMOVED = "Removed %s from ignore list." STR_IIGNORE_STATUS_NOT_REMOVED = "%s is not on your ignore list." -- Channel names STR_IIGNORE_CHANNEL_PARTY = "Party" STR_IIGNORE_CHANNEL_RAID = "Raid" STR_IIGNORE_CHANNEL_RAIDLEAD = "Raid Leader" STR_IIGNORE_CHANNEL_OFFICER = "Officer" STR_IIGNORE_CHANNEL_WHISPER = "Whisper" -- Command-line and setting strings. STR_IIGNORE_COMMAND_STATUS = "status" STR_IIGNORE_COMMAND_WHISPER = "whisper" STR_IIGNORE_COMMAND_ADD = "add" STR_IIGNORE_COMMAND_REMOVE = "remove" STR_IIGNORE_COMMAND_LIST = "list" STR_IIGNORE_COMMAND_ALLOW = "allow" STR_IIGNORE_COMMAND_DENY = "deny"
module(..., package.seeall) local PcapFilter = require("apps.packet_filter.pcap_filter").PcapFilter local V4V6 = require("apps.lwaftr.V4V6").V4V6 local VhostUser = require("apps.vhost.vhost_user").VhostUser local basic_apps = require("apps.basic.basic_apps") local bt = require("apps.lwaftr.binding_table") local config = require("core.config") local ethernet = require("lib.protocol.ethernet") local ipv4_echo = require("apps.ipv4.echo") local ipv4_fragment = require("apps.ipv4.fragment") local ipv4_reassemble = require("apps.ipv4.reassemble") local ipv6_echo = require("apps.ipv6.echo") local ipv6_fragment = require("apps.ipv6.fragment") local ipv6_reassemble = require("apps.ipv6.reassemble") local lib = require("core.lib") local lwaftr = require("apps.lwaftr.lwaftr") local lwutil = require("apps.lwaftr.lwutil") local constants = require("apps.lwaftr.constants") local nh_fwd = require("apps.lwaftr.nh_fwd") local pci = require("lib.hardware.pci") local raw = require("apps.socket.raw") local tap = require("apps.tap.tap") local pcap = require("apps.pcap.pcap") local yang = require("lib.yang.yang") local fatal, file_exists = lwutil.fatal, lwutil.file_exists local dir_exists, nic_exists = lwutil.dir_exists, lwutil.nic_exists local yesno = lib.yesno local function net_exists (pci_addr) local devices="/sys/class/net" return dir_exists(("%s/%s"):format(devices, pci_addr)) end local function subset (keys, conf) local ret = {} for k,_ in pairs(keys) do ret[k] = conf[k] end return ret end local function load_driver (pciaddr) local device_info = pci.device_info(pciaddr) return require(device_info.driver).driver, device_info.rx, device_info.tx end local function load_virt (c, nic_id, lwconf, interface) -- Validate the lwaftr and split the interfaces into global and instance. local device, id, queue = lwutil.parse_instance(lwconf) local gexternal_interface = lwconf.softwire_config.external_interface local ginternal_interface = lwconf.softwire_config.internal_interface local iexternal_interface = queue.external_interface local iinternal_interface = queue.internal_interface assert(type(interface) == 'table') assert(nic_exists(interface.pci), "Couldn't find NIC: "..interface.pci) local driver, rx, tx = assert(load_driver(interface.pci)) print("Different VLAN tags: load two virtual interfaces") print(("%s ether %s"):format(nic_id, interface.mac_address)) local v4_nic_name, v6_nic_name = nic_id..'_v4', nic_id..'v6' local v4_mtu = external_interface.mtu + constants.ethernet_header_size if iexternal_interface.vlan_tag then v4_mtu = v4_mtu + 4 end print(("Setting %s interface MTU to %d"):format(v4_nic_name, v4_mtu)) config.app(c, v4_nic_name, driver, { pciaddr = interface.pci, vmdq = true, -- Needed to enable MAC filtering/stamping. vlan = interface.vlan and interface.vlan.v4_vlan_tag, macaddr = ethernet:ntop(iexternal_interface.mac), ring_buffer_size = interface.ring_buffer_size, mtu = v4_mtu }) local v6_mtu = ginternal_interface.mtu + constants.ethernet_header_size if iinternal_interface.vlan_tag then v6_mtu = v6_mtu + 4 end print(("Setting %s interface MTU to %d"):format(v6_nic_name, v6_mtu)) config.app(c, v6_nic_name, driver, { pciaddr = interface.pci, vmdq = true, -- Needed to enable MAC filtering/stamping. vlan = interface.vlan and interface.vlan.v6_vlan_tag, macaddr = ethernet:ntop(iinternal_interface.mac), ring_buffer_size = interface.ring_buffer_size, mtu = v6_mtu}) local v4_in, v4_out = v4_nic_name.."."..rx, v4_nic_name.."."..tx local v6_in, v6_out = v6_nic_name.."."..rx, v6_nic_name.."."..tx return v4_in, v4_out, v6_in, v6_out end local function load_phy (c, nic_id, interface) assert(type(interface) == 'table') local vlan = interface.vlan and tonumber(interface.vlan) local chain_input, chain_output if nic_exists(interface.pci) then local driver, rx, tx = load_driver(interface.pci) vlan = interface.vlan and tonumber(interface.vlan) print(("%s network ether %s mtu %d"):format(nic_id, interface.mac_address, interface.mtu)) if vlan then print(("%s vlan %d"):format(nic_id, vlan)) end config.app(c, nic_id, driver, { pciaddr = interface.pci, vmdq = true, -- Needed to enable MAC filtering/stamping. vlan = vlan, macaddr = interface.mac_address, ring_buffer_size = interface.ring_buffer_size, mtu = interface.mtu}) chain_input, chain_output = nic_id.."."..rx, nic_id.."."..tx elseif net_exists(interface.pci) then print(("%s network interface %s mtu %d"):format(nic_id, interface.pci, interface.mtu)) if vlan then print(("WARNING: VLAN not supported over %s. %s vlan %d"):format(interface.pci, nic_id, vlan)) end config.app(c, nic_id, raw.RawSocket, interface.pci) chain_input, chain_output = nic_id .. ".rx", nic_id .. ".tx" else print(("Couldn't find device info for PCI address '%s'"):format(interface.pci)) if not interface.mirror_id then fatal("Neither PCI nor tap interface given") end print(("Using tap interface '%s' instead"):format(interface.mirror_id)) config.app(c, nic_id, tap.Tap, interface.mirror_id) print(("Running VM via tap interface '%s'"):format(interface.mirror_id)) interface.mirror_id = nil -- Hack to avoid opening again as mirror port. print(("SUCCESS %s"):format(chain_input)) chain_input, chain_output = nic_id .. ".input", nic_id .. ".output" end return chain_input, chain_output end local function requires_splitter (internal_interface, external_interface) if not internal_interface.vlan_tag then return true end return internal_interface.vlan_tag == external_interface.vlan_tag end function lwaftr_app(c, conf, lwconf, sock_path) assert(type(conf) == 'table') assert(type(lwconf) == 'table') -- Validate the lwaftr and split the interfaces into global and instance. local device, id, queue = lwutil.parse_instance(lwconf) local gexternal_interface = lwconf.softwire_config.external_interface local ginternal_interface = lwconf.softwire_config.internal_interface local iexternal_interface = queue.external_interface local iinternal_interface = queue.internal_interface local external_interface = lwconf.softwire_config.external_interface local internal_interface = lwconf.softwire_config.internal_interface print(("Hairpinning: %s"):format(yesno(ginternal_interface.hairpinning))) local virt_id = "vm_" .. conf.interface.id local phy_id = "nic_" .. conf.interface.id local chain_input, chain_output local v4_input, v4_output, v6_input, v6_output local use_splitter = requires_splitter(iinternal_interface, iexternal_interface) if not use_splitter then v4_input, v4_output, v6_input, v6_output = load_virt(c, phy_id, lwconf, conf.interface) else chain_input, chain_output = load_phy(c, phy_id, conf.interface) end if conf.ipv4_interface or conf.ipv6_interface then if use_splitter then local mirror_id = conf.interface.mirror_id if mirror_id then print(("Mirror port %s found"):format(mirror_id)) config.app(c, "Mirror", tap.Tap, mirror_id) config.app(c, "Sink", basic_apps.Sink) config.link(c, "nic_v4v6.mirror -> Mirror.input") config.link(c, "Mirror.output -> Sink.input") end config.app(c, "nic_v4v6", V4V6, { description = "nic_v4v6", mirror = mirror_id and true or false}) config.link(c, chain_output .. " -> nic_v4v6.input") config.link(c, "nic_v4v6.output -> " .. chain_input) v4_output, v6_output = "nic_v4v6.v4", "nic_v4v6.v6" v4_input, v6_input = "nic_v4v6.v4", "nic_v4v6.v6" end end if conf.ipv6_interface then conf.ipv6_interface.mac_address = conf.interface.mac_address print(("IPv6 fragmentation and reassembly: %s"):format(yesno( conf.ipv6_interface.fragmentation))) if conf.ipv6_interface.fragmentation then local mtu = conf.ipv6_interface.mtu or internal_interface.mtu config.app(c, "reassemblerv6", ipv6_reassemble.Reassembler, { max_concurrent_reassemblies = ginternal_interface.reassembly.max_packets, max_fragments_per_reassembly = ginternal_interface.reassembly.max_fragments_per_packet }) config.app(c, "fragmenterv6", ipv6_fragment.Fragmenter, { mtu = mtu, }) config.link(c, v6_output .. " -> reassemblerv6.input") config.link(c, "fragmenterv6.output -> " .. v6_input) v6_input, v6_output = "fragmenterv6.input", "reassemblerv6.output" end if conf.ipv6_interface.ipv6_ingress_filter then local filter = conf.ipv6_interface.ipv6_ingress_filter print(("IPv6 ingress filter: '%s'"):format(filter)) config.app(c, "ingress_filterv6", PcapFilter, { filter = filter }) config.link(c, v6_output .. " -> ingress_filterv6.input") v6_output = "ingress_filterv6.output" end if conf.ipv6_interface.ipv6_egress_filter then local filter = conf.ipv6_interface.ipv6_egress_filter print(("IPv6 egress filter: '%s'"):format(filter)) config.app(c, "egress_filterv6", PcapFilter, { filter = filter }) config.link(c, "egress_filterv6.output -> " .. v6_input) v6_input = "egress_filterv6.input" end end if conf.ipv4_interface then conf.ipv4_interface.mac_address = conf.interface.mac_address print(("IPv4 fragmentation and reassembly: %s"):format(yesno( conf.ipv4_interface.fragmentation))) if conf.ipv4_interface.fragmentation then local mtu = conf.ipv4_interface.mtu or gexternal_interface.mtu config.app(c, "reassemblerv4", ipv4_reassemble.Reassembler, { max_concurrent_reassemblies = gexternal_interface.reassembly.max_packets, max_fragments_per_reassembly = gexternal_interface.reassembly.max_fragments_per_packet }) config.app(c, "fragmenterv4", ipv4_fragment.Fragmenter, { mtu = mtu }) config.link(c, v4_output .. " -> reassemblerv4.input") config.link(c, "fragmenterv4.output -> " .. v4_input) v4_input, v4_output = "fragmenterv4.input", "reassemblerv4.output" end if conf.ipv4_interface.ipv4_ingress_filter then local filter = conf.ipv4_interface.ipv4_ingress_filter print(("IPv4 ingress filter: '%s'"):format(filter)) config.app(c, "ingress_filterv4", PcapFilter, { filter = filter }) config.link(c, v4_output .. " -> ingress_filterv4.input") v4_output = "ingress_filterv4.output" end if conf.ipv4_interface.ipv4_egress_filter then local filter = conf.ipv4_interface.ipv4_egress_filter print(("IPv4 egress filter: '%s'"):format(filter)) config.app(c, "egress_filterv4", PcapFilter, { filter = filter }) config.link(c, "egress_filterv4.output -> " .. v4_input) v4_input = "egress_filterv4.input" end end if conf.ipv4_interface and conf.ipv6_interface then print("lwAFTR service: enabled") config.app(c, "nh_fwd6", nh_fwd.nh_fwd6, subset(nh_fwd.nh_fwd6.config, conf.ipv6_interface)) config.link(c, v6_output .. " -> nh_fwd6.wire") config.link(c, "nh_fwd6.wire -> " .. v6_input) v6_input, v6_output = "nh_fwd6.vm", "nh_fwd6.vm" config.app(c, "nh_fwd4", nh_fwd.nh_fwd4, subset(nh_fwd.nh_fwd4.config, conf.ipv4_interface)) config.link(c, v4_output .. " -> nh_fwd4.wire") config.link(c, "nh_fwd4.wire -> " .. v4_input) v4_input, v4_output = "nh_fwd4.vm", "nh_fwd4.vm" config.app(c, "lwaftr", lwaftr.LwAftr, lwconf) config.link(c, "nh_fwd6.service -> lwaftr.v6") config.link(c, "lwaftr.v6 -> nh_fwd6.service") config.link(c, "nh_fwd4.service -> lwaftr.v4") config.link(c, "lwaftr.v4 -> nh_fwd4.service") -- Add a special hairpinning queue to the lwaftr app. config.link(c, "lwaftr.hairpin_out -> lwaftr.hairpin_in") else print("lwAFTR service: disabled (v6 or v4 interface config missing)") end if conf.ipv4_interface or conf.ipv6_interface then config.app(c, "vm_v4v6", V4V6, { description = "vm_v4v6", mirror = false }) config.link(c, v6_output .. " -> vm_v4v6.v6") config.link(c, "vm_v4v6.v6 -> " .. v6_input) config.link(c, v4_output .. " -> vm_v4v6.v4") config.link(c, "vm_v4v6.v4 -> " .. v4_input) chain_input, chain_output = "vm_v4v6.input", "vm_v4v6.output" end if sock_path then local socket_path = sock_path:format(conf.interface.id) config.app(c, virt_id, VhostUser, { socket_path = socket_path }) config.link(c, virt_id .. ".tx -> " .. chain_input) config.link(c, chain_output .. " -> " .. virt_id .. ".rx") else config.app(c, "DummyVhost", basic_apps.Sink) config.link(c, "DummyVhost" .. ".tx -> " .. chain_input) config.link(c, chain_output .. " -> " .. "DummyVhost" .. ".rx") print("Running without VM (no vHostUser sock_path set)") end end function passthrough(c, conf, sock_path) assert(type(conf) == 'table') io.write("lwAFTR service: disabled ") print("(either empty binding_table or v6 or v4 interface config missing)") local virt_id = "vm_" .. conf.interface.id local phy_id = "nic_" .. conf.interface.id local chain_input, chain_output = load_phy(c, phy_id, conf.interface) if sock_path then local socket_path = sock_path:format(conf.interface.id) config.app(c, virt_id, VhostUser, { socket_path = socket_path }) config.link(c, virt_id .. ".tx -> " .. chain_input) config.link(c, chain_output .. " -> " .. virt_id .. ".rx") else config.app(c, "DummyVhost", basic_apps.Sink) config.link(c, "DummyVhost" .. ".tx -> " .. chain_input) config.link(c, chain_output .. " -> " .. "DummyVhost" .. ".rx") print("Running without VM (no vHostUser sock_path set)") end end function load_conf (conf_filename) local function load_lwaftr_config (conf, conf_filename) local filename = conf.lwaftr if not file_exists(filename) then filename = lib.dirname(conf_filename).."/"..filename end return yang.load_configuration(filename, {schema_name=lwaftr.LwAftr.yang_schema}) end local conf = dofile(conf_filename) return conf, load_lwaftr_config(conf, conf_filename) end local function lwaftr_app_check (c, conf, lwconf, sources, sinks) assert(type(conf) == "table") assert(type(lwconf) == "table") local external_interface = lwconf.softwire_config.external_interface local internal_interface = lwconf.softwire_config.internal_interface local v4_src, v6_src = unpack(sources) local v4_sink, v6_sink = unpack(sinks) if conf.ipv6_interface then if conf.ipv6_interface.fragmentation then local mtu = conf.ipv6_interface.mtu or internal_interface.mtu config.app(c, "reassemblerv6", ipv6_reassemble.Reassembler, { max_concurrent_reassemblies = internal_interface.reassembly.max_packets, max_fragments_per_reassembly = internal_interface.reassembly.max_fragments_per_packet }) config.app(c, "fragmenterv6", ipv6_fragment.Fragmenter, { mtu = mtu, }) config.link(c, v6_src .. " -> reassemblerv6.input") config.link(c, "fragmenterv6.output -> " .. v6_sink) v6_src, v6_sink = "reassemblerv6.output", "fragmenterv6.input" end if conf.ipv6_interface.ipv6_ingress_filter then local filter = conf.ipv6_interface.ipv6_ingress_filter config.app(c, "ingress_filterv6", PcapFilter, { filter = filter }) config.link(c, v6_src .. " -> ingress_filterv6.input") v6_src = "ingress_filterv6.output" end if conf.ipv6_interface.ipv6_egress_filter then local filter = conf.ipv6_interface.ipv6_egress_filter config.app(c, "egress_filterv6", PcapFilter, { filter = filter }) config.link(c, "egress_filterv6.output -> " .. v6_sink) v6_sink = "egress_filterv6.input" end end if conf.ipv4_interface then if conf.ipv4_interface.fragmentation then local mtu = conf.ipv4_interface.mtu or external_interface.mtu config.app(c, "reassemblerv4", ipv4_reassemble.Reassembler, { max_concurrent_reassemblies = external_interface.reassembly.max_packets, max_fragments_per_reassembly = external_interface.reassembly.max_fragments_per_packet }) config.app(c, "fragmenterv4", ipv4_fragment.Fragmenter, { mtu = mtu }) config.link(c, v4_src .. " -> reassemblerv4.input") config.link(c, "fragmenterv4.output -> " .. v4_sink) v4_src, v4_sink = "reassemblerv4.output", "fragmenterv4.input" end if conf.ipv4_interface.ipv4_ingress_filter then local filter = conf.ipv4_interface.ipv4_ingress_filter config.app(c, "ingress_filterv4", PcapFilter, { filter = filter }) config.link(c, v4_src .. " -> ingress_filterv4.input") v4_src = "ingress_filterv4.output" end if conf.ipv4_interface.ipv4_egress_filter then local filter = conf.ipv4_interface.ipv4_egress_filter config.app(c, "egress_filterv4", PcapFilter, { filter = filter }) config.link(c, "egress_filterv4.output -> " .. v4_sink) v4_sink = "egress_filterv4.input" end end if conf.ipv4_interface and conf.ipv6_interface then config.app(c, "nh_fwd6", nh_fwd.nh_fwd6, subset(nh_fwd.nh_fwd6.config, conf.ipv6_interface)) config.link(c, v6_src.." -> nh_fwd6.wire") config.link(c, "nh_fwd6.wire -> "..v6_sink) config.app(c, "nh_fwd4", nh_fwd.nh_fwd4, subset(nh_fwd.nh_fwd4.config, conf.ipv4_interface)) config.link(c, v4_src.."-> nh_fwd4.wire") config.link(c, "nh_fwd4.wire -> "..v4_sink) config.app(c, "lwaftr", lwaftr.LwAftr, lwconf) config.link(c, "nh_fwd6.service -> lwaftr.v6") config.link(c, "lwaftr.v6 -> nh_fwd6.service") config.link(c, "nh_fwd4.service -> lwaftr.v4") config.link(c, "lwaftr.v4 -> nh_fwd4.service") -- Add a special hairpinning queue to the lwaftr app. config.link(c, "lwaftr.hairpin_out -> lwaftr.hairpin_in") config.app(c, "vm_v4v6", V4V6, { description = "vm_v4v6", mirror = false }) config.link(c, "nh_fwd6.vm -> vm_v4v6.v6") config.link(c, "vm_v4v6.v6 -> nh_fwd6.vm") config.link(c, "nh_fwd4.vm -> vm_v4v6.v4") config.link(c, "vm_v4v6.v4 -> nh_fwd6.vm") config.app(c, "DummyVhost", basic_apps.Sink) config.link(c, "DummyVhost.tx -> vm_v4v6.input") config.link(c, "vm_v4v6.output -> DummyVhost.rx") end end function load_check(c, conf_filename, inv4_pcap, inv6_pcap, outv4_pcap, outv6_pcap) local conf, lwconf = load_conf(conf_filename) config.app(c, "capturev4", pcap.PcapReader, inv4_pcap) config.app(c, "capturev6", pcap.PcapReader, inv6_pcap) config.app(c, "output_filev4", pcap.PcapWriter, outv4_pcap) config.app(c, "output_filev6", pcap.PcapWriter, outv6_pcap) if conf.vlan_tagging then config.app(c, "untagv4", vlan.Untagger, { tag=conf.v4_vlan_tag }) config.app(c, "untagv6", vlan.Untagger, { tag=conf.v6_vlan_tag }) config.app(c, "tagv4", vlan.Tagger, { tag=conf.v4_vlan_tag }) config.app(c, "tagv6", vlan.Tagger, { tag=conf.v6_vlan_tag }) end local sources = { "capturev4.output", "capturev6.output" } local sinks = { "output_filev4.input", "output_filev6.input" } if conf.vlan_tagging then sources = { "untagv4.output", "untagv6.output" } sinks = { "tagv4.input", "tagv6.input" } config.link(c, "capturev4.output -> untagv4.input") config.link(c, "capturev6.output -> untagv6.input") config.link(c, "tagv4.output -> output_filev4.input") config.link(c, "tagv6.output -> output_filev6.input") end lwaftr_app_check(c, conf, lwconf, sources, sinks) end
#!/usr/bin/env lua local M = require 'posix.sys.socket' local dgram = arg[1] or 'test data' -- Create an AF_UNIX datagram socket local s, errmsg = M.socket(M.AF_UNIX, M.SOCK_DGRAM, 0) assert(s ~= nil, errmsg) -- Sendto the abtract AF_UNIX name 'mysocket' local rc, errmsg = M.sendto(s, dgram, {family=M.AF_UNIX, path='\0mysocket'}) assert(rc ~= nil, errmsg)
--[[ Copyright 2019 Teverse @File core/client/characterController.lua @Author(s) Jay --]] local controller = {} controller.character = nil -- server creates this engine.networking:bind( "characterSpawned", function() repeat wait() until workspace[engine.networking.me.id] controller.character = workspace[engine.networking.me.id] if controller.camera then controller.camera.setTarget(controller.character) end end) controller.keyBinds = { [enums.key.w] = 1, [enums.key.up] = 1, [enums.key.s] = 2, [enums.key.down] = 2, [enums.key.a] = 3, [enums.key.left] = 3, [enums.key.d] = 4, [enums.key.right] = 4, [enums.key.space] = 5 } engine.input:keyPressed(function (inputObj) if controller.keyBinds[inputObj.key] then engine.networking:toServer("characterSetInputStarted", controller.keyBinds[inputObj.key]) end end) engine.input:keyReleased(function (inputObj) if controller.keyBinds[inputObj.key] then engine.networking:toServer("characterSetInputEnded", controller.keyBinds[inputObj.key]) end end) return controller
-- Implements an AutoEncoder based on LSTM with a text input and text output require 'nn' local utils = require 'misc.utils' local LSTM_encoder = require 'misc.LSTM_encoder' local LSTM_decoder = require 'misc.LSTM_decoder' ------------------------------------------------------------------------------- -- AutoEncoder Model core ------------------------------------------------------------------------------- local layer, parent = torch.class('nn.AutoEncoder', 'nn.Module') function layer:__init(opt) parent.__init(self) -- options for core network self.vocab_size = utils.getopt(opt, 'vocab_size') -- required self.input_encoding_size = utils.getopt(opt, 'input_encoding_size') self.rnn_size = utils.getopt(opt, 'rnn_size') self.num_layers = utils.getopt(opt, 'num_layers', 1) local dropout = utils.getopt(opt, 'dropout', 0) -- options for Language Model self.seq_length = utils.getopt(opt, 'seq_length') -- create the core lstm network. note +1 for both the START and END tokens self.encoder = LSTM_encoder.lstm(self.input_encoding_size, self.vocab_size + 1, self.rnn_size, self.num_layers, dropout) self.decoder = LSTM_decoder.lstm(self.input_encoding_size, self.vocab_size + 1, self.rnn_size, self.num_layers, dropout) self.lookup_table = nn.Sequential() self.lookup_table:add(nn.LookupTable(self.vocab_size + 1, self.input_encoding_size)) self.lookup_table:add(nn.Dropout(0.5)) self.lookup_table:add(nn.Tanh()) self:_createInitState(1) -- will be lazily resized later during forward passes end function layer:_createInitState(batch_size) assert(batch_size ~= nil, 'batch size must be provided') -- construct the initial state for the LSTM if not self.init_state_enc then self.init_state_enc = {} end -- lazy init if not self.init_state_dec then self.init_state_dec = {} end -- lazy init for h=1,self.num_layers*2 do -- FOR LSTM -- note, the init state Must be zeros because we are using init_state to init grads in backward call too if self.init_state_enc[h] then if self.init_state_enc[h]:size(1) ~= batch_size then self.init_state_enc[h]:resize(batch_size, self.rnn_size):zero() -- expand the memory end else self.init_state_enc[h] = torch.zeros(batch_size, self.rnn_size) end if self.init_state_dec[h] then if self.init_state_dec[h]:size(1) ~= batch_size then self.init_state_dec[h]:resize(batch_size, self.rnn_size):zero() -- expand the memory end else self.init_state_dec[h] = torch.zeros(batch_size, self.rnn_size) end end self.num_state = #self.init_state_enc end function layer:createClones() -- construct the net clones print('constructing clones inside the AutoEncoder') self.clones_encoder = {self.encoder} self.clones_decoder = {self.decoder} self.lookup_tables_encoder = {self.lookup_table:clone('weight')} self.lookup_tables_decoder = {self.lookup_table:clone('weight')} for t=2,self.seq_length+1 do print('t: '..t) -- encoder does not have a start token, so only seq_length clones needed if t <= self.seq_length then self.clones_encoder[t] = self.encoder:clone('weight', 'bias', 'gradWeight', 'gradBias') self.lookup_tables_encoder[t] = self.lookup_tables_encoder[1]:clone('weight', 'gradWeight') end self.clones_decoder[t] = self.decoder:clone('weight', 'bias', 'gradWeight', 'gradBias') self.lookup_tables_decoder[t] = self.lookup_tables_decoder[1]:clone('weight', 'gradWeight') end end function layer:getModulesList() return {self.encoder, self.decoder, self.lookup_table} end function layer:parameters() -- we only have two internal modules, return their params local p1,g1 = self.encoder:parameters() local p2,g2 = self.decoder:parameters() local p3,g3 = self.lookup_table:parameters() local params = {} for k,v in pairs(p1) do table.insert(params, v) end for k,v in pairs(p2) do table.insert(params, v) end for k,v in pairs(p3) do table.insert(params, v) end local grad_params = {} for k,v in pairs(g1) do table.insert(grad_params, v) end for k,v in pairs(g2) do table.insert(grad_params, v) end for k,v in pairs(g3) do table.insert(grad_params, v) end -- todo: invalidate self.clones if params were requested? -- what if someone outside of us decided to call getParameters() or something? -- (that would destroy our parameter sharing because clones 2...end would point to old memory) return params, grad_params end function layer:training() if (self.clones_encoder == nil or self.clones_decoder == nil) then self:createClones() end -- create these lazily if needed for k,v in pairs(self.clones_encoder) do v:training() end for k,v in pairs(self.clones_decoder) do v:training() end for k,v in pairs(self.lookup_tables_encoder) do v:training() end for k,v in pairs(self.lookup_tables_decoder) do v:training() end end function layer:evaluate() if (self.clones_encoder == nil or self.clones_decoder == nil) then self:createClones() end -- create these lazily if needed for k,v in pairs(self.clones_encoder) do v:evaluate() end for k,v in pairs(self.lookup_tables_encoder) do v:evaluate() end for k,v in pairs(self.clones_decoder) do v:evaluate() end for k,v in pairs(self.lookup_tables_decoder) do v:evaluate() end end --[[ takes a batch of images and runs the model forward in sampling mode Careful: make sure model is in :evaluate() mode if you're calling this. Returns: a DxN LongTensor with integer elements 1..M, where D is sequence length and N is batch (so columns are sequences) --]] function layer:sample(sents, opt) local sample_max = utils.getopt(opt, 'sample_max', 1) local beam_size = utils.getopt(opt, 'beam_size', 1) local temperature = utils.getopt(opt, 'temperature', 1.0) if sample_max == 1 and beam_size > 1 then return self:sample_beam(imgs, opt) end -- indirection for beam search local batch_size = sents:size(2) self:_createInitState(batch_size) local state_enc = self.init_state_enc -- we will write output predictions into tensor seq local seq = torch.LongTensor(self.seq_length, batch_size):zero() local seqLogprobs = torch.FloatTensor(self.seq_length, batch_size) local logprobs -- logprobs predicted in last time step -- encoder forward pass for t=1,self.seq_length do local xt, it, sampleLogprobs -- take sequence inputs for current time step and feed them in it = sents[t]:clone() xt = self.lookup_table:forward(it) local inputs = {xt,unpack(state_enc)} local out = self.encoder:forward(inputs) -- For LSTM, and GRU with more than 1 layers state_enc = {} for i=1,self.num_state do table.insert(state_enc, out[i]) end end -- the state of the encoder after the sequence is inputted is the initial state of the decoder state_dec = state_enc -- decoder forward pass for t=1,self.seq_length+1 do local xt, it, sampleLogprobs if t == 1 then -- feed in the start tokens it = torch.LongTensor(batch_size):fill(self.vocab_size+1) xt = self.lookup_table:forward(it) else -- take predictions from previous time step and feed them in if sample_max == 1 then -- use argmax "sampling" sampleLogprobs, it = torch.max(logprobs, 2) it = it:view(-1):long() else -- sample from the distribution of previous predictions local prob_prev if temperature == 1.0 then prob_prev = torch.exp(logprobs) -- fetch prev distribution: shape Nx(M+1) else -- scale logprobs by temperature prob_prev = torch.exp(torch.div(logprobs, temperature)) end it = torch.multinomial(prob_prev, 1) sampleLogprobs = logprobs:gather(2, it) -- gather the logprobs at sampled positions it = it:view(-1):long() -- and flatten indices for downstream processing end xt = self.lookup_table:forward(it) end if t >= 2 then seq[t-1] = it -- record the samples seqLogprobs[t-1] = sampleLogprobs:view(-1):float() -- and also their log likelihoods end local inputs = {xt,unpack(state_dec)} local out = self.decoder:forward(inputs) logprobs = out[self.num_state+1] -- last element is the output vector state_dec = {} for i=1,self.num_state do table.insert(state_dec, out[i]) end end -- return the samples and their log likelihoods return seq, seqLogprobs end --[[ input is: torch.LongTensor of size DxN, elements 1..M where M = opt.vocab_size and D = opt.seq_length and N is batch size returns a (D+2)xNx(M+1) Tensor giving (normalized) log probabilities for the next token at every iteration of the LSTM (+2 because +1 for first dummy img forward, and another +1 because of START/END tokens shift) --]] function layer:updateOutput(input) local seq = input if (self.clones_encoder == nil or self.clones_decoder == nil) then self:createClones() end -- lazily create clones on first forward pass assert(seq:size(1) == self.seq_length) local batch_size = seq:size(2) -- the encoder outputs the hidden states for each layer after all the sequence has been processed self.output_enc = {} -- the decoder outputs the probabilities for each word for each time instance if not self.output_dec then self.output_dec = torch.Tensor(self.seq_length+1, batch_size, self.vocab_size+1) if seq:type() == 'torch.CudaTensor' then self.output_dec = self.output_dec:cuda() end else self.output_dec:resize(self.seq_length+1, batch_size, self.vocab_size+1) end self:_createInitState(batch_size) self.state_enc = {[0] = self.init_state_enc} self.inputs_enc = {} self.inputs_dec = {} self.lookup_tables_inputs_enc = {} self.lookup_tables_inputs_dec = {} self.tmax = 0 -- we will keep track of max sequence length encountered in the data for efficiency -- encoder forward pass for t=1,self.seq_length do local can_skip = false local xt -- feed in the sequence... local it = seq[t]:clone() if torch.sum(it) == 0 then -- computational shortcut for efficiency. All sequences have already terminated and only -- contain null tokens from here on. We can skip the rest of the forward pass and save time can_skip = true end --[[ seq may contain zeros as null tokens, make sure we take them out to any arbitrary token that won't make lookup_table crash with an error. token #1 will do, arbitrarily. This will be ignored anyway because we will carefully set the loss to zero at these places in the criterion, so computation based on this value will be noop for the optimization. --]] it[torch.eq(it,0)] = 1 if not can_skip then self.lookup_tables_inputs_enc[t] = it xt = self.lookup_tables_encoder[t]:forward(it) end if not can_skip then -- construct the inputs self.inputs_enc[t] = {xt,unpack(self.state_enc[t-1])} -- forward the network --print('t: ' .. t) --print('inputs: ') --print(self.inputs_enc[t]) local out = self.clones_encoder[t]:forward(self.inputs_enc[t]) -- For LSTM and GRU with more than 1 layer -- process the outputs self.state_enc[t] = {} -- everything is state for i=1,self.num_state do table.insert(self.state_enc[t], out[i]) end --print('state_enc @ end of t = ' .. t) --print(self.state_enc[t]) self.tmax = t end end -- output of the encoder consists of the hidden state of the layers at tmax self.output_enc = self.state_enc[self.tmax] self.init_state_dec = self.state_enc[self.tmax] -- the final encoder hidden state is used to initialize the decoder -- the generation then starts with this hidden state and start token self.state_dec = {[0] = self.init_state_dec} -- decoder forward pass for t=1,self.seq_length+1 do local can_skip = false local xt if t == 1 then -- feed in the start tokens local it = torch.LongTensor(batch_size):fill(self.vocab_size+1) self.lookup_tables_inputs_dec[t] = it xt = self.lookup_tables_decoder[t]:forward(it) -- NxK sized input (token embedding vectors) else -- feed in the rest of the sequence... local it = seq[t-1]:clone() if torch.sum(it) == 0 then -- computational shortcut for efficiency. All sequences have already terminated and only -- contain null tokens from here on. We can skip the rest of the forward pass and save time can_skip = true end --[[ seq may contain zeros as null tokens, make sure we take them out to any arbitrary token that won't make lookup_table crash with an error. token #1 will do, arbitrarily. This will be ignored anyway because we will carefully set the loss to zero at these places in the criterion, so computation based on this value will be noop for the optimization. --]] it[torch.eq(it,0)] = 1 if not can_skip then self.lookup_tables_inputs_dec[t] = it xt = self.lookup_tables_decoder[t]:forward(it) end end if not can_skip then -- construct the inputs self.inputs_dec[t] = {xt,unpack(self.state_dec[t-1])} -- forward the network local out = self.clones_decoder[t]:forward(self.inputs_dec[t]) -- process the outputs self.output_dec[t] = out[self.num_state+1] -- final output is the probabilities of each word self.state_dec[t] = {} -- everything else is saved as state for i=1,self.num_state do table.insert(self.state_dec[t], out[i]) end end end return self.output_dec end --[[ gradOutput is an (D+2)xNx(M+1) Tensor. --]] function layer:updateGradInput(input, gradOutput) -- go backwards and lets compute gradients -- backward pass for the decoder -- tmax does not cover start token, so add 1 local dstate_dec = {[self.tmax+1] = self.init_state_enc} -- this works when init_state_enc is all zeros, theoretically it has no meaning except that it is all zeros for t=self.tmax+1,1,-1 do -- concat state gradients and output vector gradients at time step t local dout = {} for k=1,#dstate_dec[t] do table.insert(dout, dstate_dec[t][k]) end table.insert(dout, gradOutput[t]) local dinputs = self.clones_decoder[t]:backward(self.inputs_dec[t], dout) -- split the gradient to xt and to state local dxt = dinputs[1] -- first element is the input vector dstate_dec[t-1] = {} -- copy over rest to state grad for k=2,self.num_state+1 do table.insert(dstate_dec[t-1], dinputs[k]) end -- continue backprop of xt local it = self.lookup_tables_inputs_dec[t] self.lookup_tables_decoder[t]:backward(it, dxt) -- backprop into lookup table end -- backward pass for the encoder -- the dstate from the decoder at time 1 is wrt to the final state of encoder local dstate_enc = {[self.tmax] = dstate_dec[0]} for t=self.tmax,1,-1 do -- only state gradients at time step t for encoder local dout = {} -- For LSTM, and GRU with more than 2 layers for k=1,#dstate_enc[t] do table.insert(dout, dstate_enc[t][k]) end -- FOR LSTM, and GRU with more than 2 layers --dout = dstate_enc[t][1] -- For GRU with 1 layer local dinputs = self.clones_encoder[t]:backward(self.inputs_enc[t], dout) -- split the gradient to xt and to state local dxt = dinputs[1] -- first element is the input vector dstate_enc[t-1] = {} -- copy over rest to state grad for k=2,self.num_state+1 do table.insert(dstate_enc[t-1], dinputs[k]) end -- continue backprop of xt local it = self.lookup_tables_inputs_enc[t] self.lookup_tables_encoder[t]:backward(it, dxt) -- backprop into lookup table end -- for LongTensor gt sequence we only create an empty tensor - can't backprop self.gradInput = {torch.Tensor()} return self.gradInput end ------------------------------------------------------------------------------- -- Language Model-aware Criterion ------------------------------------------------------------------------------- local crit, parent = torch.class('nn.LanguageModelCriterion', 'nn.Criterion') function crit:__init() parent.__init(self) end --[[ input is a Tensor of size (D+1)xNx(M+1) seq is a LongTensor of size DxN. The way we infer the target in this criterion is as follows: - at first time step the output is ignored (loss = 0). It's the image tick - the label sequence "seq" is shifted by one to produce targets - at last time step the output is always the special END token (last dimension) The criterion must be able to accomodate variably-sized sequences by making sure the gradients are properly set to zeros where appropriate. --]] function crit:updateOutput(input, seq) self.gradInput:resizeAs(input):zero() -- reset to zeros local L,N,Mp1 = input:size(1), input:size(2), input:size(3) local D = seq:size(1) assert(D == L-1, 'input Tensor should be 1 larger in time') local loss = 0 local n = 0 for b=1,N do -- iterate over batches local first_time = true for t=1,L do -- iterate over sequence time, t = 1 is where the start sequence begins -- fetch the index of the next token in the sequence local target_index if t > D then -- we are out of bounds of the index sequence: pad with null tokens target_index = 0 else target_index = seq[{t,b}] -- t is correct, since at t=1 START token was fed in and we want to predict first word (and 2-1 = 1). end -- the first time we see null token as next index, actually want the model to predict the END token if target_index == 0 and first_time then target_index = Mp1 first_time = false end -- if there is a non-null next token, enforce loss! if target_index ~= 0 then -- accumulate loss loss = loss - input[{ t,b,target_index }] -- log(p) self.gradInput[{ t,b,target_index }] = -1 n = n + 1 end end end self.output = loss / n -- normalize by number of predictions that were made self.gradInput:div(n) return self.output end function crit:updateGradInput(input, seq) return self.gradInput end
--━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --─────────────────────────────────────────────────-- -- Plugin: barbar.nvim -- Github: github.com/romgrk/barbar.nvim --─────────────────────────────────────────────────-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- local keymap = vim.api.nvim_set_keymap local options = { noremap=true, silent=true } -- Move to previous/next keymap('n', '<C-Tab>', ':BufferNext<CR>', options) keymap('n', '<S-C-Tab>', ':BufferPrevious<CR>', options) -- Goto buffer in position... keymap('n', '<Leader>1', ':BufferGoto 1<CR>', options) keymap('n', '<Leader>2', ':BufferGoto 2<CR>', options) keymap('n', '<Leader>3', ':BufferGoto 3<CR>', options) keymap('n', '<Leader>4', ':BufferGoto 4<CR>', options) keymap('n', '<Leader>5', ':BufferGoto 5<CR>', options) keymap('n', '<Leader>6', ':BufferGoto 6<CR>', options) keymap('n', '<Leader>7', ':BufferGoto 7<CR>', options) keymap('n', '<Leader>8', ':BufferGoto 8<CR>', options) keymap('n', '<Leader>9', ':BufferGoto 9<CR>', options) -- Re-order to previous/next keymap('n', '<Leader>,', ':BufferMovePrevious 9<CR>', options) keymap('n', '<Leader>.', ':BufferMoveNext 9<CR>', options) -- Close buffer -- nnoremap <silent> <A-c> :BufferClose<CR> keymap('n', '<Leader>q', ':BufferClose<CR>', options) -- Magic buffer-picking mode keymap('n', '<Leader>m', ':BufferPick<CR>', options) --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- --━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━--
local _tonumber = tonumber local sessionId = KEYS[1] local rawSsoCheckMessage = KEYS[2] local rk = { tickSessions = "tick|sessions", roomName = "rooms|"..sessionId, session = "sessions|"..sessionId, sessionSubs = "sessions|"..sessionId.."|rooms" } local currentTime = _tonumber(redis.call('get', 'serverTime')) local ssoMessage, newSessionId, clientRoomName if(not currentTime) then return redis.error_reply('NO SERVERTIME') end ssoMessage = cjson.decode(rawSsoCheckMessage) if(not ssoMessage) then return redis.error_reply('NO MESSAGE TO VERIFY') end if(ssoMessage.phase and ssoMessage.phase ~= "ssoCheck") then return redis.error_reply('INVALID PHASE') end newSessionId = ssoMessage.response clientRoomName = ssoMessage.room if(newSessionId and newSessionId == sessionId) then return redis.status_reply("OK") end local searchTerm = '[pso||is-user-id||'..sessionId..'||' local sessions = redis.call('zrangebylex', 'hex|sessions:users', searchTerm, searchTerm..'\xff') local subscribers = {} local userId --[[if(#sessions <= 0) then return redis.status_reply("EMPTY") end]] userId = sessions[1]:sub(#searchTerm) if(not userId) then return redis.error_reply('INVALID USER ID') end searchTerm = '[ops||is-user-id||'..userId..'||' sessions = redis.call('zrangebylex', 'hex|sessions:users', searchTerm, searchTerm..'\xff') for x=1, #sessions do subscribers[x] = sessions[x]:sub(#searchTerm) end local dataToSend = { userId = userId, message = { phase = "ssoLogout", serverReqTime = currentTime, response = { sessionId = sessionId, newSessionId = newSessionId } } } --will return error if not existing local sessionAlive = redis.call('zadd', rk.tickSessions, 'XX', currentTime, sessionId) --encode message for redis local encoded = cjson.encode(dataToSend) --publish message redis.call('publish', rk.roomName, encoded) return sessionAlive and redis.status_reply('OK') or redis.error_reply('SESSION EXPIRED')
object_static_worldbuilding_structures_mun_nboo_starport_destroyed = object_static_worldbuilding_structures_shared_mun_nboo_starport_destroyed:new { } ObjectTemplates:addTemplate(object_static_worldbuilding_structures_mun_nboo_starport_destroyed, "object/static/worldbuilding/structures/mun_nboo_starport_destroyed.iff")
return { tlldtns = { buildangle = 8192, buildcostenergy = 200, buildcostmetal = 15, builder = false, buildinggrounddecaldecayspeed = 30, buildinggrounddecalsizex = 4, buildinggrounddecalsizey = 4, buildinggrounddecaltype = "tlldtns_aoplane.dds", buildpic = "tlldtns.dds", buildtime = 450, category = "ALL SURFACE UNDERWATER", corpse = "tllfloatingteeth", description = "Shark's Teeth", downloadable = 1, footprintx = 2, footprintz = 2, isfeature = true, losemitheight = 22, mass = 15, maxdamage = 3700, maxslope = 32, minwaterdepth = 1, name = "Shark's Teeth", noautofire = false, objectname = "TLLDTNS", radaremitheight = 25, script = "drag.lua", unitname = "tlldtns", usebuildinggrounddecal = true, waterline = 11, yardmap = "ww ww", customparams = { buildpic = "tlldtns.dds", faction = "TLL", }, featuredefs = { tllfloatingteeth = { autoreclaimable = 0, blocking = true, crushResistance = 250, damage = 2500, description = "Dragon's Teeth - NS", floating = true, footprintx = 2, footprintz = 2, height = 100, hitdensity = 100, metal = 20, nodrawundergray = true, object = "tlldtns", reclaimable = true, world = "allworld", customparams = { fromunit = 1, }, }, }, sfxtypes = { pieceexplosiongenerators = { [1] = "piecetrail0", [2] = "piecetrail1", [3] = "piecetrail2", [4] = "piecetrail3", [5] = "piecetrail4", [6] = "piecetrail6", }, }, }, }
local layout_data = { { {0, 0, 1, 1}, }, { {0.0, 0.0, 0.5, 1.0}, {0.5, 0.0, 0.5, 1.0}, }, { {0.0, 0.0, 0.5, 1.0}, {0.5, 0.0, 0.5, 0.5}, {0.5, 0.5, 0.5, 0.5}, }, { {0.0, 0.000, 0.5, 1.000}, {0.5, 0.000, 0.5, 0.333}, {0.5, 0.333, 0.5, 0.333}, {0.5, 0.666, 0.5, 0.333}, }, { {0.0, 0.00, 0.5, 1.00}, {0.5, 0.00, 0.5, 0.25}, {0.5, 0.25, 0.5, 0.25}, {0.5, 0.50, 0.5, 0.25}, {0.5, 0.75, 0.5, 0.25}, }, } layout:set(layout_data) opt.hidden_edges = Direction.all opt.smart_hidden_edges = false opt.resize_direction = Direction.right opt:set_layout_constraints({min_width = 0.1, max_width = 1, min_height = 0.1, max_height = 1}) opt:set_master_constraints({min_width = 0.1, max_width = 1, min_height = 0.1, max_height = 1})
local infoview = require('lean.infoview') local fixtures = require('tests.fixtures') local helpers = require('tests.helpers') helpers.setup {} describe('infoview', function() local function update_enabled(state, _) local cursor_hold = string.find(vim.api.nvim_exec("autocmd CursorMoved <buffer>", true), "LeanInfoviewUpdate") local cursor_hold_i = string.find(vim.api.nvim_exec("autocmd CursorMovedI <buffer>", true), "LeanInfoviewUpdate") if state.mod then return cursor_hold and cursor_hold_i end return cursor_hold or cursor_hold_i end assert:register("assertion", "update_enabled", update_enabled) describe('CursorMoved(I)', function() it('enabled when opened', function(_) helpers.edit_lean_buffer(fixtures.lean3_project.some_existing_file) assert.initclosed.infoview() infoview.get_current_infoview():open() assert.opened.infoview() assert.update_enabled() end) it('remains enabled on BufEnter', function(_) helpers.edit_lean_buffer(fixtures.lean3_project.some_nested_existing_file) assert.buf.created.tracked() assert.opened_kept.pin_pos_changed.infoview() assert.update_enabled() end) it('remains enabled on WinEnter', function(_) vim.api.nvim_command('split') helpers.edit_lean_buffer(fixtures.lean3_project.some_existing_file) assert.buf.left.tracked() assert.win.created.tracked() assert.opened_kept.pin_pos_changed.infoview() assert.update_enabled() vim.api.nvim_command("close") assert.buf.left.tracked() assert.win.removed.tracked() helpers.edit_lean_buffer(fixtures.lean3_project.some_existing_file) assert.buf.left.tracked() assert.opened_kept.infoview() end) it('disabled when closed', function(_) infoview.get_current_infoview():close() assert.closed.infoview() assert.is_not.update_enabled() end) it('remains disabled on BufEnter', function(_) helpers.edit_lean_buffer(fixtures.lean3_project.some_nested_existing_file) assert.buf.left.tracked() assert.closed_kept.pin_pos_changed.infoview() assert.is_not.update_enabled() end) it('remains disabled on WinEnter', function(_) vim.api.nvim_command('split') helpers.edit_lean_buffer(fixtures.lean3_project.some_existing_file) assert.buf.left.tracked() assert.win.created.tracked() assert.closed_kept.pin_pos_changed.infoview() assert.is_not.update_enabled() vim.api.nvim_command("close") assert.buf.left.tracked() assert.win.removed.tracked() assert.closed_kept.pin_pos_changed.infoview() helpers.edit_lean_buffer(fixtures.lean3_project.some_existing_file) assert.buf.left.tracked() assert.closed_kept.pin_pos_changed.infoview() end) it('re-enabled when re-opened', function(_) infoview.get_current_infoview():open() assert.opened.infoview() assert.update_enabled() end) describe('new tab', function() it('disables independently', function(_) vim.api.nvim_command("tabnew") assert.buf.created.tracked() assert.win.created.tracked() helpers.edit_lean_buffer(fixtures.lean_project.some_existing_file) assert.initclosed.infoview() assert.is_not.update_enabled() vim.api.nvim_command("tabprevious") assert.buf.left.tracked() assert.win.left.tracked() assert.opened_kept.infoview() assert.opened_kept.infoview() assert.update_enabled() end) it('enables independently', function(_) infoview.get_current_infoview():close() assert.closed.infoview() assert.is_not.update_enabled() vim.api.nvim_command("tabnext") assert.buf.left.tracked() assert.win.left.tracked() infoview.get_current_infoview():open() assert.opened.infoview() assert.update_enabled() vim.api.nvim_command("tabprevious") assert.buf.left.tracked() assert.win.left.tracked() assert.closed_kept.infoview() assert.is_not.update_enabled() end) it('does not enable on irrelevant file BufEnter', function(_) vim.api.nvim_command("tabnext") assert.buf.left.tracked() assert.win.left.tracked() assert.opened_kept.infoview() assert.update_enabled() vim.api.nvim_command("edit temp") assert.buf.created.tracked() assert.opened_kept.infoview() assert.is_not.update_enabled() end) it('does not enable when re-opening on irrelevant file', function(_) infoview.get_current_infoview():close() assert.closed.infoview() assert.is_not.update_enabled() infoview.get_current_infoview():open() assert.opened.infoview() assert.is_not.update_enabled() end) it('enabled on relevant file BufEnter', function(_) helpers.edit_lean_buffer(fixtures.lean_project.some_existing_file) assert.buf.left.tracked() assert.opened_kept.infoview() assert.update_enabled() end) end) end) end)
object_building_kashyyyk_thm_kash_cave_myyydril_rope_support = object_building_kashyyyk_shared_thm_kash_cave_myyydril_rope_support:new { } ObjectTemplates:addTemplate(object_building_kashyyyk_thm_kash_cave_myyydril_rope_support, "object/building/kashyyyk/thm_kash_cave_myyydril_rope_support.iff")
---Profiler API documentation ---Functions for getting profiling data in runtime. ---More detailed profiling <https://www.defold.com/manuals/profiling/> and debugging <http://www.defold.com/manuals/debugging/> information available in the manuals. ---@class profiler profiler = {} ---pause on current frame profiler.MODE_PAUSE = nil ---start recording profiler.MODE_RECORD = nil ---continously show latest frame profiler.MODE_RUN = nil ---pause at peak frame profiler.MODE_SHOW_PEAK_FRAME = nil ---show full profiler ui profiler.VIEW_MODE_FULL = nil ---show mimimal profiler ui profiler.VIEW_MODE_MINIMIZED = nil ---Creates and shows or hides and destroys the on-sceen profiler ui ---The profiler is a real-time tool that shows the numbers of milliseconds spent ---in each scope per frame as well as counters. The profiler is very useful for ---tracking down performance and resource problems. ---@param enabled boolean true to enable, false to disable function profiler.enable_ui(enabled) end ---Get the percent of CPU usage by the application, as reported by the OS. --- This function is not available on HTML5. ---For some platforms ( Android, Linux and Windows), this information is only available ---by default in the debug version of the engine. It can be enabled in release version as well ---by checking track_cpu under profiler in the game.project file. ---(This means that the engine will sample the CPU usage in intervalls during execution even in release mode.) ---@return number of CPU used by the application function profiler.get_cpu_usage() end ---Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS. --- This function is not available on HTML5. ---The values are gathered from internal OS functions which correspond to the following; --- ---OS Value --- iOS MacOSAndrod Linux <https://en.wikipedia.org/wiki/Resident_set_size> Resident memory --- Windows <https://en.wikipedia.org/wiki/Working_set> Working set --- HTML5 Not available ---@return number used by the application function profiler.get_memory_usage() end ---Get the number of recorded frames in the on-screen profiler ui recording buffer ---@return number the number of recorded frames, zero if on-screen profiler is disabled function profiler.recorded_frame_count() end ---Set the on-screen profile mode - run, pause, record or show peak frame ---@param mode constant the mode to set the ui profiler in function profiler.set_ui_mode(mode) end ---Set the on-screen profile view mode - minimized or expanded ---@param mode constant the view mode to set the ui profiler in function profiler.set_ui_view_mode(mode) end ---Shows or hides the time the engine waits for vsync in the on-screen profiler ---Each frame the engine waits for vsync and depending on your vsync settings and how much time ---your game logic takes this time can dwarf the time in the game logic making it hard to ---see details in the on-screen profiler graph and lists. ---Also, by hiding this the FPS times in the header show the time spent each time excuding the ---time spent waiting for vsync. This shows you how long time your game is spending actively ---working each frame. ---This setting also effects the display of recorded frames but does not affect the actual ---recorded frames so it is possible to toggle this on and off when viewing recorded frames. ---By default the vsync wait times is displayed in the profiler. ---@param visible boolean true to include it in the display, false to hide it. function profiler.set_ui_vsync_wait_visible(visible) end ---Pauses and displays a frame from the recording buffer in the on-screen profiler ui ---The frame to show can either be an absolute frame or a relative frame to the current frame. ---@param frame_index table a table where you specify one of the following parameters: function profiler.view_recorded_frame(frame_index) end return profiler
local term = require'toggleterm.terminal'.Terminal local tig = term:new({cmd = 'tig', direction = 'float', hidden = true}) function TigToggle() tig:toggle() end local wk = require("which-key") wk.setup() wk.register({ ['<leader>'] = { ['<leader>'] = { name = 'toggle', z = { '<cmd>ZenMode<cr>', 'Toggle ZenMode' }, b = { '<cmd>NvimTreeToggle<cr>', 'Toggle File Tree' }, g = { '<cmd>lua TigToggle()<cr>', 'Toggle Tig' }, w = { '<cmd>WhichKey<cr>', 'Toggle WhichKey' }, -- s = { '<cmd>SidebarNvimToggle<cr>', 'Toggle Sidebar Toggle' }, d = { '<cmd>TroubleToggle document_diagnostics<cr>', 'Toggle Diagnostics (document)' }, D = { '<cmd>TroubleToggle workspace_diagnostics<cr>', 'Toggle Diagnostics (workspace)' }, m = { '<cmd>Glow<cr>', 'Toggle Markdown Preview' }, o = { '<cmd>AerialToggle<cr>', 'Toggle Outline' }, }, ['f'] = { name = 'find', f = { '<cmd>Telescope live_grep_raw<cr>', 'find contents' }, p = { '<cmd>Telescope find_files<cr>', 'find files' }, b = { '<cmd>Telescope buffers<cr>', 'find buffers' }, }, F = { '<cmd>lua require("spectre").open()<cr>', 'find and replace with dark power' }, ['r'] = { name = 'run', f = { '<cmd>RunFile<cr>', 'run file' }, p = { '<cmd>RunProject<cr>', 'run project' }, }, s = { '<cmd>HopChar1<cr>', 'hop to char' }, S = { '<cmd>HopChar2<cr>', 'hop to chars' }, j = { '<cmd>HopLineAC<cr>', 'hop to under line' }, k = { '<cmd>HopLineBC<cr>', 'hop to upper line' }, Q = { '<cmd>BufDel!<cr>', 'close buffer force' }, q = { '<cmd>BufDel<cr>', 'close buffer' }, -- nc = { ':lua require("neogen").generate({ type = "class" })<cr>' }, wip ca = { '<cmd>Lspsaga code_action<cr>', 'code action' }, rn = { '<cmd>Lspsaga rename<cr>', 'rename' }, }, }) wk.register({ ['<c-w>'] = { z = { '<cmd>ZoomWinTabToggle<cr>', 'zoom pane' }, }, }) wk.register({ ['g'] = { name = 'goto', ['p'] = { name = 'preview', d = { '<cmd>lua require("goto-preview").goto_preview_definition()<CR>', 'preview definition' }, i = { '<cmd>lua require("goto-preview").goto_preview_implementation()<CR>', 'preview implementation' }, r = { '<cmd>lua require("goto-preview").goto_preview_references()<CR>', 'preview references' }, }, P = { '<cmd>lua require("goto-preview").close_all_win()<CR>', 'close all preview' }, b = { '<cmd>BufferLinePick<CR>', 'pick buffer' }, w = { '<cmd>Chowcho<cr>', 'choose pane'}, }, }) wk.register({ ['<leader>'] = { c = { '<cmd>OSCYank<CR>', 'OSCYank' }, }, }, { mode = 'v' })
local Gradient = 1 local Gradient = 2 local Gradient = 3 --these thing is frantastic24 code thank you :'D i want to be friend :>>>>>>>>>>>>>>>>>>>]]]]] lol function onCreate() if flashingLights == true then makeLuaSprite('gradient1','scott/grad1'); setProperty('gradient1.alpha', 0) setObjectCamera('gradient1', 'hud'); setBlendMode('gradient1', 'add') makeLuaSprite('gradient2','scott/grad2'); setObjectCamera('gradient2', 'hud') setProperty('gradient2.alpha', 0) setBlendMode('gradient2', 'add') makeLuaSprite('gradient3','scott/grad3'); setObjectCamera('gradient3', 'hud') setProperty('gradient3.alpha', 0); setBlendMode('gradient3', 'add') makeLuaSprite('gradient','scott/grad4') setObjectCamera('gradient', 'hud'); setProperty('gradient.alpha', 0) setBlendMode('gradient', 'add') end if flashingLights == true then addLuaSprite('gradient', true) addLuaSprite('gradient1', true) addLuaSprite('gradient2', true) addLuaSprite('gradient3', true) end end function onEvent(name, value1, value2) if name == 'FG Flash' then if value1 == '0' then --Makes the gradient static doTweenAlpha('dient1', 'gradient', 0, 0.8, 'linear') setProperty('gradient.alpha', 1) end end if value2 == '0' then if curBeat % 2 == 0 then --Makes the gradient Flash at 1 beat and i dont freakin know why it still work even its not on the function onBeatHit bruh function onBeatHit() if Gradient then Gradient = getRandomInt(1, 3) --yayaya i know lightning and gradient is same color so it needs the gradient to be same as lightning's colors if Gradient == 1 then --well about that mr.smart, i dont want a freakin long codes that mess my work just like this its meesssssed doTweenAlpha('dient4', 'gradient1', 0, 0.8, 'linear') setProperty('gradient1.alpha', 0.6) elseif Gradient == 2 then doTweenAlpha('dient5', 'gradient2', 0, 0.8, 'linear') setProperty('gradient2.alpha', 0.6) elseif Gradient == 3 then doTweenAlpha('dient6', 'gradient3', 0, 0.8, 'linear') setProperty('gradient3.alpha', 0.6) end end math.randomseed(curStep * 1) -- runTimer('stop', 0.5); --addLuaSprite('bluelight', false) --dont mind these codes i used this as template of loghtning timer because Gradient event doesn't work idk why setProperty('blueliht.x', getRandomInt(xx1, xx12)) --THIS end end end
enableAlerts( 1 ) local script = "This is a test of a very long string.".. "The quick brown fox jumped over the lazy dog"; pushChat( script );
local InCombat = function() end local OutCombat = function() end XB.CR:Add(5, '[XB] Priest - Basic', InCombat, OutCombat)
if SERVER then resource.AddFile('materials/vgui/ttt/hud_icon_dancing.png') end AddCSLuaFile() ENT.Type = "anim" ENT.Base = "ttt_basegrenade_proj" ENT.Model = Model("models/weapons/w_eq_fraggrenade_thrown.mdl") if (CLIENT) then hook.Add('Initialize', 'ttt2_dance_grenade_status_init', function() STATUS:RegisterStatus('ttt2_dance_grenade_status', { hud = Material('vgui/ttt/hud_icon_dancing.png'), type = 'bad' }) end) end function ENT:Initialize() self:SetModel(self.Model) self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_BBOX) self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE) self:Activate() if SERVER then self.CurrentSong = DANCEGRENADE:GetRandomSong() self.SongTimer = "" self.Exploded = false end end function ENT:GetNearbyDancers() local pos = self:GetPos() local near = ents.FindInSphere(pos, GetConVar("ttt_dance_grenade_distance"):GetInt()) if not near then return end local near_players = {} local ent = nil for i=1, #near do ent = near[i] if IsValid(ent) and ent:IsPlayer() then table.insert(near_players, { ent=ent, dist=pos:LengthSqr()}) end end return near_players end function ENT:StartExplosion(tr) if SERVER then self:SetMoveType(MOVETYPE_NONE) -- pull out of the surface if tr.Fraction != 1.0 then self:SetPos(tr.HitPos + tr.HitNormal * 0.6) end local pos = self:GetPos() self.SongTimer = 'ttt2_dance_grenade_timer_' .. tostring(CurTime()) self.tick = 0 self:EmitSound(self.CurrentSong, 130) timer.Create(self.SongTimer, GetConVar("ttt_dance_grenade_duration"):GetInt(), 1, function() timer.Stop(self.SongTimer) self:Remove() end) else PrintTable(effects.EffectTable) local spos = self:GetPos() local trs = util.TraceLine({start=spos + Vector(0,0,64), endpos=spos + Vector(0,0,-128), filter=self}) util.Decal("Scorch", trs.HitPos + trs.HitNormal, trs.HitPos - trs.HitNormal) self:SetDetonateExact(0) end end function ENT:Explode(tr) if SERVER then if not self.Exploded then self.Exploded = true self:StartExplosion(tr) end local pos = self:GetPos() local clr = Color( math.random(255), math.random(255), math.random(255), math.random(255) ) local r = bit.band( clr.r, 255 ) local g = bit.band( clr.g, 255 ) local b = bit.band( clr.b, 255 ) local a = bit.band( clr.a, 255 ) local numberClr = bit.lshift( r, 24 ) + bit.lshift( g, 16 ) + bit.lshift( b, 8 ) + a local effect = EffectData() effect:SetOrigin(pos) effect:SetRadius(GetConVar("ttt_dance_grenade_distance"):GetInt()) effect:SetColor(numberClr) effect:SetMagnitude(0.5) effect:SetScale(1) util.Effect("dance_sphere", effect, true, true) util.Effect("sparks", effect, true, true) util.Effect("VortDispel", effect, true, true) if tr.Fraction != 1.0 then effect:SetNormal(tr.HitNormal) end local dancers = self:GetNearbyDancers() -- table.SortByMember(dancers, "dist", function(a, b) return a > b end) for i=1,#dancers do local dancer = dancers[i] if dancer and IsValid(dancer.ent) then self:StartDance(dancer.ent, self:GetThrower()) dancer.ent:ViewPunch(Angle( (math.random() * 60) - 20, (math.random() * 60) - 20, (math.random() * 40) - 10 )) dancer.ent:ScreenFade( SCREENFADE.IN, Color( math.random(255), math.random(255), math.random(255), 128 ), 0.3, 0 ) end end end end function ENT:OnRemove() local players = player.GetAll() for i=1,#players do hook.Call('StopDancing', nil, players[i]) end if SERVER then self:StopSound(self.CurrentSong) end end if CLIENT then net.Receive('ttt2_dance_grenade_dance', function() local target = net.ReadEntity() if not target or not IsValid(target) then return end if target:Alive() then target.dancing = net.ReadBool() if target.dancing then -- start dance animation if math.random(0, 1) == 0 then target:AnimRestartGesture(GESTURE_SLOT_CUSTOM, ACT_GMOD_GESTURE_TAUNT_ZOMBIE, false) else target:AnimRestartGesture(GESTURE_SLOT_CUSTOM, ACT_GMOD_TAUNT_DANCE, false) end else -- stop dance animation target:AnimResetGestureSlot(GESTURE_SLOT_CUSTOM) end else target:AnimResetGestureSlot(GESTURE_SLOT_CUSTOM) end end) -- draw a screen overlay hook.Add('RenderScreenspaceEffects', 'ttt2_dancegun_screen_overlay', function() return end) end if SERVER then util.AddNetworkString('ttt2_dance_grenade_dance') function ENT:StartDance(ply, attacker) if not ply or not IsValid(ply) then return end if not ply:IsPlayer() then return end if not ply:IsFrozen() then hook.Call('StartDancing', nil, ply) end end hook.Add('StartDancing', 'ttt2_dance_grenade_start_dance', function(ply) if not IsValid(ply) or not ply:IsPlayer() then return end STATUS:AddStatus(ply, 'ttt2_dance_grenade_status') ply:Freeze(true) ply.dancing = true net.Start('ttt2_dance_grenade_dance') net.WriteEntity(ply) net.WriteBool(true) net.Broadcast() return true end) hook.Add('StopDancing', 'ttt2_dance_grenade_stop_dance', function(ply) if not IsValid(ply) or not ply:IsPlayer() then return end STATUS:RemoveStatus(ply, 'ttt2_dance_grenade_status') ply:Freeze(false) ply.dancing = false net.Start('ttt2_dance_grenade_dance') net.WriteEntity(ply) net.WriteBool(false) net.Broadcast() return true end) -- handle death of dancing player hook.Add('PlayerDeath', 'ttt2_dancegun_player_death', function(ply) if not IsValid(ply) or not ply:IsPlayer() then return end STATUS:RemoveStatus(ply, 'ttt2_dance_grenade_status') ply:Freeze(false) ply.dancing = false net.Start('ttt2_dance_grenade_dance') net.WriteEntity(ply) net.WriteBool(false) net.Broadcast() end) -- stop dancing on round end hook.Add('TTTEndRound', 'ttt2_dancegun_end_round', function(ply) for _, p in ipairs(player.GetAll()) do if p.dancing then STATUS:RemoveStatus(p, 'ttt2_dance_grenade_status') p:Freeze(false) p.dancing = false net.Start('ttt2_dance_grenade_dance') net.WriteEntity(p) net.WriteBool(false) net.Broadcast() end end end) end
local M = {} M.defaults = { picker = "telescope", default_remote = { "upstream", "origin" }, reaction_viewer_hint_icon = "", user_icon = " ", comment_icon = " ", outdated_icon = " ", resolved_icon = " ", timeline_marker = "", timeline_indent = "2", right_bubble_delimiter = "", left_bubble_delimiter = "", github_hostname = "", snippet_context_lines = 4, file_panel = { size = 10, use_icons = true, }, mappings = { issue = { close_issue = "<space>ic", reopen_issue = "<space>io", list_issues = "<space>il", reload = "<C-r>", open_in_browser = "<C-b>", copy_url = "<C-y>", add_assignee = "<space>aa", remove_assignee = "<space>ad", create_label = "<space>lc", add_label = "<space>la", remove_label = "<space>ld", goto_issue = "<space>gi", add_comment = "<space>ca", delete_comment = "<space>cd", next_comment = "]c", prev_comment = "[c", react_hooray = "<space>rp", react_heart = "<space>rh", react_eyes = "<space>re", react_thumbs_up = "<space>r+", react_thumbs_down = "<space>r-", react_rocket = "<space>rr", react_laugh = "<space>rl", react_confused = "<space>rc", }, pull_request = { checkout_pr = "<space>po", merge_pr = "<space>pm", list_commits = "<space>pc", list_changed_files = "<space>pf", show_pr_diff = "<space>pd", add_reviewer = "<space>va", remove_reviewer = "<space>vd", close_issue = "<space>ic", reopen_issue = "<space>io", list_issues = "<space>il", reload = "<C-r>", open_in_browser = "<C-b>", copy_url = "<C-y>", goto_file = "gf", add_assignee = "<space>aa", remove_assignee = "<space>ad", create_label = "<space>lc", add_label = "<space>la", remove_label = "<space>ld", goto_issue = "<space>gi", add_comment = "<space>ca", delete_comment = "<space>cd", next_comment = "]c", prev_comment = "[c", react_hooray = "<space>rp", react_heart = "<space>rh", react_eyes = "<space>re", react_thumbs_up = "<space>r+", react_thumbs_down = "<space>r-", react_rocket = "<space>rr", react_laugh = "<space>rl", react_confused = "<space>rc", }, review_thread = { goto_issue = "<space>gi", add_comment = "<space>ca", add_suggestion = "<space>sa", delete_comment = "<space>cd", next_comment = "]c", prev_comment = "[c", select_next_entry = "]q", select_prev_entry = "[q", react_hooray = "<space>rp", react_heart = "<space>rh", react_eyes = "<space>re", react_thumbs_up = "<space>r+", react_thumbs_down = "<space>r-", react_rocket = "<space>rr", react_laugh = "<space>rl", react_confused = "<space>rc", close_review_tab = "<C-c>", }, repo = {}, submit_win = { close_review_win = "<C-c>", approve_review = "<C-a>", comment_review = "<C-m>", request_changes = "<C-r>", }, review_diff = { add_review_comment = "<space>ca", add_review_suggestion = "<space>sa", select_next_entry = "]q", select_prev_entry = "[q", focus_files = "<leader>e", toggle_files = "<leader>b", next_thread = "]t", prev_thread = "[t", close_review_tab = "<C-c>", toggle_viewed = "<leader><space>", }, file_panel = { next_entry = "j", prev_entry = "k", select_entry = "<cr>", refresh_files = "R", select_next_entry = "]q", select_prev_entry = "[q", focus_files = "<leader>e", toggle_files = "<leader>b", close_review_tab = "<C-c>", toggle_viewed = "<leader><space>", }, }, } M._config = M.defaults function M.get_config() return M._config end function M.setup(user_config) user_config = user_config or {} M._config = require("octo.utils").tbl_deep_clone(M.defaults) require("octo.utils").tbl_soft_extend(M._config, user_config) M._config.file_panel = vim.tbl_deep_extend("force", M.defaults.file_panel, user_config.file_panel or {}) -- If the user provides key bindings: use only the user bindings. if user_config.mappings then M._config.mappings.issue = (user_config.mappings.issue or M._config.mappings.issue) M._config.mappings.pull_request = (user_config.mappings.pull_request or M._config.mappings.pull_request) M._config.mappings.review_thread = (user_config.mappings.review_thread or M._config.mappings.review_thread) M._config.mappings.review = (user_config.mappings.review or M._config.mappings.review) M._config.mappings.file_panel = (user_config.mappings.file_panel or M._config.mappings.file_panel) end end return M
-- influxdb line protocol -- original source: https://github.com/p0pr0ck5/lua-resty-influx/blob/master/lib/resty/influx/lineproto.lua local str_gsub = string.gsub local str_find = string.find local tbl_cat = table.concat local tbl_insert = table.insert local bool_strs = { '^t$', '^T$', '^true$', '^True$', '^TRUE$', '^f$', '^F$', '^false$', '^False$', '^FALSE$' } -- quoting routines based on -- https://docs.influxdata.com/influxdb/v1.0/write_protocols/line_protocol_reference/ -- local function quote_measurement(value) local value_type = type(value) if value_type == 'boolean' or value_type == 'number' then value = tostring(value) elseif value_type ~= 'string' then return nil, 'invalid value type '..value_type end value = str_gsub(value, ',', '\\,') value = str_gsub(value, ' ', '\\ ') return value end local function quote_field_key(key) key = tostring(key) if not key then return nil, 'unable to cast '..type(key)..' to string' end key = str_gsub(key, ',', '\\,') key = str_gsub(key, '=', '\\=') key = str_gsub(key, ' ', '\\ ') return key end local function quote_field_value(value) local value_type = type(value) if value_type == 'string' then -- number (float or integer) checks if str_find(value, '^%d+i$') then return value end -- boolean checks for i=1,10 do if str_find(value, bool_strs[i]) then return value end end value = str_gsub(value, '"', '\\"') return ('"%s"'):format(value) elseif value_type == 'boolean' or value_type == 'number' then return tostring(value) end return nil, 'invalid field value type '..value_type end local quote_tag_key = quote_field_key local function quote_tag_value(value) local value_type = type(value) if value_type == 'string' or value_type == 'boolean' or value_type == 'number' then return quote_field_key(value) end return nil, 'invalid tag value type '..value_type end local function build_field_set(fields) if type(fields) ~= 'table' then return nil, 'invalid fields type, should be table' end local field_set = {} for key, val in pairs(fields) do local k, err = quote_field_key(key) if not k then return nil, err end local v, err = quote_field_value(val) if not v then return nil, err end tbl_insert(field_set, ("%s=%s"):format(k, v)) end if #field_set == 0 then return nil, 'invalid field set, shouldn\'t be empty' end return field_set end local function build_tag_set(tags) if not tags then return nil end if type(tags) ~= 'table' then return nil, 'invalid tags type, should be table' end local tag_set = {} for tag, val in pairs(tags) do local k = quote_tag_key(tag) if not k then return nil, err end local v = quote_tag_value(val) if not v then return nil, err end tbl_insert(tag_set, ("%s=%s"):format(k, v)) end if #tag_set == 0 then return nil end return tag_set end local _M = {} _M.version = "0.3" function _M.build_str(measurement, fields, tags, timestamp) local err measurement, err = quote_measurement(measurement) if not measurement then return nil, err end local field_set, err = build_field_set(fields) if not field_set then return nil, err end local tag_set, err = build_tag_set(tags) -- it is fine to give empty tags table, only check for errors if err then return nil, err end if timestamp then if tag_set then return ("%s,%s %s %s"):format(measurement, tbl_cat(tag_set, ','), tbl_cat(field_set, ','), timestamp) end return ("%s %s %s"):format(measurement, tbl_cat(field_set, ','), timestamp) end if tag_set then return ("%s,%s %s"):format(measurement, tbl_cat(tag_set, ','), tbl_cat(field_set, ',')) end return ("%s %s"):format(measurement, tbl_cat(field_set, ',')) end return _M
---------------Favorites--------------- Alert... Online daters detected - 977396990 Im gay - 692388932 Good Shit - 260845388 Girl Moan - 529108213 Girl Uhh - 187379457 buttsex - 933059220 Girl Sucking - 811703847 Nepalm Sticks To Kids - 947742704 Masturbate - 581118861 1122592909 - wii moan 1060962895 - Hitler is PewDiePie nigga tree - 1108373255 I'm begin raped - 880374898 Black Y'all - 731673813 Aye Mami, You Sexy - 357580144 suck the nigga dick for free - 246354400 1122592909 - wii moan Moan Remix - 1090275897 Another Masturbate - 786129624 Moaning - 889417606 Oh Boy EAR RAPE - 482642374
--- This scripts loads Nevermore from the server. -- It also replicates the into ReplicatedStorage for internal usage. ----------------------- -- UTILITY FUNCTIONS -- ----------------------- local TestService = game:GetService('TestService') local ReplicatedStorage = game:GetService("ReplicatedStorage") local function WaitForChild(Parent, Name, TimeLimit) -- Waits for a child to appear. Not efficient, but it shoudln't have to be. It helps with debugging. -- Useful when ROBLOX lags out, and doesn't replicate quickly. -- @param TimeLimit If TimeLimit is given, then it will return after the timelimit, even if it hasn't found the child. assert(Parent ~= nil, "Parent is nil") assert(type(Name) == "string", "Name is not a string.") local Child = Parent:FindFirstChild(Name) local StartTime = tick() local Warned = false while not Child and Parent do wait(0) Child = Parent:FindFirstChild(Name) if not Warned and StartTime + (TimeLimit or 5) <= tick() then Warned = true warn("Infinite yield possible for WaitForChild(" .. Parent:GetFullName() .. ", " .. Name .. ")") if TimeLimit then return Parent:FindFirstChild(Name) end end end if not Parent then warn("Parent became nil.") end return Child end ------------- -- LOADING -- ------------- -- Wait for parent to resolve while not script.Parent do wait(0) end -- Identify the modular script local NevermoreModularScript = ReplicatedStorage:FindFirstChild("NevermoreEngine") if not NevermoreModularScript then local NevermoreModularScriptSource = WaitForChild(script.Parent, "NevermoreEngine") NevermoreModularScript = NevermoreModularScriptSource:Clone() NevermoreModularScript.Archivable = false end local Nevermore = require(NevermoreModularScript) -- Set identifier, and initiate. Nevermore.Initiate() NevermoreModularScript.Parent = ReplicatedStorage
local twentyfourseven_shops = { { ['x'] = 1961.1140136719, ['y'] = 3741.4494628906, ['z'] = 32.34375 }, { ['x'] = 1392.4129638672, ['y'] = 3604.47265625, ['z'] = 34.980926513672 }, { ['x'] = 546.98962402344, ['y'] = 2670.3176269531, ['z'] = 42.156539916992 }, { ['x'] = 2556.2534179688, ['y'] = 382.876953125, ['z'] = 108.62294769287 }, { ['x'] = -1821.9542236328, ['y'] = 792.40191650391, ['z'] = 138.13920593262 }, { ['x'] = 128.1410369873, ['y'] = -1286.1120605469, ['z'] = 29.281036376953 }, { ['x'] = -1223.6690673828, ['y'] = -906.67517089844, ['z'] = 12.326356887817 }, { ['x'] = -708.19256591797, ['y'] = -914.65264892578, ['z'] = 19.215591430664 }, { ['x'] = 26.419162750244, ['y'] = -1347.5804443359, ['z'] = 29.497024536133 }, { ['x'] = 1135.67, ['y'] = -982.177, ['z'] = 46.4158 }, { ['x'] = -47.124, ['y'] = -1756.52, ['z'] = 29.421 }, { ['x'] = -1487.48, ['y'] = -378.918, ['z'] = 40.1634}, { ['x'] = 374.208, ['y'] = 328.134, ['z'] = 103.566 }, { ['x'] = 2676.99, ['y'] = 3281.37, ['z'] = 55.2412 }, { ['x'] = -2967.86, ['y'] = 391.037, ['z'] = 15.0433 }, } Citizen.CreateThread(function() for k,v in ipairs(twentyfourseven_shops)do local blip = AddBlipForCoord(v.x, v.y, v.z) SetBlipSprite(blip, 52) SetBlipScale(blip, 0.8) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString("FOOD") EndTextCommandSetBlipName(blip) end end) local showfoodmenu = true Citizen.CreateThread(function() while true do Citizen.Wait(0) local pos = GetEntityCoords(GetPlayerPed(-1), false) for k,v in ipairs(twentyfourseven_shops) do if(Vdist(v.x, v.y, v.z, pos.x, pos.y, pos.z) < 20.0)then DrawMarker(1, v.x, v.y, v.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, 1.5001, 0, 25, 165, 165, 0,0, 0,0) if(Vdist(v.x, v.y, v.z, pos.x, pos.y, pos.z) < 1.0)then DisplayHelpText("Appuyer sur ~INPUT_CONTEXT~ pour acheter un ~y~menu~w~.") if(IsControlJustReleased(1, 51))then if showfoodmenu then ShopMenu() Menu.hidden = false showfoodmenu = false else Menu.hidden = true showfoodmenu = true end end Menu.renderGUI() end end end end end) function DisplayHelpText(str) SetTextComponentFormat("STRING") AddTextComponentString(str) DisplayHelpTextFromStringLabel(0, 0, 1, -1) end
module:set_global(); local jid_bare = require "util.jid".bare; local st = require "util.stanza"; local xmlns_muc_user = "http://jabber.org/protocol/muc#user"; local ip_bans = module:shared("bans"); local full_sessions = prosody.full_sessions; local function ban_ip(session, from) local ip = session.ip; if not ip then module:log("warn", "Failed to ban IP (IP unknown) for %s", session.full_jid); return; end local banned_from = ip_bans[ip]; if not banned_from then banned_from = {}; ip_bans[ip] = banned_from; end banned_from[from] = true; module:log("debug", "Banned IP address %s from %s", ip, from); end local function check_for_incoming_ban(event) local stanza = event.stanza; local to_session = full_sessions[stanza.attr.to]; if to_session then local directed = to_session.directed; local from = stanza.attr.from; if directed and directed[from] and stanza.attr.type == "unavailable" then -- This is a stanza from somewhere we sent directed presence to (may be a MUC) local x = stanza:get_child("x", xmlns_muc_user); if x then for status in x:childtags("status") do if status.attr.code == '301' then ban_ip(to_session, jid_bare(from)); end end end end end end local function check_for_ban(event) local ip = event.origin.ip; local to = jid_bare(event.stanza.attr.to); if ip_bans[ip] and ip_bans[ip][to] then event.origin.send(st.error_reply(event.stanza, "auth", "forbidden") :tag("x", { xmlns = xmlns_muc_user }) :tag("status", { code = '301' })); return true; end module:log("debug", "Not banned: %s from %s", ip, to) end function module.add_host(module) module:hook("presence/full", check_for_incoming_ban, 100); module:hook("pre-presence/full", check_for_ban, 100); end
-- variables print('\n --- Variables') varString = 'String' varBool = true varNumber = 1 varTable1 = {1,2,3} varTable2 = { keyA = 'valueA', keyB = 'valueB', [10] = '10' } -- io print('\n --- IO') print('Hello World') print('var', varString) print('var '..varString) print('varTable', varTable1[1]) print('varTable', varTable2.keyA) io.write('varTable ', varTable2[10], '\n') -- io.write('\nRead io: ') -- readIo = io.read() -- print(readIo) -- repetition print('\n --- Repetition') for i=0,3 do print(i) end i = 0 while i <= 3 do print(i) i = i + 1 end -- selection print('\n --- Selection') if (varBool) then print('varBool') end if (not varBool) then print('varBool') else print('not varBool') end if (not varBool) then print('varBool') elseif varBool then print('varBoll elseif') end -- tables print('\n --- Tables') table.insert(varTable1, 20) table.remove(varTable1, #varTable1) for key,value in ipairs(varTable1) do print(key, value) end for key, value in pairs(varTable2) do print(key, value) end varTable3 = { name = 'lua', printName = function(self) print(self.name) end } varTable3:printName() -- functions print('\n--- Functions') function foo(bar) print(bar) end foo('Hello') -- module print('\n--- Modules') module = require './module' sum = module.sum(1,2) print(sum) -- require './module' -- sum = module.sum(1,2) -- print(sum)
object_tangible_loot_creature_loot_collections_fish_tank_front_panel = object_tangible_loot_creature_loot_collections_shared_fish_tank_front_panel:new { } ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_fish_tank_front_panel, "object/tangible/loot/creature/loot/collections/fish_tank_front_panel.iff")
-- -- Copyright (c) 2018 Milos Tosic. All rights reserved. -- License: http://www.opensource.org/licenses/BSD-2-Clause -- -------------------------------------------------------- -- directories -------------------------------------------------------- function script_dir() return path.getdirectory(debug.getinfo(2, "S").source:sub(2)) .. "/" end RTM_SCRIPTS_DIR = script_dir() RTM_ROOT_DIR = path.getabsolute(RTM_SCRIPTS_DIR .. "../") .. "/" -- project root RTM_BUILD_DIR = RTM_ROOT_DIR .. ".build/" -- temp build files RTM_LOCATION_PATH = "" -- solution/makefile/etc. RTM_PROJECT_DIRS = {} RTM_PROJECT_PATHS = {} newoption { trigger = "project-dirs", description = "Specify file with project search paths table (has to be named RTM_PROJECT_DIR_PATHS)" } local customProjectDirs = _OPTIONS["project-dirs"] if (customProjectDirs == nil) then customProjectDirs = script_dir() .. "rtm_paths.lua" end -- could be a relative path if (not os.isfile(customProjectDirs)) then customProjectDirs = _WORKING_DIR .. '/' .. customProjectDirs end if (os.isfile(customProjectDirs)) then dofile (customProjectDirs) for _,pathTable in ipairs(RTM_PROJECT_DIR_PATHS) do local relative = pathTable[1] local path = pathTable[2] if relative then path = RTM_ROOT_DIR .. path end if os.isdir(path) then table.insert(RTM_PROJECT_DIRS, path) end end else print("ERROR: Custom project directories script not found at " .. customProjectDirs) os.exit() return end dofile (RTM_SCRIPTS_DIR .. "toolchain.lua") if _ACTION == "clean" then rmdir(RTM_BUILD_DIR) os.exit() return end -------------------------------------------------------- -- compiler flags -------------------------------------------------------- Flags_ThirdParty = { "StaticRuntime", "NoEditAndContinue", "NoPCH", "MinimumWarnings" } Flags_Libraries = { "StaticRuntime", "NoEditAndContinue", "NoRTTI", "ExtraWarnings", "NoExceptions" } Flags_Tests = { "StaticRuntime", "NoEditAndContinue", "NoRTTI", "ExtraWarnings" } Flags_Cmd = { "StaticRuntime", "NoEditAndContinue", "NoRTTI", "ExtraWarnings", "NoExceptions" } Flags_QtTool = { "StaticRuntime", "NoEditAndContinue", "NoRTTI", "ExtraWarnings" } ExtraFlags_Debug = { "Symbols" } ExtraFlags_Release = { "NoFramePointer", "OptimizeSpeed", "NoBufferSecurityCheck", "Symbols" } ExtraFlags_Retail = { "NoFramePointer", "OptimizeSpeed", "NoBufferSecurityCheck" } -------------------------------------------------------- -- utility functions to check for target compiler -------------------------------------------------------- function actionUsesGCC() return ("gmake" == _ACTION or "codelite" == _ACTION or "codeblocks" == _ACTION or "xcode3" == _ACTION) end function actionUsesMSVC() return (_ACTION ~= nil and _ACTION:find("vs")) end function actionUsesXcode() return (_ACTION ~= nil and _ACTION:find("xcode")) end -- has to be called from an active solution function setPlatforms() if actionUsesXcode() then platforms { "Universal" } elseif actionUsesMSVC() then if not (getTargetOS() == "durango") and not (getTargetOS() == "orbis") and not (getTargetOS() == "winphone8") and not (getTargetOS() == "winphone81") -- not (getTargetOS() == "winstore81") and -- not (getTargetOS() == "winstore82") then -- these platforms set their own platform config platforms { "x32", "x64" } end else platforms { "x32", "x64", "native" } end configuration {} if not toolchain() then return -- no action specified end end -------------------------------------------------------- -- fixup for precompiled header path -------------------------------------------------------- function getPCHPath(_path, _projectName, _projType) local fullPath = _path .. _projectName .. "_pch.h" if os.isfile(fullPath) == false then return nil end local retPath = _projectName .. "_pch.h" if actionUsesGCC() then retPath = _path .. retPath end return retPath end function addPCH(_path, _name) local PCH = getPCHPath(_path, _name) if PCH ~= nil then pchheader (PCH) pchsource (_path .. _name .. "_pch.cpp") end end -------------------------------------------------------- -- Library types -------------------------------------------------------- Lib = { Runtime = {}, Tool = {}, Game = {} } -------------------------------------------------------- -- configuration specific defines -------------------------------------------------------- Defines_Debug = { "RTM_DEBUG_BUILD", "_DEBUG", "DEBUG" } Defines_Release = { "RTM_RELEASE_BUILD", "NDEBUG" } Defines_Retail = { "RTM_RETAIL_BUILD", "NDEBUG", "RETAIL" } dofile (RTM_SCRIPTS_DIR .. "project_3rd.lua") dofile (RTM_SCRIPTS_DIR .. "project_cmdtool.lua") dofile (RTM_SCRIPTS_DIR .. "project_game.lua") dofile (RTM_SCRIPTS_DIR .. "project_lib.lua") dofile (RTM_SCRIPTS_DIR .. "project_lib_sample.lua") dofile (RTM_SCRIPTS_DIR .. "project_lib_test.lua") dofile (RTM_SCRIPTS_DIR .. "project_lib_tool.lua") dofile (RTM_SCRIPTS_DIR .. "project_qt.lua") -------------------------------------------------------- -- helper functions -------------------------------------------------------- function mergeTwoTables(_table1, _table2) table1 = table1 or {} table2 = table2 or {} local mergedTable = {} local hash = {} for _,v1 in ipairs(_table1) do if (not hash[v1]) then table.insert(mergedTable, v1) hash[v1] = true end end for _,v2 in ipairs(_table2) do if (not hash[v2]) then table.insert(mergedTable, v2) hash[v2] = true end end return mergedTable end function mergeTables(_table1, _table2, _table3, _table4, _table5, _table6, _table7, _table8) _table1 = _table1 or {} _table2 = _table2 or {} _table3 = _table3 or {} _table4 = _table4 or {} _table5 = _table5 or {} _table6 = _table6 or {} _table7 = _table7 or {} _table8 = _table8 or {} local t1 = mergeTwoTables(_table1, _table2) local t2 = mergeTwoTables(_table3, _table4) local t3 = mergeTwoTables(_table5, _table6) local t4 = mergeTwoTables(_table7, _table8) return mergeTwoTables(mergeTwoTables(t1, t2), mergeTwoTables(t3, t4)) end ProjectLoad = { LoadOnly = {}, LoadAndAdd = {} } g_projectIsLoaded = {} g_fileIsLoaded = {} function getProjectDesc(_name) local descFn = _G["projectDescription_" .. _name] if descFn then return descFn() end -- no project desc (sample, test, etc.); return default return { version = "1.0.0.0", -- quad format for durango support publisher = { company = "RTM", organization = "RTM", location = "Belgrade", state = "Serbia", country = "Serbia", }, shortname = _name, longname = _name, description = _name .. " description", logo_square = RTM_SCRIPTS_DIR .. "deploy/res/logo_square.png", logo_wide = RTM_SCRIPTS_DIR .. "deploy/res/logo_wide.png" } end ProjectPath = { Dir = {}, Root = {} } function istable(_var) return type(_var) == "table" end function getProjectBaseName(_projectName) if istable(_projectName) then for _,name in ipairs(_projectName) do return name end end return _projectName end function getProjectFullName(_projectName) if istable(_projectName) then local ret = "" for _,name in ipairs(_projectName) do if ret == "" then ret = name else ret = ret .. "_" .. name end end return ret else return _projectName end end function find3rdPartyProject(_name) local name = getProjectBaseName(_name) for _,dir in ipairs(RTM_PROJECT_DIRS) do local libDir = dir .. name if os.isdir(libDir) then return libDir .. "/" end end for _,dir in ipairs(RTM_PROJECT_PATHS) do local dir_path = dir .. "/3rd/" .. _name if os.isdir(dir_path) then return dir_path end end return nil end function getProjectPath(_name, _pathType) local name = getProjectBaseName(_name) _pathType = _pathType or ProjectPath.Dir for _,dir in ipairs(RTM_PROJECT_DIRS) do local libDir = dir .. name if os.isdir(libDir) then if _pathType == ProjectPath.Dir then return libDir .. "/" else return dir end end end local projectPath = find3rdPartyProject(_name) if projectPath == nil then return "" end if _pathType == ProjectPath.Root then return path.getabsolute(projectPath .. "../") .. "/" else return projectPath end return "" end function addIncludePath(_name, _path) assert(_path ~= nil) if string.len(_path) == 0 then return end if os.isdir(_path) then includedirs { _path } end end function addInclude(_name, _projectName) local basename = getProjectBaseName(_projectName) local fullname = getProjectFullName(_projectName) local projectParentDir = getProjectPath(_projectName, ProjectPath.Root) if projectParentDir == nil then return false end -- search for it.. addIncludePath(_name, projectParentDir) addIncludePath(_name, projectParentDir .. basename .. "/include") addIncludePath(_name, projectParentDir .. basename .. "/inc") addIncludePath(_name, projectParentDir .. basename) end function addProject(_name) local deps = getProjectDependencies(_name) for _,dep in ipairs(deps) do addProject(dep) end local name = getProjectFullName(_name) if g_projectIsLoaded[name] == nil then local nameWithUnderscore = string.gsub(name, "-", "_") if _G["projectAdd_" .. nameWithUnderscore] ~= nil then -- prebuilt libs have no projects _G["projectAdd_" .. nameWithUnderscore]() g_projectIsLoaded[name] = true end end if g_projectIsLoaded[name] == nil then if find3rdPartyProject(name) == nil then g_projectIsLoaded[name] = true -- some 'missing' dependencies are actually system libraries, for example X11, GL, etc. print('WARNING: Dependency project not found - ' .. name .. ' - treating it as a system library') end end end function configDependency(_name, dependency) local name = getProjectFullName(_name) if _G["projectDependencyConfig_" .. name] ~= nil then -- prebuilt libs have no projects return _G["projectDependencyConfig_" .. name](dependency) end return dependency end function loadProject(_projectName, _load) local name = getProjectBaseName(_projectName) local prjFile = "" for _,path in ipairs(RTM_PROJECT_DIRS) do prjFile = path .. name .. ".lua" if os.isfile(prjFile) then if g_fileIsLoaded[prjFile] == nil then g_fileIsLoaded[prjFile] = true assert(loadfile(prjFile))(find3rdPartyProject(name)) break end end prjFile = path .. name .. "/genie/" .. name .. ".lua" if os.isfile(prjFile) then if g_fileIsLoaded[prjFile] == nil then g_fileIsLoaded[prjFile] = true dofile(prjFile) break end end end _load = _load or ProjectLoad.LoadAndAdd if _load == ProjectLoad.LoadAndAdd then addProject(_projectName) end end function sortDependencies(a,b) local depsA = getProjectDependencies(a) local depsB = getProjectDependencies(b) return #depsA > #depsB end function getProjectDependencies(_name, _additionalDeps) local fullName = getProjectFullName(_name) local dep = {} if _G["projectDependencies_" .. fullName] then dep = _G["projectDependencies_" .. fullName]() end _additionalDeps = _additionalDeps or {} dep = mergeTables(dep, _additionalDeps) local finalDep = {} for _,dependency in ipairs(dep) do table.insert(finalDep, configDependency(_name, dependency)) end for _,dependency in ipairs(finalDep) do loadProject(dependency, ProjectLoad.LoadOnly) end local depNest = {} for _,d in ipairs(finalDep) do depNest = mergeTables(depNest, getProjectDependencies(d)) end finalDep = mergeTables(finalDep, depNest) if _ACTION == "gmake" then table.sort(finalDep, sortDependencies) end return finalDep end function addExtraSettingsForExecutable(_name) if _G["projectExtraConfigExecutable_" .. _name] then dep = _G["projectExtraConfigExecutable_" .. _name]() end end -- can be called only ONCE from one project, merge dependencies before calling!!! function addDependencies(_name, _additionalDeps) local dependencies = getProjectDependencies(_name, _additionalDeps) addExtraSettingsForExecutable(_name) if dependencies ~= nil then for _,dependency in ipairs(dependencies) do local dependencyFullName = getProjectFullName(dependency) addExtraSettingsForExecutable(dependencyFullName) addInclude(_name, dependency) if not _G["projectNoBuild_" .. dependencyFullName] then links { dependencyFullName } end end end if dependencies ~= nil then for _,dependency in ipairs(dependencies) do loadProject(dependency) end end end function addLibProjects(_name) loadProject(_name) if istable(_name) then return end -- TODO: samples to link against the right library version local projectDir = getProjectPath(_name) local sampleDirs = os.matchdirs(projectDir .. "/samples/*") for _,dir in ipairs(sampleDirs) do local dirName = path.getbasename(dir) addProject_lib_sample(_name, dirName, _toolLib) end local testDir = projectDir .. "/test/" if os.isdir(testDir) then addProject_lib_test(_name) end local toolsDirs = os.matchdirs(projectDir .. "/tools/*") for _,dir in ipairs(toolsDirs) do local dirName = path.getbasename(dir) addProject_lib_tool(_name, dirName) end end function stripExtension( _path ) local pathFS = _path:gsub("\\","/") return path.getdirectory(pathFS) .. "/" .. path.getbasename(pathFS) end function getToolForHost(_name) -- sed is special case if _name == "sed" and os.is("windows") then return getProjectPath("build") .. "tools\\bin\\windows\\sed.exe" end local toolPath = path.getabsolute(script_dir() .. "/tools/bin/") if os.is("windows") then toolPath = toolPath .. "/windows/" .. _name .. ".exe" elseif os.is("linux") then toolPath = toolPath .. "/linux/" .. _name elseif os.is("osx") then toolPath = toolPath .. "/darwin/" .. _name end return toolPath end function flatten(t) t = t or {} local tmp = {} for si,sv in ipairs(t) do if type( sv ) == "table" then for _,v in ipairs(sv) do table.insert(tmp, v) end elseif type( sv ) == "string" then table.insert( tmp, sv ) end t[si] = nil end for _,v in ipairs(tmp) do table.insert(t, v) end end function readFile(_file) local f = io.open(_file, "r") if f == nil then return "" end local content = f:read("*all") f:close() return content end function recreateDir(_path) rmdir(_path) mkdir(_path) end
object_draft_schematic_furniture_wod_potted_plant_scem_01 = object_draft_schematic_furniture_shared_wod_potted_plant_scem_01:new { } ObjectTemplates:addTemplate(object_draft_schematic_furniture_wod_potted_plant_scem_01, "object/draft_schematic/furniture/wod_potted_plant_scem_01.iff")
function applyPDModels() -- tags tag1 = engineLoadTXD("tags_lafront.txd") engineImportTXD(tag1, 1524) -- tag2 = engineLoadTXD("tags_lakilo.txd") -- engineImportTXD(tag2, 1525) tag3 = engineLoadTXD("tags_laseville.txd") engineImportTXD(tag2, 1528) end --addEventHandler("onClientResourceStart", getResourceRootElement(), applyPDModels)
-- ============ -- CONTEXT MENU -- ============ ---@class ContextEntry @ContextEntries for ContextMenu ---@field ID number|ResolverFunction AFAIK only affects positon in FlashArray. (Optional) Auto-generated based on length of array ---@field actionID number|ResolverFunction This number is thrown on button-press and subsequently broadcasted on S7UCL::ContextMenu net-channel ---@field clickSound boolean|ResolverFunction Probably controls whether mouseClick produces a sound ---@field isDisabled boolean|ResolverFunction If true, the button is greyed out and cannot be pressed ---@field isUnavailable boolean|ResolverFunction If true, the button will not show up at all. Useful for exceptions ---@field isLegal boolean|ResolverFunction If false, button is red and indicates an act of crime ---@field text string|ResolverFunction ContextMenu label text ---@field range number|ResolverFunction ContextMenu range within which the option is available ---@field restrictUI nil|table|ResolverFunction If not nil, then ctxEntries will not show up for UI TypeIDs in this array. (-1 for game-world) ContextEntry = { --actionID = 0, ID = function(r) return r.Root.windowsMenu_mc.list.length end, clickSound = true, isDisabled = false, isUnavailable = false, isLegal = true, text = "null", range = 0, --restrictUI = {}, } ---Create new ContextEntry ---@param object ContextEntry ---@return ContextEntry function ContextEntry:New(object) local object = object or {} if not ValidInputTable(object, {'actionID'}) then Debug:FError("Invalid ActionID") end object = Integrate(self, object) object.New = nil -- Remove constructor from the object. return object end ---@alias activator string `ActivatorType::ActivatorValue`. e.g. StatsId::LOOT_Paper_Sheet_A ---@class ContextMenu @ContextMenu UI Component ---@field TypeID number UI TypeID. Generally 11, sometimes 10. ---@field Activator activator ActivatorType::ActivatorValue. Ties activation and ContextEntries together ---@field Target EclItem|EclCharacter Item that was right-clicked (can also be a game-world character) ---@field Character EclCharacter Character that right-clicked (i.e. the player character) ---@field Origin number Origin of the CtxMenu. UI TypeID. ---@field TargetDistance number Distance between player and mouse-target ---@field TargetType string Character or Item ---@field Intercept boolean Should intercept ContextMenu ---@field Component table Holds information about WindowElement ---@field ContextEntries table<activator, ContextEntry[]> Array of constituting ContextEntries ---@field UIPath string SWF Directory ---@field UI UIObject UIObject ---@field Root UIRoot_contextMenu UIObject root UILibrary.contextMenu = { TypeID = 11 or UILibrary.TypeID.contextMenu, -- or 10 Activator = "", Intercept = false, Component = {}, ContextEntries = {}, Origin = -1, TargetDistance = 0, TargetType = 'Item', UIPath = Dir.GameGUI .. 'contextMenu.swf', -- UI = {}, -- Root = {}, -- Character = {}, -- Target = {}, -- ContextEntries = {}, -- Component = {} } --- Initialize new ContextMenu object ---@param object nil|ContextMenu Object to instantiate ---@return ContextMenu object ContextMenu object function UILibrary.contextMenu:New(object) local object = object or {} object = Integrate(self, object) return object end ---Get UI details ---@param ui UIObject UIObject from one of the listeners function UILibrary.contextMenu:GetUI(ui) self.UI = ui or Ext.GetUIByType(self.TypeID) or Ext.GetBuiltinUI(self.UIPath) self.Root = self.UI:GetRoot() ---@type UIRoot_contextMenu end --- Get Existing ContextEntries for given activator ---@param activator activator ---@return table<activator, ContextEntry[]>|nil ContextEntries function UILibrary.contextMenu:Get(activator) if self.ContextEntries[activator] then return self.ContextEntries[activator] end end ---Adds CtxEntries to CtxMenu ---@param ctxMenu ContextEntry[] ---@param ctxEntries ContextEntry[] function UILibrary.contextMenu:Add(ctxMenu, ctxEntries) if type(ctxEntries) ~= 'table' then return end ForEach(ctxEntries, function (_, entry) if type(entry) ~= 'table' then return end if IsValid(Pinpoint(entry.actionID, ctxMenu)) then return end table.insert(ctxMenu, ContextEntry:New(entry)) end) end ---Register new activator entry for the ContextMenu ---@param e table<activator, ContextEntry[]> ContextEntries function UILibrary.contextMenu:Update(e) ForEach(e, function (activator, ctxEntries) if type(ctxEntries) ~= 'table' then return end if not self.ContextEntries[activator] then self.ContextEntries[activator] = {} end self:Add(self.ContextEntries[activator], ctxEntries) end) end ---Quick register options. Skips straight to registration ---@param e table<activator, ContextEntry[]> ContextEntries function UILibrary.contextMenu:Register(e) ForEach(e, function (activator, ctxEntries) if type(ctxEntries) ~= 'table' then return end local ctxMenu = self:Get(activator) or {} self:Add(ctxMenu, ctxEntries) self:Update({[activator] = ctxMenu}) end) end -- DETERMINE ACTIVATOR -- =================== -- TODO: Refactor this ugly mess into something more maintainable. ---Determine activator ---@param statsActivator activator ---@param templateActivator activator function UILibrary.contextMenu:determineActivator(targetType, statsActivator, templateActivator) local targetType = targetType or "Item" local anyActivator = 'Any::' .. targetType self.Activator = anyActivator -- Check if statsActivator ContextEntries have been registered already if self.ContextEntries[statsActivator] then -- If anyActivators have also been registered then inherit ContextEntries. statsActivator has higher specificity than anyActivator if self.ContextEntries[anyActivator] then self:Add(self.ContextEntries[statsActivator], self.ContextEntries[anyActivator]) end ContextMenu.Activator = statsActivator -- Set Activator end -- Check if templateActivator ContextEntries have been registered already if self.ContextEntries[templateActivator] then -- If anyActivators have also been registered then inherit ContextEntries. statsActivator has higher specificity than anyActivator if self.ContextEntries[anyActivator] then self:Add(self.ContextEntries[templateActivator], self.ContextEntries[anyActivator]) end -- If statsActivator was also registered then inherit ContextEntries. RootTemplate has higher specificity than statsActivator if self.ContextEntries[statsActivator] then self:Add(self.ContextEntries[templateActivator], self.ContextEntries[statsActivator]) end self.Activator = templateActivator -- Set Activator end end -- ====================== -- INTERCEPT CONTEXT MENU -- ====================== -- PREPARE INTERCEPT -- ================= --TODO: Both prepareIntercepts can probably be reduced to a single function ---Prepare UI Intercept Setup ---@param ui UIObject ---@param call string External Interface Call ---@param itemDouble number ---@param origin UIObject Origin UI function UILibrary.contextMenu:prepareUIIntercept(ui, call, itemDouble, origin) self.Origin = origin:GetTypeId() or self.Origin -- TypeID of the Origin UI element self.Target = Ext.GetItem(Ext.DoubleToHandle(itemDouble)) -- Set Item if not self.Target then return end self.TargetType = 'Item' self.TargetDistance = 0 local statsActivator = 'StatsId::' .. self.Target.StatsId ---@type activator local templateActivator = 'RootTemplate::' .. self.Target.RootTemplate.Id ---@type activator self:determineActivator(self.TargetType, statsActivator, templateActivator) -- Set Activator self.Character = Ext.GetCharacter(ui:GetPlayerHandle()) -- Set Character self.Intercept = IsValid(self.Activator) -- Go for Intercept if Activator IsValid end ---Prepare GameWorld Intercept Setup function UILibrary.contextMenu:prepareGameWorldIntercept() local pickingState = Ext.GetPickingState() if not (pickingState.HoverEntity) then return end self.Origin = -1 self.Character = Ext.GetCharacter(UserInformation.CurrentCharacter) ---@type activator local statsActivator, templateActivator if Ext.GetHandleType(pickingState.HoverEntity) == 'ClientCharacter' then self.TargetType = 'Character' self.Target = Ext.GetCharacter(pickingState.HoverEntity) statsActivator = 'StatsId::' .. self.Target.Stats.Name templateActivator = 'RootTemplate::' .. self.Target.RootTemplate.Id elseif Ext.GetHandleType(pickingState.HoverEntity) == 'ClientItem' then self.TargetType = 'Item' self.Target = Ext.GetItem(pickingState.HoverEntity) statsActivator = 'StatsId::' .. self.Target.StatsId templateActivator = 'RootTemplate::' .. self.Target.RootTemplate.Id end if not self.Character or not self.Target then return end self.TargetDistance = CalculateDistance(self.Character.WorldPos, self.Target.WorldPos) self:determineActivator(self.TargetType, statsActivator, templateActivator) -- Set Activator self.Intercept = IsValid(self.Activator) -- Go for Intercept if Activator IsValid end -- REGISTER LISTENERS -- ================== ---Pre-Intercept Setup function UILibrary.contextMenu:prepareIntercepts() -- Setup Party Inventory UI local partyInventoryUI = Ext.GetBuiltinUI(PartyInventory.UIPath) Ext.RegisterUICall(partyInventoryUI, 'openContextMenu', function(ui, call, id, itemDouble, x, y) self:prepareUIIntercept(ui, call, itemDouble, partyInventoryUI) end) -- Setup Container Inventory UI local containerInventoryUI = Ext.GetUIByType(ContainerInventory.TypeID) or Ext.GetBuiltinUI(ContainerInventory.UIPath) Ext.RegisterUICall(containerInventoryUI, 'openContextMenu', function(ui, call, itemDouble, x, y) self:prepareUIIntercept(ui, call, itemDouble, containerInventoryUI) end) -- Setup Character Sheet UI local characterSheetUI = Ext.GetBuiltinUI(Dir.GameGUI .. 'characterSheet.swf') Ext.RegisterUICall(characterSheetUI, 'openContextMenu', function(ui, call, itemDouble, x, y) self:prepareUIIntercept(ui, call, itemDouble, characterSheetUI) end) -- -- Setup Crafting UI local uiCraftUI = Ext.GetBuiltinUI(Dir.GameGUI .. 'uiCraft.swf') Ext.RegisterUICall(uiCraftUI, 'openContextMenu', function(ui, call, itemDouble, x, y) self:prepareUIIntercept(ui, call, itemDouble, x, y, uiCraftUI) end) Ext.RegisterUITypeInvokeListener(Tooltip.TypeID, 'addTooltip', function (ui, call, ...) self:prepareGameWorldIntercept() end, 'Before') Ext.RegisterUITypeInvokeListener(EnemyHealthBar.TypeID, 'setText', function (ui, call, ...) self:prepareGameWorldIntercept() end, 'Before') end ---Registers ContextMenu Listeners function UILibrary.contextMenu:RegisterContextMenuListeners() Debug:Print("Registering ContextMenu Listeners") self:prepareIntercepts() -- REGISTER CONTEXT MENU HOOKS ON INTERCEPT -- ======================================== Ext.RegisterUITypeInvokeListener(self.TypeID, 'open', function(ui, call, ...) if not self.Intercept then return end -- If Intercept was denied then return local ctxEntries = self.ContextEntries[self.Activator] or ContextMenu.ContextEntries[self.Activator] -- Get ContextEntries. (if ContextMenuC then fallback and retrieve base ContextEntries) if not ctxEntries then return end Debug:Print("Intercepted ContextMenu. Registering Hooks") self:GetUI(ui) -- Fetch UI details -- These will be passed into Resolver functions below local resolverArguments = { ['Target'] = self.Target, ['Character'] = self.Character, ['Activator'] = self.Activator, ['TargetDistance'] = self.TargetDistance, ['TargetType'] = self.TargetType, ['UI'] = self.UI, ['Root'] = self.Root, ['TypeID'] = self.TypeID, ['ctxEntries'] = ctxEntries, ['InputEvents'] = InputEvents } -- Adding ctxEntries ForEach(ctxEntries, function (_, entry) if type(entry) ~= 'table' then return end -- Resolve ctxEntry local resolved = Map(entry, function (key, value) if key == 'New' then return key, nil end return key, Resolve(value, resolverArguments) end) if resolved.isUnavailable then return end -- if isUnavailable is true then return if resolved.restrictUI ~= nil and IsValid(Pinpoint(self.Origin, resolved.restrictUI)) then return end -- If UI TypeID is in restrictUI array then return. if self.Origin == -1 and resolved.range < self.TargetDistance then return end -- Create buttons self.Root.addButton(resolved.ID, resolved.actionID, resolved.clickSound, "", resolved.text, resolved.isDisabled, resolved.isLegal) self.Root.addButtonsDone() end) self.Intercept = false -- Done intercepting end, 'Before') -- BUTTON PRESS -- ============ self:GetUI() Ext.RegisterUICall(self.UI, 'buttonPressed', function(ui, call, id, actionID, handle) Debug:Print("ContextMenu Action: " .. tostring(actionID)) local itemNetID local actionID = tonumber(actionID) if self.Target then itemNetID = self.Target.NetID end local payload = { ['CharacterGUID'] = self.Character.MyGuid, ['Activator'] = self.Activator, ['actionID'] = actionID, ['TargetDistance'] = self.TargetDistance, ['TargetType'] = self.TargetType, ['ItemNetID'] = itemNetID } Ext.PostMessageToServer(Channel.ContextMenu, Ext.JsonStringify(payload)) -- Post ContextAction Payload to Server. Bounces back to Client end) -- MENU CLOSE -- ========== Ext.RegisterUITypeCall(self.TypeID, 'menuClosed', function() self.TargetDistance = 0 self.Target = nil self.Origin = nil self.Activator = nil end) Debug:Print("ContextMenu Listener Registration Completed") end -- ===================== -- SNAPSHOT CONTEXT MENU -- ===================== ---Print a snapshot of ContextMenu's current state to the debug-console and (optionally) save it in Osiris Data/S7Debug ---@param fileName string|nil if specified, will save the results in a .yaml file in `Osiris Data/S7Debug/` function UILibrary.contextMenu:Snapshot(fileName) local ctxInfo = Rematerialize(self) -- Drops non-stringifiable elements ctxInfo['ContextEntries'] = nil -- Too big to be useful in the debug-console -- Pretty print snapshot Write:SetHeader('ContextMenu:') Write:Tabulate(ctxInfo) if self.ContextEntries[self.Activator] then ctxInfo['ContextEntry'] = Yamlify(self.ContextEntries[self.Activator]) Write:NewLine('ContextEntry:\n') Write:NewLine(ctxInfo['ContextEntry']) end Debug:Print(Write:Display()) ctxInfo['ContextEntries'] = self.ContextEntries -- Re-add ContextEntries for printing -- Save to external yaml file if fileName was specified if IsValid(fileName) then SaveFile('S7Debug/' .. fileName .. '.yaml', Yamlify(ctxInfo)) end end -- ===================================== ContextMenu = UILibrary.contextMenu:New() -- ===================================== -- ============================================================================================================================ Ext.RegisterListener('SessionLoaded', function() if not CONTROLLER_MODE then ContextMenu:RegisterContextMenuListeners() end end) -- ============================================================================================================================ -- ############################################################################################################################################## -- ===================== -- SNAPSHOT CONTEXT MENU -- ===================== if Ext.IsDeveloperMode() then ConsoleCommander:Register({ -- --------------------------------------------- -- !S7_UI_Components_Library SnapshotContextMenu -- --------------------------------------------- Name = 'SnapshotContextMenu', Description = 'Prints the current state of the ContextMenu object', Context = 'Client', Params = {[1] = 'fileName: string|nil - Will save results in Osiris Data/S7Debug/[fileName].yaml if specified'}, Action = function() if CONTROLLER_MODE then ContextMenuC:Snapshot() else ContextMenu:Snapshot() end end }) end -- =============== -- GAME ACTION IDs -- =============== --[[ ["Use"] = 2, ["Equip"] = 2, ["Launch"] = 2, ["Cast Skill"] = 2, ["Consume"] = 2, ["Open"] = 3, ["Unequip"] = 17, ["Examine"] = 22, ["Drop Item"] = 20, ["Combine With"] = 28, ["Add To Wares"] = 50, ["Remove From Wares"] = 51, ["Pickup And Add To Wares"] = 60, ["Add To Hotbar"] = 63, ]]
-- -- This is file `babel-bidi-basic.lua', -- generated with the docstrip utility. -- -- The original source files were: -- -- babel.dtx (with options: `basic') -- -- -- Copyright (C) 2012-2021 Javier Bezos and Johannes L. Braams. -- Copyright (C) 1989-2012 Johannes L. Braams and -- any individual authors listed elsewhere in this file. -- All rights reserved. -- -- -- This file is part of the Babel system. -- -------------------------------------- -- -- It may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. -- The latest version of this license is in -- http://www.latex-project.org/lppl.txt -- and version 1.3 or later is part of all distributions of LaTeX -- version 2003/12/01 or later. -- -- This work has the LPPL maintenance status "maintained". -- -- The Current Maintainer of this work is Javier Bezos. -- -- The list of derived (unpacked) files belonging to the distribution -- and covered by LPPL is defined by the unpacking scripts (with -- extension |.ins|) which are part of the distribution. -- Babel = Babel or {} -- eg, Babel.fontmap[1][<prefontid>]=<dirfontid> Babel.fontmap = Babel.fontmap or {} Babel.fontmap[0] = {} -- l Babel.fontmap[1] = {} -- r Babel.fontmap[2] = {} -- al/an Babel.bidi_enabled = true Babel.mirroring_enabled = true require('babel-data-bidi.lua') local characters = Babel.characters local ranges = Babel.ranges local DIR = node.id('dir') local GLYPH = node.id('glyph') local function insert_implicit(head, state, outer) local new_state = state if state.sim and state.eim and state.sim ~= state.eim then dir = ((outer == 'r') and 'TLT' or 'TRT') -- ie, reverse local d = node.new(DIR) d.dir = '+' .. dir node.insert_before(head, state.sim, d) local d = node.new(DIR) d.dir = '-' .. dir node.insert_after(head, state.eim, d) end new_state.sim, new_state.eim = nil, nil return head, new_state end local function insert_numeric(head, state) local new local new_state = state if state.san and state.ean and state.san ~= state.ean then local d = node.new(DIR) d.dir = '+TLT' _, new = node.insert_before(head, state.san, d) if state.san == state.sim then state.sim = new end local d = node.new(DIR) d.dir = '-TLT' _, new = node.insert_after(head, state.ean, d) if state.ean == state.eim then state.eim = new end end new_state.san, new_state.ean = nil, nil return head, new_state end -- TODO - \hbox with an explicit dir can lead to wrong results -- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>. A small attempt -- was s made to improve the situation, but the problem is the 3-dir -- model in babel/Unicode and the 2-dir model in LuaTeX don't fit -- well. function Babel.bidi(head, ispar, hdir) local d -- d is used mainly for computations in a loop local prev_d = '' local new_d = false local nodes = {} local outer_first = nil local inmath = false local glue_d = nil local glue_i = nil local has_en = false local first_et = nil local ATDIR = Babel.attr_dir local save_outer local temp = node.get_attribute(head, ATDIR) if temp then temp = temp % 3 save_outer = (temp == 0 and 'l') or (temp == 1 and 'r') or (temp == 2 and 'al') elseif ispar then -- Or error? Shouldn't happen save_outer = ('TRT' == tex.pardir) and 'r' or 'l' else -- Or error? Shouldn't happen save_outer = ('TRT' == hdir) and 'r' or 'l' end -- when the callback is called, we are just _after_ the box, -- and the textdir is that of the surrounding text -- if not ispar and hdir ~= tex.textdir then -- save_outer = ('TRT' == hdir) and 'r' or 'l' -- end local outer = save_outer local last = outer -- 'al' is only taken into account in the first, current loop if save_outer == 'al' then save_outer = 'r' end local fontmap = Babel.fontmap for item in node.traverse(head) do -- In what follows, #node is the last (previous) node, because the -- current one is not added until we start processing the neutrals. -- three cases: glyph, dir, otherwise if item.id == GLYPH or (item.id == 7 and item.subtype == 2) then local d_font = nil local item_r if item.id == 7 and item.subtype == 2 then item_r = item.replace -- automatic discs have just 1 glyph else item_r = item end local chardata = characters[item_r.char] d = chardata and chardata.d or nil if not d or d == 'nsm' then for nn, et in ipairs(ranges) do if item_r.char < et[1] then break elseif item_r.char <= et[2] then if not d then d = et[3] elseif d == 'nsm' then d_font = et[3] end break end end end d = d or 'l' -- A short 'pause' in bidi for mapfont d_font = d_font or d d_font = (d_font == 'l' and 0) or (d_font == 'nsm' and 0) or (d_font == 'r' and 1) or (d_font == 'al' and 2) or (d_font == 'an' and 2) or nil if d_font and fontmap and fontmap[d_font][item_r.font] then item_r.font = fontmap[d_font][item_r.font] end if new_d then table.insert(nodes, {nil, (outer == 'l') and 'l' or 'r', nil}) if inmath then attr_d = 0 else attr_d = node.get_attribute(item, ATDIR) attr_d = attr_d % 3 end if attr_d == 1 then outer_first = 'r' last = 'r' elseif attr_d == 2 then outer_first = 'r' last = 'al' else outer_first = 'l' last = 'l' end outer = last has_en = false first_et = nil new_d = false end if glue_d then if (d == 'l' and 'l' or 'r') ~= glue_d then table.insert(nodes, {glue_i, 'on', nil}) end glue_d = nil glue_i = nil end elseif item.id == DIR then d = nil new_d = true elseif item.id == node.id'glue' and item.subtype == 13 then glue_d = d glue_i = item d = nil elseif item.id == node.id'math' then inmath = (item.subtype == 0) else d = nil end -- AL <= EN/ET/ES -- W2 + W3 + W6 if last == 'al' and d == 'en' then d = 'an' -- W3 elseif last == 'al' and (d == 'et' or d == 'es') then d = 'on' -- W6 end -- EN + CS/ES + EN -- W4 if d == 'en' and #nodes >= 2 then if (nodes[#nodes][2] == 'es' or nodes[#nodes][2] == 'cs') and nodes[#nodes-1][2] == 'en' then nodes[#nodes][2] = 'en' end end -- AN + CS + AN -- W4 too, because uax9 mixes both cases if d == 'an' and #nodes >= 2 then if (nodes[#nodes][2] == 'cs') and nodes[#nodes-1][2] == 'an' then nodes[#nodes][2] = 'an' end end -- ET/EN -- W5 + W7->l / W6->on if d == 'et' then first_et = first_et or (#nodes + 1) elseif d == 'en' then has_en = true first_et = first_et or (#nodes + 1) elseif first_et then -- d may be nil here ! if has_en then if last == 'l' then temp = 'l' -- W7 else temp = 'en' -- W5 end else temp = 'on' -- W6 end for e = first_et, #nodes do if nodes[e][1].id == GLYPH then nodes[e][2] = temp end end first_et = nil has_en = false end -- Force mathdir in math if ON (currently works as expected only -- with 'l') if inmath and d == 'on' then d = ('TRT' == tex.mathdir) and 'r' or 'l' end if d then if d == 'al' then d = 'r' last = 'al' elseif d == 'l' or d == 'r' then last = d end prev_d = d table.insert(nodes, {item, d, outer_first}) end outer_first = nil end -- TODO -- repeated here in case EN/ET is the last node. Find a -- better way of doing things: if first_et then -- dir may be nil here ! if has_en then if last == 'l' then temp = 'l' -- W7 else temp = 'en' -- W5 end else temp = 'on' -- W6 end for e = first_et, #nodes do if nodes[e][1].id == GLYPH then nodes[e][2] = temp end end end -- dummy node, to close things table.insert(nodes, {nil, (outer == 'l') and 'l' or 'r', nil}) --------------- NEUTRAL ----------------- outer = save_outer last = outer local first_on = nil for q = 1, #nodes do local item local outer_first = nodes[q][3] outer = outer_first or outer last = outer_first or last local d = nodes[q][2] if d == 'an' or d == 'en' then d = 'r' end if d == 'cs' or d == 'et' or d == 'es' then d = 'on' end --- W6 if d == 'on' then first_on = first_on or q elseif first_on then if last == d then temp = d else temp = outer end for r = first_on, q - 1 do nodes[r][2] = temp item = nodes[r][1] -- MIRRORING if Babel.mirroring_enabled and item.id == GLYPH and temp == 'r' and characters[item.char] then local font_mode = font.fonts[item.font].properties.mode if font_mode ~= 'harf' and font_mode ~= 'plug' then item.char = characters[item.char].m or item.char end end end first_on = nil end if d == 'r' or d == 'l' then last = d end end -------------- IMPLICIT, REORDER ---------------- outer = save_outer last = outer local state = {} state.has_r = false for q = 1, #nodes do local item = nodes[q][1] outer = nodes[q][3] or outer local d = nodes[q][2] if d == 'nsm' then d = last end -- W1 if d == 'en' then d = 'an' end local isdir = (d == 'r' or d == 'l') if outer == 'l' and d == 'an' then state.san = state.san or item state.ean = item elseif state.san then head, state = insert_numeric(head, state) end if outer == 'l' then if d == 'an' or d == 'r' then -- im -> implicit if d == 'r' then state.has_r = true end state.sim = state.sim or item state.eim = item elseif d == 'l' and state.sim and state.has_r then head, state = insert_implicit(head, state, outer) elseif d == 'l' then state.sim, state.eim, state.has_r = nil, nil, false end else if d == 'an' or d == 'l' then if nodes[q][3] then -- nil except after an explicit dir state.sim = item -- so we move sim 'inside' the group else state.sim = state.sim or item end state.eim = item elseif d == 'r' and state.sim then head, state = insert_implicit(head, state, outer) elseif d == 'r' then state.sim, state.eim = nil, nil end end if isdir then last = d -- Don't search back - best save now elseif d == 'on' and state.san then state.san = state.san or item state.ean = item end end return node.prev(head) or head end
local kit={} if settings.global["ironOre"].value>0 then table.insert(kit,{name="iron-ore",count=settings.global["ironOre"].value}) end if settings.global["copperOre"].value>0 then table.insert(kit,{name="copper-ore",count=settings.global["copperOre"].value}) end if settings.global["coal"].value>0 then table.insert(kit,{name="coal",count=settings.global["coal"].value}) end if settings.global["stone"].value>0 then table.insert(kit,{name="stone",count=settings.global["stone"].value}) end if settings.global["wood"].value>0 then table.insert(kit,{name="wood",count=settings.global["wood"].value}) end -- Now lets get the player that just joined, and clear all of his inventory to replace with ours. script.on_event(defines.events.on_player_created,function(param) local p=game.players[param.player_index] -- Now we will add all the items from our mod settings choices. for i,v in pairs(kit) do p.insert(v) end end)
minetest.register_item(":", { type = "none", wield_image = "hand.png", wield_scale = {x=1,y=1,z=3.5}, tool_capabilities = { max_drop_level = 0, full_punch_interval = 0.4, groupcaps = { oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}, cracky = {times={[1]=12.00}, uses=0, maxlevel=1}, crumbly = {times={[2]=4.50, [3]=1.80}, uses=0, maxlevel=1}, }, damage_groups = {cracky = 1}, } }) minetest.register_item("main:drill", { type = "none", wield_image = "main_drill.png", inventory_image = "main_drill.png", tool_capabilities = { max_drop_level = 1, full_punch_interval = 0.8, groupcaps = { cracky = {times={[1]=2, [2]=2.00,[3]=1.50}, uses=0, maxlevel=1}, }, damage_groups = {cracky = 8}, } }) minetest.register_item("main:pickaxe_tier2", { type = "none", wield_image = "main_pickaxe_tier2.png", inventory_image = "main_pickaxe_tier2.png", tool_capabilities = { max_drop_level = 1, full_punch_interval = 0.8, groupcaps = { cracky = {times={[1]=4, [2]=2.00,[3]=1.50}, uses=0, maxlevel=1}, }, damage_groups = {cracky = 8}, } }) minetest.register_item("main:pickaxe_steel", { type = "none", wield_image = "main_pickaxe_steel.png", inventory_image = "main_pickaxe_steel.png", tool_capabilities = { max_drop_level = 1, full_punch_interval = 0.8, groupcaps = { cracky = {times={[1]=6, [2]=2.00,[3]=1.50}, uses=0, maxlevel=1}, }, damage_groups = {cracky = 8}, } }) minetest.register_item("main:pickaxe_stone", { type = "none", wield_image = "main_pickaxe_stone.png", inventory_image = "main_pickaxe_stone.png", tool_capabilities = { max_drop_level = 1, full_punch_interval = 0.8, groupcaps = { cracky = {times={[1]=8, [2]=2.00,[3]=1.50}, uses=0, maxlevel=1}, }, damage_groups = {cracky = 5}, } }) minetest.register_item("main:hatchet", { type = "none", wield_image = "main_hatchet.png", inventory_image = "main_hatchet.png", tool_capabilities = { max_drop_level = 1, full_punch_interval = 0.8, groupcaps = { cracky = {times={[1]=10, [2]=2.00,[3]=1.50}, uses=0, maxlevel=1}, }, damage_groups = {cracky = 5}, } })
--[[ -- added by wsh @ 2018-02-26 -- 临时Demo:战斗场景角色动画控制脚本 --]] local CharacterAnimation = BaseClass("CharacterAnimation", Updatable) local base = Updatable local function Start(self, chara_go) -- 角色gameObject self.chara_go = chara_go -- 角色控制器 self.chara_ctrl = chara_go:GetComponentInChildren(typeof(CS.UnityEngine.CharacterController)) -- 动画控制器 self.anim_ctrl = chara_go:GetComponentInChildren(typeof(CS.UnityEngine.Animation)) assert(not IsNull(self.chara_ctrl), "chara_ctrl null") assert(not IsNull(self.anim_ctrl), "anim_ctrl null") -- 展示人物名片 self.id="123456" self.nickName="nickname" self.gameObject=chara_go; self.transform=chara_go.transform; -- UIBoardManager:GetInstance():Open(self, EBoardType.PLAYER); end local function LateUpdate(self) if IsNull(self.chara_ctrl) or IsNull(self.anim_ctrl) then return end if self.chara_ctrl.isGrounded and CS.ETCInput.GetAxis("Vertical") ~= 0 then self.anim_ctrl:CrossFade("soldierRun") end if self.chara_ctrl.isGrounded and CS.ETCInput.GetAxis("Vertical") == 0 and CS.ETCInput.GetAxis("Horizontal") == 0 then self.anim_ctrl:CrossFade("soldierIdleRelaxed") end if not self.chara_ctrl.isGrounded then self.anim_ctrl:CrossFade("soldierFalling") end if self.chara_ctrl.isGrounded and CS.ETCInput.GetAxis("Vertical") == 0 and CS.ETCInput.GetAxis("Horizontal") > 0 then self.anim_ctrl:CrossFade("soldierSpinRight") end if self.chara_ctrl.isGrounded and CS.ETCInput.GetAxis("Vertical") == 0 and CS.ETCInput.GetAxis("Horizontal") < 0 then self.anim_ctrl:CrossFade("soldierSpinLeft") end end local function __delete(self) base.__delete(self); UIBoardManager:GetInstance():Destroy(self, EBoardType.PLAYER); end CharacterAnimation.Start = Start CharacterAnimation.LateUpdate = LateUpdate CharacterAnimation.__delete = __delete return CharacterAnimation
-- Copyright (c) 2021 Trevor Redfern -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT return { actions = require "game.rules.stats.actions", reducer = require "game.rules.stats.reducer", selectors = require "game.rules.stats.selectors", keys = { turnCounter = "turnCounter" } }
-- printable_chars.lua -- Daniel Ribeiro Margarido -- 2018 -- Default special chars set up to ignore special space types local space_chars = { [9] = false, -- Tab [10] = false, -- \n [13] = false, -- \r } -- Characters to ignore local blacklisted_chars = {} -- Receives a char -- Returns the true for ascii printable chars, or false otherwise local function is_char_printable(ch) if not ch then return nil end -- Ignore blacklisted chars if blacklisted_chars[string.byte(ch)] then return false end return (string.byte(ch) >= 32 and string.byte(ch) <= 126) or space_chars[string.byte(ch)] end -- Receives a string -- Returns string with just the ascii printable characters local function printable_chars(str) local final_string = "" if not str then return final_string end for c in str:gmatch(".") do if is_char_printable(c) then final_string = final_string .. c end end return final_string end -- Set the space_chars to return true on special space types local function set_spaces_allowed() space_chars[9] = true space_chars[10] = true space_chars[13] = true end -- Add chars to be ignored (blacklisted chars) local function blacklist_chars(chars) for _, char in ipairs(chars) do blacklisted_chars[string.byte(char)] = true end end return { printable_chars = printable_chars, is_char_printable = is_char_printable, set_spaces_allowed = set_spaces_allowed, blacklist_chars = blacklist_chars }
local modules = script.Parent local testRunnerScript = game:GetService("TestService").TestRunner local function header(s) local line = string.rep("-", #s + 6) return ("%s\n-- %s --\n%s"):format(line, s, line) end local source = table.concat({ "--[[", header("TestRunner Testing Framework"), [=[ Note: changes to this file are overwritten Designed to allow rapid development and verification of tests: - Automatically runs tests when you enter Run mode (ie with no clients) This prevents tests from damaging your game (ex by mutating the workspace). - Tests are rerun when their dependencies (direct or indirect) have been changed If you use script syncing software (such as Rojo), this enables you to have your script changes tested within a second of hitting Ctrl+s! - Prints reports to the Output Window; designed to give you just the information you need to fix broken tests - The system supports asynchronous tests - all test cases are run at the same time. (Note that better practice is to use mocks so that you can simulate waits instead of having to wait in real time.) Limitations: - The testing system does not track created coroutines, so tests will not reflect errors that occur in them - You can't click on error output to jump to a ModuleScript's source - Error output will always have "TestService:" at the beginning of every line, unless it came from an untracked coroutine On the plus side, the error output and traceback is more concise and includes which test the error occurred in - The final report will include the ms it took to run the tests. This will be inflated dramatically if there are a lot of errors (or a ton of output) printed out, or if tests yield for a while. - Roblox allows you to require destroyed ModuleScripts, but this system assumes that you will not rely on this behaviour. ]=], header("Roblox Plugin Permissions"), [=[ Script Injection Permission: TestRunner only needs this permission for installation and automatic updating of the TestRunner script in TestService. If you follow the manual installation steps, you can deny this permission without affecting the operation of this plugin, except that the TestRunner script will not be automatically updated. Manual installation steps: 1. Set TestService.ExecuteWithStudioRun to true 2. Place a copy of this Script directly under TestService Internet Access Permission: ***DENY ANY REQUEST FOR INTERNET ACCESS PERMISSIONS FROM THIS PLUGIN*** unless you are 100% sure that one of your test scripts is responsible! TestRunner does not use this permission, but any script in your place that is considered a potential test script (based on your configuration) will be executed while in Run mode. If such a script attempts to send a web request, you will see a permission request for HttpService from the Test Runner Plugin! If you happen to have a malicious script in your place (in any location that tests are scanned for), they could use this permission to steal a copy of your place! ]=], header("Creating Tests"), [=[ To create a test script, create a ModuleScript as a descendant of TestService (this can be configured in TestConfig, see below) - just not as a descendant of this TestRunner script. Any ModuleScript that returns a function is considered a test script (though this can also be configured). See the ExampleTests ModuleScript (a child of this TestRunner script) for documentation while going over an example. You can move it directly into TestService to experiment with it. ]=], require(modules.Config.Config).GetDocs(header), "\n", -- will be two spaces (for between sections) require(modules.Testing.Comparisons).GetDocs(header), "\n", header("Uninstallation"), [=[ Simply delete/rename the TestRunner script in TestService. ]] if script.Disabled then return end -- Tell plugin that this is Test mode so it can run local running = Instance.new("Folder") running.Name = "Running" running.Archivable = false running.Parent = script]=], }, "\n") return function() testRunnerScript.Source = source end
DIALOGUE.name = "Trader Test" DIALOGUE.addTopic("GREETING", { response = "What is it?", options = { "TradeTopic", "BackgroundTopic", "InterestTopic", "AboutWorkTopic", "GetTask", --"ProgressionTestTopic", "GOODBYE" }, preCallback = function(self, client, target) netstream.Start("job_updatenpcjobs", target, target:GetDisplayName(), {"information", "riches"}, 2) end }) DIALOGUE.addTopic("TradeTopic", { statement = "Want to trade?", response = "Yes", postCallback = function(self, client, target) if (SERVER) then local character = client:GetCharacter() target.receivers[#target.receivers + 1] = client local items = {} -- Only send what is needed. for k, v in pairs(target.items) do if (!table.IsEmpty(v) and (CAMI.PlayerHasAccess(client, "Helix - Manage Vendors", nil) or v[VENDOR_MODE])) then items[k] = v end end target.scale = target.scale or 0.5 client.ixVendorAdv = target -- force sync to prevent outdated inventories while buying/selling if (character) then character:GetInventory():Sync(client, true) end net.Start("ixVendorAdvOpen") net.WriteEntity(target) net.WriteUInt(target.money or 0, 16) net.WriteTable(items) net.WriteFloat(target.scale or 0.5) net.Send(client) ix.log.Add(client, "vendorUse", target:GetDisplayName()) end end, options = { "BackTopic", } }) DIALOGUE.addTopic("BackgroundTopic", { statement = "Tell me about yourself.", response = "Not a whole lot to know. I came here a few months ago, after the military presence ramped up their presence around here - turns out the swamps are the only place they haven't really cut off around the perimeter of the zone, which means that this is where we stay for now. I worked as a trader back in the days, so thought I might as well put my skills to use here too. Oh, and I have a bunch of friends who can get things. And remove things, like you, if you keep asking.", options = { "BackTopic", } }) DIALOGUE.addTopic("InterestTopic", { statement = "Can you tell me something interesting?", response = "Sure. How about you do business with me, or shut the fuck up?", options = { "BackTopic", } }) DIALOGUE.addTopic("AboutWorkTopic", { statement = "About work...", response = "", IsDynamic = true, options = { "BackTopic" }, GetDynamicOptions = function(self, client, target) local dynopts = {} if(client:ixHasJobFromNPC(target:GetDisplayName())) then local jobs = client:GetCharacter():GetJobs() -- If it's an item delivery quest local itemuid = ix.jobs.isItemJob(jobs[target:GetDisplayName()].identifier) if itemuid and not jobs[target:GetDisplayName()].isCompleted then dynopts = { {statement = string.format("Hand over 1 %s", ix.item.list[itemuid].name), topicID = "AboutWorkTopic", dyndata = {identifier = itemuid}}, } end end -- Return table of options -- statement : String shown to player -- topicID : should be identical to addTopic id -- dyndata : arbitrary table that will be passed to ResolveDynamicOption return dynopts end, preCallback = function(self, client, target) if client:ixHasJobFromNPC(target:GetDisplayName()) then local jobs = client:GetCharacter():GetJobs() if (jobs[target:GetDisplayName()].isCompleted) then if (SERVER) then ix.dialogue.notifyTaskComplete(client, ix.jobs.getFormattedName(jobs[target:GetDisplayName()])) client:ixJobComplete(target:GetDisplayName()) end if (CLIENT) then self.response = "Great work on the job, here's your reward." end else if (CLIENT) then self.response = string.format("Have you finished %s yet?", ix.jobs.getFormattedName(jobs[target:GetDisplayName()])) end end else if (CLIENT) then self.response = "You're not working for me right now." end end end, ResolveDynamicOption = function(self, client, target, dyndata) netstream.Start("job_deliveritem", target:GetDisplayName()) -- Return the next topicID return "BackTopic" end, -- } ) DIALOGUE.addTopic("ConfirmTask", { statement = "", response = "", IsDynamicFollowup = true, IsDynamic = true, DynamicPreCallback = function(self, player, target, dyndata) if(dyndata) then if (CLIENT) then self.response = dyndata.description else target.taskid = dyndata.identifier end end end, GetDynamicOptions = function(self, client, target) local dynopts = { {statement = "I'll take it", topicID = "ConfirmTask", dyndata = {accepted = true}}, {statement = "I'll pass", topicID = "ConfirmTask", dyndata = {accepted = false}}, } -- Return table of options -- statement : String shown to player -- topicID : should be identical to addTopic id -- dyndata : arbitrary table that will be passed to ResolveDynamicOption return dynopts end, ResolveDynamicOption = function(self, client, target, dyndata) if( SERVER and dyndata.accepted ) then ix.dialogue.notifyTaskGet(client, ix.jobs.getFormattedNameInactive(target.taskid)) client:ixJobAdd(target.taskid, target:GetDisplayName()) ix.jobs.setNPCJobTaken(target:GetDisplayName(), target.taskid) end if(SERVER)then target.taskid = nil end -- Return the next topicID return "BackTopic" end, }) DIALOGUE.addTopic("GetTask", { statement = "Do you have any work for me?", response = "Yes, have a look.", options = { "BackTopic" }, preCallback = function(self, client, target) if client:ixHasJobFromNPC(target:GetDisplayName()) and CLIENT then self.response = "I already gave you some work." end end, IsDynamic = true, GetDynamicOptions = function(self, client, target) local dynopts = {} if not client:ixHasJobFromNPC(target:GetDisplayName()) then local jobs = target:GetNetVar("jobs") for k,v in pairs(jobs) do table.insert(dynopts, {statement = ix.jobs.getFormattedNameInactive(v), topicID = "GetTask", dyndata = {identifier = v}}) end end -- Return table of options -- statement : String shown to player -- topicID : should be identical to addTopic id -- dyndata : arbitrary table that will be passed to ResolveDynamicOption return dynopts end, ResolveDynamicOption = function(self, client, target, dyndata) -- Return the next topicID return "ConfirmTask", {description = ix.jobs.getFormattedDescInactive(dyndata.identifier), identifier = dyndata.identifier} end, }) DIALOGUE.addTopic("ProgressionTestTopic", { statement = "Progression?", response = "ok)", postCallback = function(self, client, target) if (SERVER) then ix.progression.AddProgessionValue("TestProgression", 1, client:Name()) end end, options = { "BackTopic", } }) DIALOGUE.addTopic("BackTopic", { statement = "Let's talk about something else...", response = "All right.", options = { "TradeTopic", "BackgroundTopic", "InterestTopic", "AboutWorkTopic", "GetTask", --"ProgressionTestTopic", "GOODBYE" }, preCallback = function(self, client, target) netstream.Start("job_updatenpcjobs", target, target:GetDisplayName(), {"information", "riches"}, 2) end }) DIALOGUE.addTopic("GOODBYE", { statement = "See you around.", response = "Come back soon, STALKER..." })
-- =========================================================================== -- Base File -- =========================================================================== include("PartialScreenHooks_Expansion1"); include("partialscreenhooks_CQUI.lua");
require("@vue/compiler-core") require("compiler-sfc/src/templateTransformSrcset") require("compiler-core/src/transforms/transformElement") require("compiler-core/src/transforms/vBind") require("compiler-sfc/src/templateTransformAssetUrl") function compileWithSrcset(template, options) local ast = baseParse(template) -- [ts2lua]lua中0和空字符串也是true,此处options需要确认 local srcsetTrasnform = (options and {createSrcsetTransformWithOptions(normalizeOptions(options))} or {transformSrcset})[1] transform(ast, {nodeTransforms={srcsetTrasnform, transformElement}, directiveTransforms={bind=transformBind}}) return generate(ast, {mode='module'}) end local src = nil describe('compiler sfc: transform srcset', function() test('transform srcset', function() expect(compileWithSrcset(src).code):toMatchSnapshot() end ) test('transform srcset w/ base', function() expect(compileWithSrcset(src, {base='/foo'}).code):toMatchSnapshot() end ) test('transform srcset w/ includeAbsolute: true', function() expect(compileWithSrcset(src, {includeAbsolute=true}).code):toMatchSnapshot() end ) end )
-- Vehicle Data local VD = ts_vehicles.get local function E(text) return text:gsub("%^", "\\%^"):gsub(":", "\\:") end ts_vehicles.register_vehicle_base("ts_vehicles_cars:truck", { inventory_image = "ts_vehicles_cars_truck_construction_stand_inv.png", description = "Truck", item_description = "Truck Construction Stand", collisionbox = {-1.55, -0.5, -1.55, 1.55, 2, 1.55}, selectionbox = {-1.65, -0.5, -1.65, 1.65, 2, 1.65}, mesh = "ts_vehicles_cars_truck.obj", lighting_mesh = "ts_vehicles_cars_truck.b3d", -- The names are intentional; the mapping to the actual textures should happen in API, -- according to the get_texture functions of the registered compatibilities. textures = { "base_plate", "tires", "cabin", "interior", "rear_panel", "undercarriage", "pillars_a", "roof", "roof_attachment", "seats", "glass", "platform", "framework", "tank", "platform_top", "body", "body_inside", "rear_board", }, lighting_textures = { "chassis_1", "chassis_2", "chassis", "rear_board_2", "rear_board", "rear_board_1", "roof_attachment_1", "roof_attachment_2", "roof_attachment", }, on_step = ts_vehicles.car_on_step, efficiency = .7, initial_parts = {}, driver_pos = { x = -5, y = 6.5, z = 13.7 }, passenger_pos = { { x = 5, y = 6.5, z = 13.7 }, }, get_fallback_textures = function(self) return { tires = "ts_vehicles_ctcs.png", } end, is_driveable = function(self) local parts = VD(self._id).parts local has = function(group) return ts_vehicles.helpers.any_has_group(parts, group) end if not has("undercarriage") then return false, "A truck needs an undercarriage." end if not has("base_plate") then return false, "A truck needs a base plate." end if not has("tires") then return false, "A truck needs tires." end if not has("cabin") then return false, "A truck needs a cabin." end if not has("rear_panel") then return false, "A truck needs a cabin rear panel." end if not has("windscreen") then return false, "A truck needs a windscreen." end if not has("roof") then return false, "A truck needs a roof." end if not has("platform") then return false, "A truck needs a platform." end if not has("interior") then return false, "A truck needs an interior." end if not has("seats") then return false, "A truck needs seats." end if not has("direction_indicator") then return false, "A truck needs direction indicators." end if not has("lights_front") then return false, "A truck needs front lights." end if not has("lights_back") then return false, "A truck needs back lights." end if not has("lights_reversing") then return false, "A truck needs reversing lights." end if not has("engine") then return false, "A truck needs an engine." end if not has("main_tank") then return false, "A truck needs a tank or battery." end return true end, is_structure_sound = function(self, parts) local id = self._id local vd = VD(id) parts = parts or vd.parts local has = function(group) return ts_vehicles.helpers.any_has_group(parts, group) end local has_multiple = function(group) return ts_vehicles.helpers.multiple_have_group(parts, group) end if has_multiple("undercarriage") then return false, "A truck cannot have multiple undercarriages." end if has("base_plate") and not has("undercarriage") then return false, "An undercarriage is required to mount the base plate." end if has_multiple("base_plate") then return false, "A truck cannot have multiple base plates." end if has("tires") and not has("base_plate") then return false, "A base plate is required to mount the tires." end if has_multiple("tires") then return false, "A truck cannot have multiple sets of tires." end if has("rear_panel") and not has("base_plate") then return false, "A base plate is required to mount the cabin rear panel." end if has_multiple("rear_panel") then return false, "A truck cannot have multiple cabin rear panels." end if has("cabin") and not has("base_plate") then return false, "A base plate is required to mount the cabin." end if has_multiple("cabin") then return false, "A truck cannot have multiple cabins." end if has("chassis_pillars_a") and not has("cabin") then return false, "A cabin is required to mount the pillars." end if has_multiple("chassis_pillars_a") then return false, "A truck cannot have multiple pairs of the same pillars." end if has("windscreen") and not (has("chassis_pillars_a") and has("rear_panel")) then return false, "Pillars (A) and a cabin rear panel are required to mount the windscreen." end if has_multiple("windscreen") then return false, "A truck cannot have multiple windscreens." end if has("roof") and not (has("chassis_pillars_a") and has("rear_panel")) then return false, "Pillars (A) and a cabin rear panel are required to mount the roof." end if has_multiple("roof") then return false, "A truck cannot have multiple roofs." end if has("interior") and not (has("cabin") and has("rear_panel")) then return false, "A cabin and a cabin rear panel is required to mount the interior." end if has_multiple("interior") then return false, "A truck cannot have multiple interiors." end if has("seats") and not has("cabin") then return false, "A cabin is required to mount the seats." end if has_multiple("seats") then return false, "A truck cannot have multiple sets of seats." end if has("light") and not (has("cabin") and has("roof") and has("platform")) then return false, "A full cabin (incl. roof) and a platform are required to mount lights." end if has_multiple("lights_front") or has_multiple("lights_back") or has_multiple("lights_reversing") or has_multiple("direction_indicator") then return false, "A truck cannot have multiple lights of the same type." end if has("license_plate") and not (has("cabin") and has("platform")) then return false, "A cabin and a platform are required to mount the license plates." end if has_multiple("license_plate") then return false, "A truck cannot have multiple license plates." end if has("cabin_accessory") and not has("cabin") then return false, "A cabin is required to mount accessories." end if has("panel_accessory") and not has("panel") then return false, "A panel is required to mount accessories." end if has("tarp_accessory") and not has("tarp") then return false, "A tarp is required to mount accessories." end if has("roof_attachment") and not (has("roof") and has("platform")) then return false, "A roof and a platform are required to mount a roof top attachment." end if has_multiple("roof_attachment") then return false, "A truck cannot have multiple roof top attachments." end if has("full_body") and not has("platform") then return false, "A platform is required to mount the body." end if has("full_body") and has("panel") then return false, "A truck cannot have a body and side panels." end if has_multiple("full_body") then return false, "A truck cannot have multiple bodies." end if has("panel") and not has("platform") then return false, "A platform is required to mount the panels." end if has_multiple("panel") then return false, "A truck cannot have multiple sets of panels." end if has("tarp") and not has("panel") then return false, "Side panels are required to mount the tarp." end if has_multiple("tarp") then return false, "A truck cannot have multiple tarps." end if has("tarp") and has("payload_tank") then return false, "A truck can either have a tarp or a payload tank, not both." end if has("rear_board") and not has("panel") then return false, "Panels are required to mount the rear board." end if has("rear_board") and (has("tarp") or has("payload_tank")) then return false, "No tarps or payload tanks are allowed when using the rear board." end if has_multiple("rear_board") then return false, "A truck cannot have multiple rear boards." end if has("payload_tank") and not has("panel") then return false, "Panels are required before mounting the payload tank." end if has_multiple("payload_tank") then return false, "A truck cannot have multiple payload tanks" end if has("engine") and not (has("cabin") and has("platform")) then return false, "A cabin and a platform are required to mount the engine." end if has_multiple("engine") then return false, "A truck cannot have multiple engines." end if has("main_tank") and not (has("cabin") and has("platform")) then return false, "A cabin and a platform are required to mount this tank or battery." end if has_multiple("main_tank") then return false, "A truck cannot have multiple fuel tanks or batteries." end if ts_vehicles.helpers.get_total_value(self, "storage_capacity", parts) < ts_vehicles.storage.get_total_count(id) then return false, "Not enough space." end if ts_vehicles.helpers.get_total_value(self, "payload_tank_capacity", parts) < (vd.data.payload_tank_amount or 0) then return false, "Not enough payload tank capacity." end if ts_vehicles.helpers.get_total_value(self, "gasoline_capacity", parts) < (vd.data.gasoline or 0) then return false, "Not enough gasoline capacity." end if ts_vehicles.helpers.get_total_value(self, "hydrogen_capacity", parts) < (vd.data.hydrogen or 0) then return false, "Not enough hydrogen capacity." end if ts_vehicles.helpers.get_total_value(self, "electricity_capacity", parts) < (vd.data.electricity or 0) then return false, "Not enough electricity capacity." end return true end, can_remove_part = function(self, part_name) local parts = VD(self._id).parts if not ts_vehicles.helpers.contains(parts, part_name) then return false, "Part does not exist on vehicle!" end local def = ts_vehicles.registered_vehicle_bases[self.name] local parts_copy = table.copy(parts) table.remove(parts_copy, ts_vehicles.helpers.index_of(parts_copy, part_name)) local is_structure_sound, reason = def.is_structure_sound(self, parts_copy) if not is_structure_sound then return false, reason end return true, nil end, get_part_drop = function(self, part_name) if not ts_vehicles.helpers.contains(VD(self._id).parts, part_name) then return nil end local part_def = ts_vehicles.registered_parts[part_name] if part_def and part_def.groups then if part_def.groups.tires then return ItemStack(part_name.." 4") elseif part_def.groups.seats then return ItemStack(part_name.." 2") end end return ItemStack(part_name) end, can_add_part = function(self, item) local def = ts_vehicles.registered_vehicle_bases[self.name] local part_name = item:get_name() local parts_copy = table.copy(VD(self._id).parts) table.insert(parts_copy, part_name) local is_structure_sound, reason = def.is_structure_sound(self, parts_copy) if not is_structure_sound then return false, reason end local part_def = ts_vehicles.registered_parts[part_name] if part_def and part_def.groups then if part_def.groups.tires then if item:get_count() < 4 then return false, "Not enough items; 4 are required." end item:take_item(4) return true, nil, item end if part_def.groups.seats then if item:get_count() < 2 then return false, "Not enough items; 2 are required." end item:take_item(2) return true, nil, item end end item:take_item() return true, nil, item end, gasoline_hose_offset = vector.new(1.4, .25, .75), hydrogen_hose_offset = vector.new(1.4, .25, .75), electricity_hose_offset = vector.new(1.4, .25, .75), payload_tank_hose_offset = vector.new(1.4, .25, -2.05), }) minetest.register_craft({ output = "ts_vehicles_cars:truck", recipe = { {"default:steelblock", "", "default:steelblock"}, {"", "dye:orange", ""}, {"default:steelblock", "", "default:steelblock"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:truck_undercarriage", { description = "Truck Undercarriage", inventory_image = "ts_vehicles_cars_truck_undercarriage_inv.png", groups = { undercarriage = 1 }, }) minetest.register_craft({ output = "ts_vehicles_cars:truck_undercarriage", recipe = { {"ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material"}, {"", "ts_vehicles_common:composite_material", ""}, {"ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:truck_cabin_rear_panel", { description = "Truck Cabin Rear Panel", inventory_image = "ts_vehicles_cbp.png^[mask:ts_vehicles_cars_cabin_rear_panel_inv_mask.png", groups = { rear_panel = 1 }, }) minetest.register_craft({ output = "ts_vehicles_cars:truck_cabin_rear_panel", recipe = { {"default:steel_ingot", "ts_vehicles_cars:base_plate", "default:steel_ingot"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:truck_cabin", { description = "Truck Cabin", inventory_image = "ts_vehicles_cars_truck_cabin_inv.png", groups = { cabin = 1 }, colorable = true, after_part_add = function(self, item) local color = item:get_meta():get("color") or item:get_definition().color if color then local vd = VD(self._id) vd.data.cabin_color = color vd.data.cabin_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) if vd.data.cabin_color then drop:get_meta():set_string("color", vd.data.cabin_color) end if vd.data.cabin_description then drop:get_meta():set_string("description", vd.data.cabin_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:truck_cabin", recipe = { {"ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", ""}, {"ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:truck_platform", { description = "Truck Platform", inventory_image = "ts_vehicles_cars_truck_platform_inv.png", inventory_overlay = "ts_vehicles_cars_truck_platform_inv_overlay.png", groups = { platform = 1 }, colorable = true, storage_capacity = 1000, after_part_add = function(self, item) local color = item:get_meta():get("color") or item:get_definition().color if color then local vd = VD(self._id) vd.data.platform_color = color vd.data.platform_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) if vd.data.platform_color then drop:get_meta():set_string("color", vd.data.platform_color) end if vd.data.platform_description then drop:get_meta():set_string("description", vd.data.platform_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:truck_platform", recipe = { {"ts_vehicles_common:composite_material", "default:wood", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", "default:wood", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", "default:wood", "ts_vehicles_common:composite_material"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:truck_panels", { description = "Truck Side Panels", inventory_image = "ts_vehicles_cars_truck_side_panels_inv.png", groups = { panel = 1 }, colorable = true, storage_capacity = 7000, after_part_add = function(self, item) local color = item:get_meta():get("color") or item:get_definition().color if color then local vd = VD(self._id) vd.data.panel_color = color vd.data.panel_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) if vd.data.panel_color then drop:get_meta():set_string("color", vd.data.panel_color) end if vd.data.panel_description then drop:get_meta():set_string("description", vd.data.panel_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:truck_panels", recipe = { {"default:wood", "ts_vehicles_common:composite_material", "default:wood"}, {"default:wood", "ts_vehicles_common:composite_material", "default:wood"}, {"default:wood", "ts_vehicles_common:composite_material", "default:wood"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:tarp", { description = "Truck Tarp", inventory_image = "ts_vehicles_cars_tarp_inv.png", groups = { tarp = 1 }, colorable = true, storage_capacity = 10000, after_part_add = function(self, item) local color = item:get_meta():get("color") or item:get_definition().color if color then local vd = VD(self._id) vd.data.tarp_color = color vd.data.tarp_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) if vd.data.tarp_color then drop:get_meta():set_string("color", vd.data.tarp_color) end if vd.data.tarp_description then drop:get_meta():set_string("description", vd.data.tarp_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:tarp", recipe = { {"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"}, {"basic_materials:plastic_sheet", "farming:string", "basic_materials:plastic_sheet"}, {"basic_materials:plastic_sheet", "farming:string", "basic_materials:plastic_sheet"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:payload_tank", { description = "Payload Tank", inventory_image = "ts_vehicles_cars_payload_tank_inv.png", groups = { payload_tank = 1 }, colorable = true, storage_capacity = -7500, payload_tank_capacity = 4000, after_part_add = function(self, item) local color = item:get_meta():get("color") or item:get_definition().color if color then local vd = VD(self._id) vd.data.tank_color = color vd.data.tank_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) if vd.data.tank_color then drop:get_meta():set_string("color", vd.data.tank_color) end if vd.data.tank_description then drop:get_meta():set_string("description", vd.data.tank_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:payload_tank", recipe = { {"ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", "techage:oiltank", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", "techage:ta3_pipeS", "techage:ta3_pipeS"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:combined_module", { description = "Combined Tank and Storage Module", inventory_image = "ts_vehicles_cars_combined_module_inv.png", groups = { full_body = 1 }, colorable = true, storage_capacity = 4000, payload_tank_capacity = 2000, after_part_add = function(self, item) local color = item:get_meta():get("color") or item:get_definition().color if color then local vd = VD(self._id) vd.data.combined_module_color = color vd.data.combined_module_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) if vd.data.combined_module_color then drop:get_meta():set_string("color", vd.data.combined_module_color) end if vd.data.combined_module_description then drop:get_meta():set_string("description", vd.data.combined_module_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:combined_module", recipe = { {"ts_vehicles_common:composite_material", "ts_vehicles_cars:payload_tank", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", "default:mese_block", "ts_vehicles_common:composite_material"}, {"ts_vehicles_common:composite_material", "techage:chest_ta4", "ts_vehicles_common:composite_material"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:warning_board", { description = "Truck Warning Board", inventory_image = "ts_vehicles_cars_warning_board_inv.png", groups = { rear_board = 1 }, get_formspec = function(self, player) local vd = VD(self._id) vd.data.warning_board = vd.data.warning_board or {} local current_data = vd.data.warning_board[vd.data.warning_board.current_slot] local fs = "" fs = fs.."style_type[label;font_size=*2]" fs = fs.."style_type[label;font=bold]" fs = fs.."label[0,-.75;Configure the Warning Board]" fs = fs.."style_type[label;font_size=*1]" fs = fs.."style_type[label;font=normal]" fs = fs.."label[0,0;Choose Slot:]" fs = fs.."button[0,.25;1.5,.75;slot1;Slot 1]" fs = fs.."button[1.5,.25;1.5,.75;slot2;Slot 2]" fs = fs.."button[3,.25;1.5,.75;slot3;Slot 3]" fs = fs.."button[4.5,.25;1.5,.75;slot4;Slot 4]" fs = fs.."button[6,.25;1.5,.75;slot5;Slot 5]" fs = fs.."button[7.5,.25;1.5,.75;off;Off]" if current_data then fs = fs.."style_type[textarea;font=mono]" fs = fs.."textarea[0,1.5;5,5.5;symbol;Matrix Image:;"..minetest.formspec_escape(current_data.symbol or "").."]" fs = fs.."style_type[textarea;font=normal]" fs = fs.."textarea[0,7.5;5,1.5;text;Warning Message:;"..minetest.formspec_escape(current_data.text or "").."]" fs = fs.."button[0,9.25;1.5,1;set;Set]" end return fs end, on_receive_fields = function(self, player, fields) local vd = VD(self._id) vd.data.warning_board = vd.data.warning_board or {} if fields.text and fields.symbol and fields.set then local current_data = vd.data.warning_board[vd.data.warning_board.current_slot] if current_data then current_data.symbol = fields.symbol current_data.text = fields.text end end if fields.slot1 then vd.data.warning_board.current_slot = "slot1" end if fields.slot2 then vd.data.warning_board.current_slot = "slot2" end if fields.slot3 then vd.data.warning_board.current_slot = "slot3" end if fields.slot4 then vd.data.warning_board.current_slot = "slot4" end if fields.slot5 then vd.data.warning_board.current_slot = "slot5" end if fields.off then vd.data.warning_board.current_slot = "off" end vd.tmp.light_textures_set = false end, after_part_add = function(self, item) local vd = VD(self._id) vd.data.warning_board = { current_slot = "slot1", slot1 = { symbol = "AAAAAAAMMAAAAAAA AAAAAAMMMMAAAAAA AAAAAAMMMMAAAAAA AAAAAMMAAMMAAAAA AAAAAMMAAMMAAAAA AAAAMMA//AMMAAAA AAAAMMA//AMMAAAA AAAMMAA//AAMMAAA AAAMMAA//AAMMAAA AAMMAAA//AAAMMAA AAMMAAAAAAAAMMAA AMMAAAA//AAAAMMA AMMAAAA//AAAAMMA MMAAAAAAAAAAAAMM MMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMM", text = "Achtung! Baustelle\n\nCaution!\nRoad Work Ahead", }, slot2 = { symbol = "AAAAAAMMMMAAAAAA AAAAMMMMMMMMAAAA AAMMMMAAAAMMMMAA AAMMAAAAAAAAMMAA AMMAAAAAAAAAAMMA AMMAAAAAAAAAAMMA MMAAAAAAAAAAAAMM MMAA////////AAMM MMAA////////AAMM MMAAAAAAAAAAAAMM AMMAAAAAAAAAAMMA AMMAAAAAAAAAAMMA AAMMAAAAAAAAMMAA AAMMMMAAAAMMMMAA AAAAMMMMMMMMAAAA AAAAAAMMMMAAAAAA", text = "KEINE DURCHFAHRT\n\nROAD CLOSED" }, slot3 = { symbol = "AAAAAADDDDAAAAAA AAAADDDDDDDDAAAA AADDDDDDDDDDDDAA AADDDDDDDDD//DAA ADDDDDDDDD///DDA ADDDDDDDD///DDDA DDD//DDD///DDDDD DDD//DD///DDDDDD DDD//D///DDDDDDD DDD/////DDDDDDDD ADD////DDDDDDDDA ADD///////DDDDDA AAD///////DDDDAA AADDDDDDDDDDDDAA AAAADDDDDDDDAAAA AAAAAADDDDAAAAAA", text = "Links fahren\n\nKeep Left" }, slot4 = { symbol = "AAAAAADDDDAAAAAA AAAADDDDDDDDAAAA AADDDDDDDDDDDDAA AAD//DDDDDDDDDAA ADD///DDDDDDDDDA ADDD///DDDDDDDDA DDDDD///DDD//DDD DDDDDD///DD//DDD DDDDDDD///D//DDD DDDDDDDD/////DDD ADDDDDDDD////DDA ADDDDD///////DDA AADDDD///////DAA AADDDDDDDDDDDDAA AAAADDDDDDDDAAAA AAAAAADDDDAAAAAA", text = "Rechts fahren\n\nKeep Right" }, slot5 = { symbol = "AsAAAAAAAAAAAAsA sssAAAAAAAAAAsss AsssAAAAAAAAsssA AAsssAAAAAAsssAA AAAsssAAAAsssAAA AAAAsssAAsssAAAA AAAAAssssssAAAAA AAAAAAssssAAAAAA AAAAAAssssAAAAAA AAAAAssssssAAAAA AAAAsssAAsssAAAA AAAsssAAAAsssAAA AAsssAAAAAAsssAA AsssAAAAAAAAsssA sssAAAAAAAAAAsss AsAAAAAAAAAAAAsA", text = "Fahrspur gesperrt\n\nLane Closed" } } end, after_part_remove = function(self, drop) local vd = VD(self._id) vd.data.warning_board = nil end, }) minetest.register_craft({ output = "ts_vehicles_cars:warning_board", recipe = { {"dye:red", "ts_vehicles_cars:amber_light", "dye:red"}, {"dye:white", "ta4_addons:matrix_screen", "dye:white"}, {"ts_vehicles_common:composite_material", "techage:ta4_leds", "ts_vehicles_common:composite_material"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:panels_text", { description = "Text on truck side panels", inventory_image = "ts_vehicles_cars_text_inv.png", inventory_overlay = "ts_vehicles_cars_panel_text_inv_overlay.png", groups = { panel_accessory = 1 }, colorable = true, default_color = "#000", get_formspec = function(self, player) local vd = VD(self._id) local fs = "" fs = fs.."style_type[label;font_size=*2]" fs = fs.."style_type[label;font=bold]" fs = fs.."label[0,.25;Set text for the panels]" fs = fs.."style_type[label;font_size=*1]" fs = fs.."style_type[label;font=normal]" fs = fs.."textarea[0,1;3,1;text;;"..minetest.formspec_escape(vd.data.panels_text or "").."]" fs = fs.."button[3,1;1.5,1;set;Set]" return fs end, on_receive_fields = function(self, player, fields) if fields.text and (fields.set or fields.key_enter_field == "text") then local vd = VD(self._id) vd.data.panels_text = fields.text vd.tmp.base_textures_set = false end end, after_part_add = function(self, item) local vd = VD(self._id) vd.data.panels_text = "Placeholder Text" local color = item:get_meta():get("color") or item:get_definition().color if color then vd.data.panels_text_color = color vd.data.panels_text_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) vd.data.panels_text = nil if vd.data.panels_text_color then drop:get_meta():set_string("color", vd.data.panels_text_color) end if vd.data.panels_text_description then drop:get_meta():set_string("description", vd.data.panels_text_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:panels_text", recipe = { {"", "ts_vehicles_cars:chassis_text", ""}, {"default:wood", "default:wood", "default:wood"}, }, }) ts_vehicles.register_part("ts_vehicles_cars:tarp_text", { description = "Text on tarp", inventory_image = "ts_vehicles_cars_text_inv.png", inventory_overlay = "ts_vehicles_cars_tarp_text_inv_overlay.png", groups = { tarp_accessory = 1 }, colorable = true, default_color = "#000", get_formspec = function(self, player) local vd = VD(self._id) local fs = "" fs = fs.."style_type[label;font_size=*2]" fs = fs.."style_type[label;font=bold]" fs = fs.."label[0,.25;Set text for the tarp]" fs = fs.."style_type[label;font_size=*1]" fs = fs.."style_type[label;font=normal]" fs = fs.."textarea[0,1;3,1;text;;"..minetest.formspec_escape(vd.data.tarp_text or "").."]" fs = fs.."button[3,1;1.5,1;set;Set]" return fs end, on_receive_fields = function(self, player, fields) local vd = VD(self._id) if fields.text and (fields.set or fields.key_enter_field == "text") then vd.data.tarp_text = fields.text vd.tmp.base_textures_set = false end end, after_part_add = function(self, item) local vd = VD(self._id) vd.data.tarp_text = "Placeholder Text" local color = item:get_meta():get("color") or item:get_definition().color if color then vd.data.tarp_text_color = color vd.data.tarp_text_description = item:get_description() end end, after_part_remove = function(self, drop) local vd = VD(self._id) vd.data.tarp_text = nil if vd.data.tarp_text_color then drop:get_meta():set_string("color", vd.data.tarp_text_color) end if vd.data.tarp_text_description then drop:get_meta():set_string("description", vd.data.tarp_text_description) end end, }) minetest.register_craft({ output = "ts_vehicles_cars:tarp_text", recipe = { {"ts_vehicles_cars:chassis_text"}, {"techage:canister_epoxy"}, }, replacements = { {"techage:canister_epoxy", "techage:ta3_canister_empty"} } }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:truck_undercarriage", { get_textures = function(self) return { undercarriage = "ts_vehicles_cbp.png", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:tire", { get_textures = function(self) return { tires = "ts_vehicles_ct.png", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:base_plate", { get_textures = function(self) return { base_plate = "ts_vehicles_cbp.png", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:truck_cabin_rear_panel", { get_textures = function(self) return { rear_panel = "ts_vehicles_cbp.png", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:truck_cabin", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.cabin_color then color = vd.data.cabin_color end return { cabin = "ts_vehicles_ctc.png^[multiply:"..color.."^ts_vehicles_ctc_.png", } end, get_fallback_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.cabin_color then color = vd.data.cabin_color end return { interior = "ts_vehicles_cti.png^[multiply:"..color } end }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:truck_platform", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.platform_color then color = vd.data.platform_color end return { platform_top = "default_wood.png", platform = "ts_vehicles_ctp.png^[multiply:"..color, } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:truck_panels", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.panel_color then color = vd.data.panel_color end return { framework = "ts_vehicles_ctfp.png^[multiply:"..color, body = "ts_vehicles_ctsp.png^[multiply:"..color, body_inside = "ts_vehicles_ctsp.png^[multiply:"..color, } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:tarp", { get_overlay_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.tarp_color then color = vd.data.tarp_color end return { framework = "(ts_vehicles_ctft.png^[multiply:"..color..")", body = "(ts_vehicles_ctt.png^[multiply:"..color..")", body_inside = "(ts_vehicles_ctt.png^[multiply:"..color..")", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:payload_tank", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.tank_color then color = vd.data.tank_color end return { tank = "ts_vehicles_ctpt.png^[multiply:"..color, } end, get_overlay_textures = function(self) return { platform = "ts_vehicles_ctpt_.png" } end }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:combined_module", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.combined_module_color then color = vd.data.combined_module_color end return { body = "ts_vehicles_ctcm.png^[multiply:"..color, framework = "ts_vehicles_ctfcm.png^[multiply:"..color, } end, get_overlay_textures = function(self) return { platform = "ts_vehicles_ctpt_.png", body = "ts_vehicles_ctcm_.png", } end }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:warning_board", { get_textures = function(self) return { rear_board = "ts_vehicles_ctwb.png" } end, get_overlay_textures = function(self) return { framework = "ts_vehicles_ctfw.png" } end, get_light_textures = function(self) local vd = VD(self._id) local result = {} if vd.lights.special then result.rear_board_1 = "ts_vehicles_ctwb_.png^[transformFX" result.rear_board_2 = "ts_vehicles_ctwb_.png" end local texture = "[combine:304x304" vd.data.warning_board = vd.data.warning_board or {} local current_data = vd.data.warning_board[vd.data.warning_board.current_slot] if ts_vehicles.writing and current_data then local text = font_api.get_font("metro"):render(current_data.text or "", 192, 64, { lines = 4, halign = "center", valign = "center", color= "#c80", }).."^[resize:288x96" texture = texture..":8,144="..E(text) end if minetest.get_modpath("ta4_addons") and ta4_addons.base64_to_texture and current_data then local symbol = ta4_addons.base64_to_texture(current_data.symbol or "") texture = texture..":88,8="..E(symbol) end result.rear_board = texture return result end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:car_chassis_pillars_a", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.pillars_a_color then color = vd.data.pillars_a_color end return { pillars_a = "ts_vehicles_cp.png^[multiply:"..color, } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:windows", { get_textures = function(self) return { glass = "ts_vehicles_ctw.png", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:car_roof", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.roof_color then color = vd.data.roof_color end return { roof = "ts_vehicles_cr.png^[multiply:"..color, } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:car_interior", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.interior_color then color = vd.data.interior_color end return { interior = "ts_vehicles_cti.png^[multiply:"..color.."^ts_vehicles_cti_.png", } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:seat", { get_textures = function(self) local vd = VD(self._id) local color = "#fff" if vd.data.seats_color then color = vd.data.seats_color end return { seats = "wool_white.png^[multiply:"..color, } end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:direction_indicator", { get_overlay_textures = function(self) return { cabin = "(ts_vehicles_ctdf.png)", platform = "(ts_vehicles_ctdb.png)", } end, get_light_overlay_textures = function(self) local vd = VD(self._id) local tmp = {} if vd.lights.left or vd.lights.warn then tmp[#tmp+1] = "(ts_vehicles_ctdl_.png)" end if vd.lights.right or vd.lights.warn then tmp[#tmp+1] = "(ts_vehicles_ctdr_.png)" end if #tmp > 0 then return { chassis_1 = table.concat(tmp, "^") } end end }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:lights_front", { get_overlay_textures = function(self) return { cabin = "(ts_vehicles_ctfl.png)", } end, get_light_overlay_textures = function(self) local vd = VD(self._id) if vd.lights.front then return { chassis = "(ts_vehicles_ctfl_.png)", } end end }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:lights_back", { get_overlay_textures = function(self) return { platform = "(ts_vehicles_ctbl.png)", } end, get_light_overlay_textures = function(self) local vd = VD(self._id) if vd.lights.stop then return { chassis = "(ts_vehicles_ctbl_.png)", } end end }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:lights_reversing", { get_overlay_textures = function(self) return { platform = "(ts_vehicles_ctrl.png)", } end, get_light_overlay_textures = function(self) local vd = VD(self._id) if vd.v < 0 then return { chassis = "(ts_vehicles_ctrl_.png)", } end end }) for _,def in ipairs(ts_vehicles_cars.lightbars) do ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:"..def.id.."_light", { get_textures = function(self) return { roof_attachment = def.off } end, get_light_textures = function(self) local vd = VD(self._id) local result = {} if ts_vehicles.writing then local text = font_api.get_font("metro"):render(vd.data.roof_top_text or "", 64, 16, { lines = 1, halign = "center", valign = "center", color= "#c00", }) result.roof_attachment = "[combine:128x128:32,38=("..E(text).."):32,102=("..E(text)..")" end if vd.lights.special then result.roof_attachment_1 = def.on1 result.roof_attachment_2 = def.on2 end return result end, get_overlay_textures = function(self) return { platform = def.off:gsub("%.png", "_tp.png") } end, get_light_overlay_textures = function(self) local vd = VD(self._id) if vd.lights.special then return { chassis_1 = "("..def.on1:gsub("%.png", "_tp.png")..")^ts_vehicles_ctsl_.png", chassis_2 = "("..def.on2:gsub("%.png", "_tp.png")..")" } end end, }) end ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:license_plate", { get_overlay_textures = function(self) local vd = VD(self._id) if ts_vehicles.writing then local text = font_api.get_font("metro"):render(vd.data.license_plate_text or "", 80, 16, { lines = 1, halign = "center", valign = "center", color = "#000", }) return { cabin = "ts_vehicles_ctlpf.png^[combine:384x384:152,228=("..E(text)..")", platform = "ts_vehicles_ctlpb.png^[combine:448x448:184,316=("..E(text)..")" } end end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:chassis_text", { get_overlay_textures = function(self) local vd = VD(self._id) if ts_vehicles.writing then local text = font_api.get_font("metro"):render(vd.data.chassis_text or "", 152, 32, { lines = 2, halign = "center", valign = "center", color = vd.data.chassis_text_color or "#000", }) return { cabin = "[combine:384x384:0,52=("..E(text).."):232,52=("..E(text)..")", } end end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:panels_text", { get_overlay_textures = function(self) local vd = VD(self._id) if ts_vehicles.writing then local text = font_api.get_font("metro"):render(vd.data.panels_text or "", 212, 32, { lines = 2, halign = "center", valign = "center", color = vd.data.panels_text_color or "#000", }) local large_text = text.."^[resize:424x64" return { body = "[combine:800x800:0,488=("..E(large_text).."):0,736=("..E(large_text).."):542,752=("..E(text)..")", } end end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:tarp_text", { get_overlay_textures = function(self) local vd = VD(self._id) if ts_vehicles.writing then local text = font_api.get_font("metro"):render(vd.data.tarp_text or "", 212, 48, { lines = 3, halign = "center", valign = "center", color = vd.data.tarp_text_color or "#000", }) local large_text = text.."^[resize:424x96" return { body = "[combine:800x800:0,312=("..E(large_text).."):0,560=("..E(large_text).."):542,576=("..E(text)..")", } end end, }) ts_vehicles.register_compatibility("ts_vehicles_cars:truck", "ts_vehicles_cars:chassis_stripe", { get_overlay_textures = function(self) local vd = VD(self._id) local color = vd.data.chassis_stripe_color or "#fff" return { cabin = "(ts_vehicles_cts.png^[multiply:"..color..")", } end, }) ts_vehicles_common.register_engine_compatibility("ts_vehicles_cars:truck") ts_vehicles_common.register_tank_compatibility("ts_vehicles_cars:truck") ts_vehicles_common.register_aux_tank_compatibility("ts_vehicles_cars:truck")
local metainfo = require 'metainfo' local index = io.open("index.html", "w") index:write("<!DOCTYPE html>\ <html><head><script>window.location.href = '/site'</script></head>\ <body>redirecting... <a href='" .. metainfo.home_url .. "/site'>click here if it's taking too long</a></body>\ </html>") index:close()
function onCreate() --Iterate over all notes for i = 0, getProperty('unspawnNotes.length')-1 do if getPropertyFromGroup('unspawnNotes', i, 'noteType') == 'DODGE' then setPropertyFromGroup('unspawnNotes', i, 'texture', 'DODGE_assets'); --Change texture if getPropertyFromGroup('unspawnNotes', i, 'mustPress') then --Doesn't let Dad/Opponent notes get ignored end end end --debugPrint('Script started!') end function noteMiss(id, direction, noteType, isSustainNote) -- If the note was missed if noteType == "DODGE" then setProperty('health', 0); -- Hurts the player of they miss the note end end function goodNoteHit(id, direction, noteType, isSustainNote) -- If the note was hit if noteType == "DODGE" then characterPlayAnim('boyfriend', 'dodge', true); -- Plays the dodge animation for the bf end end
local Window = Widget:new() function Window:new(x, y, width, height) local window = Widget:new(nil, x, y, width, height) setmetatable(window, self) self.__index = self window.children = {} return window end function Widget:update(dt) for k, child in pairs(self.children) do child:update(dt) end end function Window:draw() local border = 10 Graphics.setColor(Colors.YELLOW_DARK) Graphics.rectangle("fill", self.x, self.y, self.width, self.height, 10, 10) Graphics.setColor( Colors.YELLOW_LIGHT) Graphics.rectangle("fill", self.x + border, self.y + border, self.width - 2 *border, self.height - 2* border, 10, 10) Graphics.setColor(Colors.WHITE) for k, child in pairs(self.children) do child.x = child.originalX + self.x child.y = child.originalY + self.y Graphics.setScissor(self.x, self.y, self.width, self.height) child:draw() Graphics.setScissor() end end function Window:addChild(child) child.originalX = child.x child.originalY = child.y table.insert(self.children, child) end function Window:removeChild(idx) table.remove(self.children, idx) end return Window
protection_memoize = { -- opt-in -- TODO: set to true after testing enabled = false, periodic_flush = 2 } local MP = minetest.get_modpath("protection_memoize") dofile(MP.."/memoize.lua") dofile(MP.."/chatcommands.lua") dofile(MP.."/is_protected.lua") dofile(MP.."/periodic_flush.lua") if minetest.get_modpath("protector") then dofile(MP.."/compat/protector.lua") end if minetest.get_modpath("priv_protector") then dofile(MP.."/compat/priv_protector.lua") end if minetest.get_modpath("xp_redo") then dofile(MP.."/compat/xp_redo.lua") end if minetest.get_modpath("jumpdrive") then dofile(MP.."/compat/jumpdrive.lua") end if minetest.get_modpath("areas") then dofile(MP.."/compat/areas.lua") end
--[[ PLUGIN USERS README HERE: If you clicked the question mark and this script popped up, then read here. You can add any ChatTitle with the same name below. Do not use the IDs for this section. ]]--- local module = {} local AchievementsChart = { { ID = 1, Name = "VIP", Description = "Obtained from purchasing the VIP Game Pass.", Color = Color3.fromRGB() }, { ID = 2, Name = "Trailblazer", Description = "Obtained from purchasing Early Access.", Color = Color3.fromRGB(0, 255, 0) }, { ID = 3, Name = "Robot Destroyer", Description = "Obtained from defeating BossMan for the first time.", Color = Color3.fromRGB() }, { ID = 4, Name = "Alilu of Triumph", Description = "Obtained from completing City Roads.", Color = Color3.fromRGB() }, { ID = 5, Name = "Developer", Description = "Obtained from being a cool kid.", Color = Color3.fromRGB(255, 0, 0) }, { ID = 6, Name = "Heroes Never Die", Description = "Obtained from surviving Heroes Must Die.", Color = Color3.fromRGB(255, 0, 0) }, } function module:GetTitlesChart() return AchievementsChart end function module:GetTitle(Name) for i = 1, #AchievementsChart do local Achievement = AchievementsChart[i] if Achievement.Name == Name then return Achievement end end end function module:GetTitleFromID(ID) for i = 1, #AchievementsChart do local Achievement = AchievementsChart[i] if Achievement.ID == ID then return Achievement end end end return module
-- Copyright 2022 SmartThings -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. local test = require "integration_test" local capabilities = require "st.capabilities" local zw = require "st.zwave" local zw_test_utils = require "integration_test.zwave_test_utils" local Meter = (require "st.zwave.CommandClass.Meter")({version=3}) local SwitchBinary = (require "st.zwave.CommandClass.SwitchBinary")({version=2}) local Configuration = (require "st.zwave.CommandClass.Configuration")({ version=4 }) local t_utils = require "integration_test.utils" local AEOTEC_MANUFACTURER_ID = 0x0086 local AEOTEC_PRODUCT_TYPE = 0x0003 local AEOTEC_PRODUCT_ID = 0x0084 local ZOOZ_MANUFACTURER_ID = 0x027A local ZOOZ_PRODUCT_TYPE = 0xA000 local ZOOZ_PRODUCT_ID = 0xA003 local switch_multicomponent_endpoints = { { command_classes = { { value = zw.BASIC }, { value = zw.SWITCH_BINARY }, { value = zw.METER } } }, { command_classes = { { value = zw.BASIC }, { value = zw.SWITCH_BINARY }, { value = zw.METER } } } } local mock_aeotec_switch_multicomponent = test.mock_device.build_test_zwave_device({ profile = t_utils.get_profile_definition("dual-metering-switch.yml"), zwave_endpoints = switch_multicomponent_endpoints, zwave_manufacturer_id = AEOTEC_MANUFACTURER_ID, zwave_product_type = AEOTEC_PRODUCT_TYPE, zwave_product_id = AEOTEC_PRODUCT_ID }) local mock_zooz_switch_multicomponent = test.mock_device.build_test_zwave_device({ profile = t_utils.get_profile_definition("dual-metering-switch.yml"), zwave_endpoints = switch_multicomponent_endpoints, zwave_manufacturer_id = ZOOZ_MANUFACTURER_ID, zwave_product_type = ZOOZ_PRODUCT_TYPE, zwave_product_id = ZOOZ_PRODUCT_ID }) local function test_init() test.mock_device.add_test_device(mock_aeotec_switch_multicomponent) test.mock_device.add_test_device(mock_zooz_switch_multicomponent) end test.set_test_init_function(test_init) test.register_coroutine_test( "Refresh sends commands to all components including base device", function() -- refresh commands for zwave devices do not have guaranteed ordering test.socket.zwave:__set_channel_ordering("relaxed") test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) )) test.socket.capability:__queue_receive({ mock_aeotec_switch_multicomponent.id, { capability = "refresh", component = "main", command = "refresh", args = { } } }) end ) test.register_message_test( "Multichannel switch on/off capability command on from component 1 should be handled: on", { { channel = "capability", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, { capability = "switch", command = "on", component = "switch1", args = {} } } }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Set({ target_value=0xFF }, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1}}) ) } } ) test.register_message_test( "Multichannel switch on/off capability command off from main component should be handled: off", { { channel = "capability", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, { capability = "switch", command = "off", component = "main", args = {} } } }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Set({ target_value=0x00 }) ) } } ) test.register_coroutine_test( "doConfigure lifecycle event should generate proper configuration commands for aeotec switch", function () test.socket.zwave:__set_channel_ordering("relaxed") test.socket.device_lifecycle:__queue_receive({ mock_aeotec_switch_multicomponent.id, "doConfigure"}) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 255, size = 1, configuration_value = 0}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 4, size = 1, configuration_value = 1}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 80, size = 1, configuration_value = 2}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 101, size = 4, configuration_value = 2048}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 111, size = 4, configuration_value = 600}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 102, size = 4, configuration_value = 4096}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 112, size = 4, configuration_value = 600}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 90, size = 1, configuration_value = 1}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Configuration:Set({parameter_number = 91, size = 2, configuration_value = 20}) )) mock_aeotec_switch_multicomponent:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end ) test.register_message_test( "Binary switch on/off report from channel 1 should be handled: on", { { channel = "device_lifecycle", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, "init" }, }, { channel = "zwave", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(SwitchBinary:Report({ target_value=0xFF }, {encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0}}))} }, { channel = "capability", direction = "send", message = mock_aeotec_switch_multicomponent:generate_test_message("switch1", capabilities.switch.switch.on()) }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1}}) ) } } ) test.register_message_test( "Z-Wave SwitchBinary reports with value-off should evoke Switch capability off events", { { channel = "device_lifecycle", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, "init" }, }, { channel = "zwave", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command( SwitchBinary:Report({ target_value=0x00 }) ) } }, { channel = "capability", direction = "send", message = mock_aeotec_switch_multicomponent:generate_test_message("main", capabilities.switch.switch.off()) }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } } ) do local energy = 5 test.register_message_test( "Energy meter report should be handled", { { channel = "zwave", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.KILOWATT_HOURS, meter_value = energy}) )} }, { channel = "capability", direction = "send", message = mock_aeotec_switch_multicomponent:generate_test_message("main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } } ) end do local energy = 5 test.register_message_test( "Energy meter report from multicomponent should be handled", { { channel = "zwave", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.KILOWATT_HOURS, meter_value = energy}, { encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0} }) )} }, { channel = "capability", direction = "send", message = mock_aeotec_switch_multicomponent:generate_test_message("switch1", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } } ) end do local power = 89 test.register_message_test( "Power meter report should be handled", { { channel = "zwave", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.WATTS, meter_value = power}) )} }, { channel = "capability", direction = "send", message = mock_aeotec_switch_multicomponent:generate_test_message("main", capabilities.powerMeter.power({ value = power, unit = "W" })) } } ) end do local power = 89 test.register_message_test( "Power meter report from multicomponent should be handled", { { channel = "zwave", direction = "receive", message = { mock_aeotec_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.WATTS, meter_value = power}, { encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0} }) )} }, { channel = "capability", direction = "send", message = mock_aeotec_switch_multicomponent:generate_test_message("switch1", capabilities.powerMeter.power({ value = power, unit = "W" })) } } ) end test.register_coroutine_test( "Switch capability off commands should evoke the correct Z-Wave SETs and GETs", function() test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") test.socket.capability:__queue_receive({ mock_aeotec_switch_multicomponent.id, { capability = "switch", command = "off", args = {} } }) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Set({ target_value = SwitchBinary.value.OFF_DISABLE }) ) ) test.wait_for_events() test.mock_time.advance_time(1) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Get({}) ) ) end ) test.register_coroutine_test( "Switch capability off commands from multicomponent should evoke the correct Z-Wave SETs and GETs", function() test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") test.socket.capability:__queue_receive({ mock_aeotec_switch_multicomponent.id, { capability = "switch", command = "off", component = "switch1", args = {} } }) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Set({ target_value = SwitchBinary.value.OFF_DISABLE }, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} } ) ) ) test.wait_for_events() test.mock_time.advance_time(1) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_aeotec_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) ) ) end ) test.register_coroutine_test( "Zooz - doConfigure lifecycle event should generate proper configuration commands for zooz switch", function () test.socket.zwave:__set_channel_ordering("relaxed") test.socket.device_lifecycle:__queue_receive({ mock_zooz_switch_multicomponent.id, "doConfigure" }) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Configuration:Set({parameter_number = 2, size = 4, configuration_value = 10}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Configuration:Set({parameter_number = 3, size = 4, configuration_value = 600}) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Configuration:Set({parameter_number = 4, size = 4, configuration_value = 600}) )) test.socket.zwave:__set_channel_ordering("relaxed") mock_zooz_switch_multicomponent:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end ) test.register_coroutine_test( "Zooz - Refresh sends commands to all components including base device", function() -- refresh commands for zwave devices do not have guaranteed ordering test.socket.zwave:__set_channel_ordering("relaxed") test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} }) )) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} }) )) test.socket.capability:__queue_receive({ mock_zooz_switch_multicomponent.id, { capability = "refresh", component = "main", command = "refresh", args = { } } }) end ) test.register_message_test( "Multichannel switch on/off capability command on from component 1 should be handled: on", { { channel = "capability", direction = "receive", message = { mock_zooz_switch_multicomponent.id, { capability = "switch", command = "on", component = "main", args = {} } } }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Set({ target_value=0xFF }, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1}} ) ) } } ) test.register_message_test( "Zooz - Multichannel switch on/off capability command on from component 2 should be handled: on", { { channel = "capability", direction = "receive", message = { mock_zooz_switch_multicomponent.id, { capability = "switch", command = "on", component = "switch1", args = {} } } }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Set({ target_value=0xFF }, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2}} ) ) } } ) test.register_message_test( "Zooz - Multichannel switch on/off capability command off from main component should be handled: off", { { channel = "capability", direction = "receive", message = { mock_zooz_switch_multicomponent.id, { capability = "switch", command = "off", component = "main", args = {} } } }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Set( { target_value=0x00 }, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} } ) ) } } ) test.register_message_test( "Zooz - Multichannel switch on/off capability command off from switch1 component should be handled: off", { { channel = "capability", direction = "receive", message = { mock_zooz_switch_multicomponent.id, { capability = "switch", command = "off", component = "switch1", args = {} } } }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Set( { target_value=0x00 }, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} } ) ) } } ) test.register_message_test( "Zooz - Binary switch on/off report from channel 1 should be handled: on", { { channel = "device_lifecycle", direction = "receive", message = { mock_zooz_switch_multicomponent.id, "init" }, }, { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(SwitchBinary:Report({ target_value=0xFF }, {encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0}}))} }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("main", capabilities.switch.switch.on()) }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1}}) ) } } ) test.register_message_test( "Zooz - Binary switch on/off report from channel 2 should be handled: on", { { channel = "device_lifecycle", direction = "receive", message = { mock_zooz_switch_multicomponent.id, "init" }, }, { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(SwitchBinary:Report({ target_value=0xFF }, {encap = zw.ENCAP.AUTO, src_channel = 2, dst_channels = {0}}))} }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("switch1", capabilities.switch.switch.on()) }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get({scale = Meter.scale.electric_meter.WATTS}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2}}) ) } } ) test.register_message_test( "Zooz - SwitchBinary reports with value-off from endpoint 1 should evoke Switch capability off events", { { channel = "device_lifecycle", direction = "receive", message = { mock_zooz_switch_multicomponent.id, "init" }, }, { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command( SwitchBinary:Report( { target_value=0x00 }, { encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0} }) ) } }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("main", capabilities.switch.switch.off()) }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get( {scale = Meter.scale.electric_meter.WATTS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} } ) ) } } ) test.register_message_test( "Zooz - SwitchBinary reports with value-off from endpoint 2 should evoke Switch capability off events", { { channel = "device_lifecycle", direction = "receive", message = { mock_zooz_switch_multicomponent.id, "init" }, }, { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command( SwitchBinary:Report( { target_value=0x00 }, { encap = zw.ENCAP.AUTO, src_channel = 2, dst_channels = {0} }) ) } }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("switch1", capabilities.switch.switch.off()) }, { channel = "zwave", direction = "send", message = zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, Meter:Get( {scale = Meter.scale.electric_meter.WATTS}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} } ) ) } } ) do local energy = 5 test.register_message_test( "Zooz - Energy meter report from endpoint 1 should be handled", { { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.KILOWATT_HOURS, meter_value = energy}, { encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0} }) )} }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } } ) end do local energy = 5 test.register_message_test( "Zooz - Energy meter report from endpoint 2 should be handled", { { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.KILOWATT_HOURS, meter_value = energy}, {encap = zw.ENCAP.AUTO, src_channel = 2, dst_channels = {0}}) )} }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("switch1", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } } ) end do local power = 89 test.register_message_test( "Zooz - Power meter report from endpoint 1 should be handled", { { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.WATTS, meter_value = power}, {encap = zw.ENCAP.AUTO, src_channel = 1, dst_channels = {0}}) )} }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("main", capabilities.powerMeter.power({ value = power, unit = "W" })) } } ) end do local power = 89 test.register_message_test( "Zooz - Power meter report from endpoint 2 should be handled", { { channel = "zwave", direction = "receive", message = { mock_zooz_switch_multicomponent.id, zw_test_utils.zwave_test_build_receive_command(Meter:Report({ scale = Meter.scale.electric_meter.WATTS, meter_value = power}, {encap = zw.ENCAP.AUTO, src_channel = 2, dst_channels = {0}}) )} }, { channel = "capability", direction = "send", message = mock_zooz_switch_multicomponent:generate_test_message("switch1", capabilities.powerMeter.power({ value = power, unit = "W" })) } } ) end test.register_coroutine_test( "Zooz - Switch capability off commands from main component should evoke the correct Z-Wave SETs and GETs", function() test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") test.socket.capability:__queue_receive({ mock_zooz_switch_multicomponent.id, {capability = "switch", command = "off", component = "main", args = {}} }) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Set({ target_value = SwitchBinary.value.OFF_DISABLE }, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} } ) ) ) test.wait_for_events() test.mock_time.advance_time(1) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {1} }) ) ) end ) test.register_coroutine_test( "Zooz - Switch capability off commands from switch1 component should evoke the correct Z-Wave SETs and GETs", function() test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") test.socket.capability:__queue_receive({ mock_zooz_switch_multicomponent.id, { capability = "switch", command = "off", component = "switch1", args = {} } }) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Set({ target_value = SwitchBinary.value.OFF_DISABLE }, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} } ) ) ) test.wait_for_events() test.mock_time.advance_time(1) test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( mock_zooz_switch_multicomponent, SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2} }) ) ) end ) test.run_registered_tests()
object_tangible_tcg_series1_decorative_painting_imperial_propaganda = object_tangible_tcg_series1_shared_decorative_painting_imperial_propaganda:new { } ObjectTemplates:addTemplate(object_tangible_tcg_series1_decorative_painting_imperial_propaganda, "object/tangible/tcg/series1/decorative_painting_imperial_propaganda.iff")
-- luacheck: globals unpack local unpack = unpack or table.unpack local M = {} M.WILDCARD = "*" M.DEFERRED = 0 M.SUCCEEDED = 1 M.NO_TRANSITION = 2 M.PENDING = 3 M.CANCELLED = 4 local function do_callback(handler, args) if handler then return handler(unpack(args)) end end local function before_event(self, event, _, _, args) local specific = do_callback(self["on_before_" .. event], args) local general = do_callback(self["on_before_event"], args) if specific == false or general == false then return false end end local function leave_state(self, _, from, _, args) local specific = do_callback(self["on_leave_" .. from], args) local general = do_callback(self["on_leave_state"], args) if specific == false or general == false then return false end if specific == M.DEFERRED or general == M.DEFERRED then return M.DEFERRED end end local function enter_state(self, _, _, to, args) do_callback(self["on_enter_" .. to] or self["on_" .. to], args) do_callback(self["on_enter_state"] or self["on_state"], args) end local function after_event(self, event, _, _, args) do_callback(self["on_after_" .. event] or self["on_" .. event], args) do_callback(self["on_after_event"] or self["on_event"], args) end local function build_transition(self, event, states) return function (...) local from = self.current local to = states[from] or states[M.WILDCARD] or from local args = {self, event, from, to, ...} assert(not self.is_pending(), "previous transition still pending") assert(self.can(event), "invalid transition from state '" .. from .. "' with event '" .. event .. "'") local before = before_event(self, event, from, to, args) if before == false then return M.CANCELLED end if from == to then after_event(self, event, from, to, args) return M.NO_TRANSITION end self.confirm = function () self.confirm = nil self.cancel = nil self.current = to enter_state(self, event, from, to, args) after_event(self, event, from, to, args) return M.SUCCEEDED end self.cancel = function () self.confirm = nil self.cancel = nil after_event(self, event, from, to, args) return M.CANCELLED end local leave = leave_state(self, event, from, to, args) if leave == false then return M.CANCELLED end if leave == M.DEFERRED then return M.PENDING end if self.confirm then return self.confirm() end end end function M.create(cfg, target) local self = target or {} -- Initial state. local initial = cfg.initial -- Allow for a string, or a map like `{state = "foo", event = "setup"}`. initial = type(initial) == "string" and {state = initial} or initial -- Initial event. local initial_event = initial and initial.event or "startup" -- Terminal state. local terminal = cfg.terminal -- Events. local events = cfg.events or {} -- Callbacks. local callbacks = cfg.callbacks or {} -- Track state transitions allowed for an event. local states_for_event = {} -- Track events allowed from a state. local events_for_state = {} local function add(e) -- Allow wildcard transition if `from` is not specified. local from = type(e.from) == "table" and e.from or (e.from and {e.from} or {M.WILDCARD}) local to = e.to local event = e.name states_for_event[event] = states_for_event[event] or {} for _, fr in ipairs(from) do events_for_state[fr] = events_for_state[fr] or {} table.insert(events_for_state[fr], event) -- Allow no-op transition if `to` is not specified. states_for_event[event][fr] = to or fr end end if initial then add({name = initial_event, from = "none", to = initial.state}) end for _, event in ipairs(events) do add(event) end for event, states in pairs(states_for_event) do self[event] = build_transition(self, event, states) end for name, callback in pairs(callbacks) do self[name] = callback end self.current = "none" function self.is(state) if type(state) == "table" then for _, s in ipairs(state) do if self.current == s then return true end end return false end return self.current == state end function self.can(event) local states = states_for_event[event] local to = states[self.current] or states[M.WILDCARD] return to ~= nil end function self.cannot(event) return not self.can(event) end function self.transitions() return events_for_state[self.current] end function self.is_pending() return self.confirm ~= nil end function self.is_finished() return self.is(terminal) end if initial and not initial.defer then self[initial_event]() end return self end return M
local nvim_load_mapping = require("mapping.bind").nvim_load_mapping local map_cr = require("mapping.bind").map_cr local map_cu = require("mapping.bind").map_cu local map_cmd = require("mapping.bind").map_cmd require("mapping.config") local M = {} M.setup = function() -- default map local def_map = { -- Vim map ["n|<C-x>"] = map_cr("lua require('bufdelete').delete_buffer()"):with_noremap():with_silent(), ["n|<Space>x"] = map_cr("lua require('bufdelete').delete_buffer()"):with_noremap():with_silent(), ["n|<C-s>"] = map_cu("write"):with_noremap(), ["n|Y"] = map_cmd("y$"), ["n|D"] = map_cmd("d$"), ["n|;"] = map_cmd(":"):with_noremap(), ["n|<C-h>"] = map_cmd("<C-w>h"):with_noremap(), ["n|<C-l>"] = map_cmd("<C-w>l"):with_noremap(), ["n|<C-j>"] = map_cmd("<C-w>j"):with_noremap(), ["n|<C-k>"] = map_cmd("<C-w>k"):with_noremap(), ["n|<leader>vs"] = map_cmd(':vsplit <C-r>=expand("%:p:h")<cr>/'):with_noremap(), ["n|<leader>s"] = map_cmd(':split <C-r>=expand("%:p:h")<cr>/'):with_noremap(), ["n|<leader>te"] = map_cmd(':tabedit <C-r>=expand("%:p:h")<cr>/'):with_noremap(), ["n|<LocalLeader>]"] = map_cr("vertical resize -5"):with_silent(), ["n|<LocalLeader>["] = map_cr("vertical resize +5"):with_silent(), ["n|<LocalLeader>-"] = map_cr("resize -2"):with_silent(), ["n|<LocalLeader>="] = map_cr("resize +2"):with_silent(), ["n|<leader>o"] = map_cr("setlocal spell! spelllang=en_us"), ["n|<leader>I"] = map_cmd(":set list!<cr>"):with_noremap(), ["n|\\"] = map_cmd(":let @/=''<CR>:noh<CR>"):with_noremap(), ["n|<leader>p"] = map_cmd(":%s///g<CR>"):with_noremap():with_silent(), ["n|<leader>i"] = map_cmd("gg=G<CR>"):with_noremap():with_silent(), ["n|<leader>l"] = map_cmd(":set list! list?<CR>"):with_noremap(), ["n|<leader>t"] = map_cmd(":%s/\\s\\+$//e<CR>"):with_noremap(), -- Insert ["i|jj"] = map_cmd("<Esc>"):with_noremap(), ["i|<C-u>"] = map_cmd("<C-G>u<C-U>"):with_noremap(), -- command line ["c|<C-t>"] = map_cmd([[<C-R>=expand("%:p:h") . "/" <CR>]]):with_noremap(), ["c|W!!"] = map_cmd("execute 'silent! write !sudo tee % >/dev/null' <bar> edit!"), -- Visual ["v|J"] = map_cmd(":m '>+1<cr>gv=gv"), ["v|K"] = map_cmd(":m '<-2<cr>gv=gv"), ["v|<"] = map_cmd("<gv"), ["v|>"] = map_cmd(">gv"), } local plug_map = { -- reload and edit config ["n|<LocalLeader>rl"] = map_cu("lua require('core.utils').reload()"):with_noremap():with_silent(), ["n|<LocalLeader>ec"] = map_cu(":e ~/.editor.lua"):with_noremap():with_silent(), -- jupyter_ascending ["n|<LocalLeader><LocalLeader>x"] = map_cr(":call jupyter_ascending#execute()<CR>"), ["n|<LocalLeader><LocalLeader>X"] = map_cr(":call jupyter_ascending#execute_all()<CR>"), -- Bufferline ["n|<Space>l"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent(), ["n|<Space>h"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent(), ["n|<Space>bp"] = map_cr("BufferLinePick"):with_noremap():with_silent(), ["n|<Space>bc"] = map_cr("BufferLinePickClose"):with_noremap():with_silent(), ["n|<LocalLeader>be"] = map_cr("BufferLineSortByExtension"):with_noremap(), ["n|<LocalLeader>bd"] = map_cr("BufferLineSortByDirectory"):with_noremap(), ["n|1gt"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent(), ["n|2gt"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent(), ["n|3gt"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent(), ["n|4gt"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent(), ["n|5gt"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent(), ["n|6gt"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent(), ["n|7gt"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent(), ["n|8gt"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent(), ["n|9gt"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent(), -- Packer ["n|<Space>ps"] = map_cu("lua require'plugins' require('packer').sync()"):with_noremap(), ["n|<Space>pS"] = map_cu("lua require'plugins' require('packer').status()"):with_noremap(), ["n|<Space>pu"] = map_cu("lua require'plugins' require('packer').update()"):with_noremap(), ["n|<Space>pc"] = map_cu("lua require'plugins' require('packer').compile()"):with_noremap(), ["n|<Space>pC"] = map_cu("lua require'plugins' require('packer').clean()"):with_noremap(), -- Lsp mapp work when insertenter and lsp start ["n|<leader>li"] = map_cr("LspInfo"):with_noremap():with_silent():with_nowait(), ["n|<LocalLeader>lr"] = map_cr("LspRestart"):with_noremap():with_silent():with_nowait(), ["n|g["] = map_cr("Lspsaga diagnostic_jump_next"):with_noremap():with_silent(), ["n|g]"] = map_cr("Lspsaga diagnostic_jump_prev"):with_noremap():with_silent(), ["n|gs"] = map_cr("Lspsaga signature_help"):with_noremap():with_silent(), ["n|gr"] = map_cr("Lspsaga rename"):with_noremap():with_silent(), ["n|K"] = map_cr("Lspsaga hover_doc"):with_noremap():with_silent(), ["n|<C-Up>"] = map_cr("lua require('lspsaga.action').smart_scroll_with_saga(-1)"):with_noremap():with_silent(), ["n|<C-Down>"] = map_cr("lua require('lspsaga.action').smart_scroll_with_saga(1)"):with_noremap():with_silent(), ["n|<leader>ca"] = map_cr("Lspsaga code_action"):with_noremap():with_silent(), ["v|<leader>ca"] = map_cu("Lspsaga range_code_action"):with_noremap():with_silent(), ["n|gd"] = map_cr("Lspsaga preview_definition"):with_noremap():with_silent(), ["n|gD"] = map_cr("lua vim.lsp.buf.definition()"):with_noremap():with_silent(), ["n|gh"] = map_cr("lua vim.lsp.buf.references()"):with_noremap():with_silent(), ["n|<F5>"] = map_cu("lua require('core.utils').gitui()"):with_noremap():with_silent(), ["n|<F6>"] = map_cu("lua require('core.utils').create_float_term()"):with_noremap():with_silent(), ["n|<Leader>G"] = map_cu("Git"):with_noremap():with_silent(), ["n|gps"] = map_cr("G push"):with_noremap():with_silent(), ["n|gpl"] = map_cr("G pull"):with_noremap():with_silent(), -- Plugin nvim-tree ["n|<C-n>"] = map_cr("NvimTreeToggle"):with_noremap():with_silent(), ["n|<Leader>nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent(), ["n|<Leader>nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent(), -- Plugin octo ["n|<Leader>oc"] = map_cr("Octo"):with_noremap(), -- Plugin trouble ["n|gt"] = map_cr("TroubleToggle"):with_noremap():with_silent(), ["n|gR"] = map_cr("TroubleToggle lsp_references"):with_noremap():with_silent(), ["n|<LocalLeader>dd"] = map_cr("TroubleToggle document_diagnostics"):with_noremap():with_silent(), ["n|<LocalLeader>wd"] = map_cr("TroubleToggle workspace_diagnostics"):with_noremap():with_silent(), ["n|<LocalLeader>qf"] = map_cr("TroubleToggle quickfix"):with_noremap():with_silent(), ["n|<LocalLeader>ll"] = map_cr("TroubleToggle loclist"):with_noremap():with_silent(), -- Plugin Telescope ["n|<Leader>fp"] = map_cu("lua require('telescope').extensions.project.project{}"):with_noremap():with_silent(), ["n|<Leader>fr"] = map_cmd("lua require('telescope').extensions.frecency.frecency{}"):with_noremap():with_silent(), ["n|<Leader>fo"] = map_cmd("<cmd> Telescope oldfiles <CR>"):with_noremap():with_silent(), ["n|<LocalLeader>er"] = map_cr( "lua require('core.utils').exec_telescope('telescope.builtin.files', 'find_files', {cwd = vim.fn.stdpath('config')})" ):with_noremap():with_silent(), ["n|ff"] = map_cmd("<cmd> Telescope find_files <CR>"):with_noremap():with_silent(), ["n|<LocalLeader>ff"] = map_cr("lua require('core.utils').exec_telescope('telescope.builtin.files', 'find_files')") :with_noremap() :with_silent(), ["n|<Leader>ff"] = map_cr( "lua require('core.utils').exec_telescope('telescope.builtin.files', 'find_files', {cwd = vim.fn.expand('%:p:h')})" ):with_noremap():with_silent(), ["n|fw"] = map_cmd("<cmd> Telescope live_grep <CR>"):with_noremap():with_silent(), ["n|<LocalLeader>fw"] = map_cr("lua require('core.utils').exec_telescope('telescope.builtin.files', 'live_grep')") :with_noremap() :with_silent(), ["n|<Leader>fw"] = map_cr( "lua require('core.utils').exec_telescope('telescope.builtin.files', 'live_grep', {cwd = vim.fn.expand('%:p:h')})" ):with_noremap():with_silent(), ["n|<Leader>fn"] = map_cu("enew"):with_noremap():with_silent(), ["n|<Leader>fb"] = map_cmd("<cmd> Telescope file_browser <CR>"):with_noremap():with_silent(), ["n|<Leader>fg"] = map_cmd("<cmd> Telescope git_files <CR>"):with_noremap():with_silent(), ["n|<LocalLeader>km"] = map_cmd("<cmd> Telescope keymaps <CR>"):with_noremap():with_silent(), -- Plugin spectre ["n|<S-F6>"] = map_cr("lua require('spectre').open()"):with_noremap():with_silent(), ["n|<Leader>sw"] = map_cr("lua require('spectre').open_visual({select_word=true})"):with_noremap():with_silent(), ["n|<Leader>s"] = map_cr("lua require('spectre').open_visual()"):with_noremap():with_silent(), ["n|<Leader>sp"] = map_cr("lua require('spectre').open_file_search({select_word=true})") :with_noremap() :with_silent(), -- Plugin EasyAlign ["n|ga"] = map_cmd("v:lua.enhance_align('nga')"):with_expr(), ["x|ga"] = map_cmd("v:lua.enhance_align('xga')"):with_expr(), -- Plugin SymbolsOutline ["n|so"] = map_cr("SymbolsOutlineOpen"):with_noremap():with_silent(), ["n|sc"] = map_cr("SymbolsOutlineClose"):with_noremap():with_silent(), -- Plugin MarkdownPreview ["n|<F12>"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent(), -- Plugin zen-mode ["n|zm"] = map_cu('lua require("zen-mode").toggle({window = { width = .85 }})'):with_noremap():with_silent(), -- Plugins telekasten ["n|<LocalLeader>zf"] = map_cr("lua require('telekasten').find_notes()"):with_noremap():with_silent(), ["n|<LocalLeader>zd"] = map_cr("lua require('telekasten').find_daily_notes()"):with_noremap():with_silent(), ["n|<LocalLeader>zg"] = map_cr("lua require('telekasten').search_notes()"):with_noremap():with_silent(), ["n|<LocalLeader>zz"] = map_cr("lua require('telekasten').follow_link()"):with_noremap():with_silent(), ["n|<LocalLeader>zT"] = map_cr("lua require('telekasten').goto_today()"):with_noremap():with_silent(), ["n|<LocalLeader>zW"] = map_cr("lua require('telekasten').goto_thisweek()"):with_noremap():with_silent(), ["n|<LocalLeader>zw"] = map_cr("lua require('telekasten').find_weekly_notes()"):with_noremap():with_silent(), ["n|<LocalLeader>zn"] = map_cr("lua require('telekasten').new_note()"):with_noremap():with_silent(), ["n|<LocalLeader>zN"] = map_cr("lua require('telekasten').new_templated_note()"):with_noremap():with_silent(), ["n|<LocalLeader>zy"] = map_cr("lua require('telekasten').yank_notelink()"):with_noremap():with_silent(), ["n|<LocalLeader>zc"] = map_cr("lua require('telekasten').show_calendar()"):with_noremap():with_silent(), ["n|<LocalLeader>zC"] = map_cr("CalendarT"):with_noremap():with_silent(), ["n|<LocalLeader>zi"] = map_cr("lua require('telekasten').paste_img_and_link()"):with_noremap():with_silent(), ["n|<LocalLeader>zt"] = map_cr("lua require('telekasten').toggle_todo()"):with_noremap():with_silent(), ["n|<LocalLeader>zb"] = map_cr("lua require('telekasten').show_backlinks()"):with_noremap():with_silent(), ["n|<LocalLeader>zI"] = map_cr("lua require('telekasten').insert_img_link({ i=true })") :with_noremap() :with_silent(), ["n|<LocalLeader>zm"] = map_cr("lua require('telekasten').browse_media()"):with_noremap():with_silent(), ["n|<LocalLeader>za"] = map_cr("lua require('telekasten').show_tags()"):with_noremap():with_silent(), ["n|<LocalLeader>zr"] = map_cr("lua require('telekasten').rename_note()"):with_noremap():with_silent(), ["n|<LocalLeader>zp"] = map_cr("lua require('telekasten').panel()"):with_noremap():with_silent(), ["n|<LocalLeader>z#"] = map_cr("lua require('telekasten').show_tags()"):with_noremap():with_silent(), -- telekasten interactive ["i|<LocalLeader>z["] = map_cr("lua require('telekasten').insert_link({ i=true })"):with_noremap():with_silent(), ["i|<LocalLeader>z$"] = map_cr("lua require('telekasten').show_tags({i = true})"):with_noremap():with_silent(), ["i|<LocalLeader>zt"] = map_cr("lua require('telekasten').toggle_todo({ i=true })"):with_noremap():with_silent(), -- refactoring ["v|<LocalLeader>re"] = map_cr("lua require('refactoring').refactor('Extract Function')") :with_noremap() :with_silent(), ["v|<LocalLeader>rf"] = map_cr("lua require('refactoring').refactor('Extract Function To File')") :with_noremap() :with_silent(), ["v|<LocalLeader>rv"] = map_cr("lua require('refactoring').refactor('Extract Variable')") :with_noremap() :with_silent(), ["v|<LocalLeader>ri"] = map_cr("lua require('refactoring').refactor('Inline Variable')") :with_noremap() :with_silent(), ["n|<LocalLeader>rb"] = map_cr("lua require('refactoring').refactor('Extract Block')"):with_noremap():with_silent(), ["n|<LocalLeader>rbf"] = map_cr("lua require('refactoring').refactor('Extract Block To File')") :with_noremap() :with_silent(), ["n|<LocalLeader>ri"] = map_cr("lua require('refactoring').refactor('Inline Variable')") :with_noremap() :with_silent(), } nvim_load_mapping(def_map) nvim_load_mapping(plug_map) end return M
local config = require("lspconfig").jdtls.document_config require("lspconfig/configs").jdtls = nil require("lspinstall/servers").jdtls = vim.tbl_extend('error', config, { install_script = [[ rm -rf eclipse.jdt.ls git clone https://github.com/eclipse/eclipse.jdt.ls.git cd eclipse.jdt.ls ./mvnw clean verify -DskipTests ]] }) require("lspinstall/servers").eslintd = vim.tbl_extend("error", {}, { install_script = [[ ! test -f package.json && npm init -y --scope=lspinstall || true npm install eslint_d@latest ]] }) local clangd_config = require("lspinstall/util").extract_config("clangd") require("lspinstall/servers").cpp = vim.tbl_extend('error', clangd_config, { install_script = [[ os=$(uname -s | tr "[:upper:]" "[:lower:]") case $os in linux) platform="linux" ;; darwin) platform="mac" ;; esac curl -Lo clangd.zip $(curl -s "https://api.github.com/repos/clangd/clangd/releases/latest" | jq . | grep -E "https?://.*\.zip" | cut -d\" -f4 | grep "clangd-$platform") unzip clangd.zip rm clangd.zip mv clangd_* clangd ]] }) require("lspinstall/servers").emmet = vim.tbl_extend('error', {}, { install_script = [[ ! test -f package.json && npm init -y --scope=lspinstall || true npm install emmet-ls@latest ]] }) require'lspinstall'.setup()
--[[ Edit Made by PixelFir3 Passcode: iui ]] local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) gui.Name = "GUI" local rogui = Instance.new("Frame", gui) rogui.Size = UDim2.new(0, 469, 0, 148) rogui.BorderColor3 = Color3.new(1, 1, 1) rogui.Name = "RO-GUI" rogui.Position = UDim2.new(0, 560, 0, 300) rogui.BackgroundColor3 = Color3.new(1, 1, 1) local sans = Instance.new("ImageLabel", rogui) sans.Image = "rbxassetid://356480383" sans.Name = "Sans" sans.Position = UDim2.new(0, -68, 0, -81) sans.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843) sans.Rotation = -8 sans.BackgroundTransparency = 1 sans.Size = UDim2.new(0, 150, 0, 146) sans.BackgroundColor3 = Color3.new(1, 1, 1) local passwordbox = Instance.new("TextBox", rogui) passwordbox.FontSize = Enum.FontSize.Size32 passwordbox.BackgroundColor3 = Color3.new(0.705882, 0.705882, 0.705882) passwordbox.Position = UDim2.new(0, 96, 0, 36) passwordbox.Size = UDim2.new(0, 293, 0, 40) passwordbox.BorderColor3 = Color3.new(0.705882, 0.705882, 0.705882) passwordbox.Text = "Enter Passcode" passwordbox.TextColor3 = Color3.new(0.105882, 0.164706, 0.207843) passwordbox.Font = Enum.Font.SourceSansLight passwordbox.Name = "PasswordBox" local run = Instance.new("TextButton", rogui) run.FontSize = Enum.FontSize.Size32 run.BackgroundColor3 = Color3.new(0.705882, 0.705882, 0.705882) run.Size = UDim2.new(0, 231, 0, 34) run.Position = UDim2.new(0, 128, 0, 88) run.BorderColor3 = Color3.new(0.705882, 0.705882, 0.705882) run.Text = "RUN" run.TextColor3 = Color3.new(0.105882, 0.164706, 0.207843) run.Font = Enum.Font.SourceSansLight run.Name = "RUN" local name = Instance.new("TextLabel", rogui) name.BackgroundColor3 = Color3.new(1, 1, 1) name.Size = UDim2.new(0, 258, 0, 12) name.TextColor3 = Color3.new(0.105882, 0.164706, 0.207843) name.BorderColor3 = Color3.new(1, 1, 1) name.Text = "PixelFir3's Custom Sans" name.Position = UDim2.new(0, 113, 0, 8) name.Font = Enum.Font.SourceSansLight name.Name = "Name" name.FontSize = Enum.FontSize.Size28 local credits = Instance.new("TextLabel", rogui) credits.BackgroundColor3 = Color3.new(1, 1, 1) credits.Size = UDim2.new(0, 258, 0, 11) credits.TextColor3 = Color3.new(0.105882, 0.164706, 0.207843) credits.BorderColor3 = Color3.new(1, 1, 1) credits.Text = "Have fun!" credits.Position = UDim2.new(0, 113, 0, 130) credits.Font = Enum.Font.SourceSansLight credits.Name = "Credits" credits.FontSize = Enum.FontSize.Size24 local exit = Instance.new("TextButton", rogui) exit.FontSize = Enum.FontSize.Size14 exit.BackgroundColor3 = Color3.new(0.862745, 0.862745, 0.862745) exit.Size = UDim2.new(0, 37, 0, 28) exit.Position = UDim2.new(0, 424, 0, 8) exit.BorderColor3 = Color3.new(0.862745, 0.862745, 0.862745) exit.Text = "Exit" exit.TextColor3 = Color3.new(0.105882, 0.164706, 0.207843) exit.Font = Enum.Font.SourceSans exit.Name = "Exit" exit.MouseButton1Down:connect(function() rogui.Visible = false end) local version = Instance.new("TextLabel", rogui) version.BackgroundColor3 = Color3.new(1, 1, 1) version.Size = UDim2.new(0, 85, 0, 11) version.TextColor3 = Color3.new(0.105882, 0.164706, 0.207843) version.BorderColor3 = Color3.new(1, 1, 1) version.Text = "Version 3.2 " version.Position = UDim2.new(0, 7, 0, 133) version.Font = Enum.Font.SourceSansLight version.Name = "Version" version.FontSize = Enum.FontSize.Size12 local code = ("iui") function onClicked(GUI) if passwordbox.Text == code then run.Text = "Loading.." wait(3) rogui.Visible = false Folder = game.Players.LocalPlayer.PlayerGui script=Instance.new('LocalScript') local p = game.Players.LocalPlayer local char = p.Character local mouse = p:GetMouse() local larm = char["Left Arm"] local rarm = char["Right Arm"] local lleg = char["Left Leg"] local rleg = char["Right Leg"] local hed = char.Head local torso = char.Torso local hum = char.Humanoid local cam = game.Workspace.CurrentCamera local root = char.HumanoidRootPart local deb = false local shot = 0 local debris=game:service"Debris" local l = game:GetService("Lighting") local rs = game:GetService("RunService").RenderStepped ptz = {0.8, 0.85, 0.9, 0.95, 1, 1.05, 1.1} math.randomseed(os.time()) --[[ for i,v in pairs(char:children()) do if v:IsA("Hat") then v:Destroy() end end ]] for i,v in pairs (hed:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end ---------------------------------------------------- Debounces = { CanAttack = true; NoIdl = false; Slashing = false; Slashed = false; RPunch = false; RPunched = false; LPunch = false; LPunched = false; } local Touche = {char.Name, } ---------------------------------------------------- --[[ hed.face.Texture = "rbxassetid://34668268" char["Body Colors"].HeadColor = BrickColor.new("Pastel brown") char["Body Colors"].TorsoColor = BrickColor.new("Pastel brown") char["Body Colors"].LeftArmColor = BrickColor.new("Pastel brown") char["Body Colors"].RightArmColor = BrickColor.new("Pastel brown") ]] ---------------------------------------------------- --[[ypcall(function() char.Shirt:Destroy() char.Pants:Destroy() shirt = Instance.new("Shirt", char) shirt.Name = "Shirt" pants = Instance.new("Pants", char) pants.Name = "Pants" char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=392184477" char.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=392184507" end) ]] ---------------------------------------------------- function lerp(a, b, t) -- Linear interpolation return a + (b - a)*t end function slerp(a, b, t) --Spherical interpolation dot = a:Dot(b) if dot > 0.99999 or dot < -0.99999 then return t <= 0.5 and a or b else r = math.acos(dot) return (a*math.sin((1 - t)*r) + b*math.sin(t*r)) / math.sin(r) end end function matrixInterpolate(a, b, t) local ax, ay, az, a00, a01, a02, a10, a11, a12, a20, a21, a22 = a:components() local bx, by, bz, b00, b01, b02, b10, b11, b12, b20, b21, b22 = b:components() local v0 = lerp(Vector3.new(ax, ay, az), Vector3.new(bx , by , bz), t) -- Position local v1 = slerp(Vector3.new(a00, a01, a02), Vector3.new(b00, b01, b02), t) -- Vector right local v2 = slerp(Vector3.new(a10, a11, a12), Vector3.new(b10, b11, b12), t) -- Vector up local v3 = slerp(Vector3.new(a20, a21, a22), Vector3.new(b20, b21, b22), t) -- Vector back local t = v1:Dot(v2) if not (t < 0 or t == 0 or t > 0) then -- Failsafe return CFrame.new() end return CFrame.new( v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z, v3.x, v3.y, v3.z) end ---------------------------------------------------- function genWeld(a,b) local w = Instance.new("Weld",a) w.Part0 = a w.Part1 = b return w end function weld(a, b) local weld = Instance.new("Weld") weld.Name = "W" weld.Part0 = a weld.Part1 = b weld.C0 = a.CFrame:inverse() * b.CFrame weld.Parent = a return weld; end ---------------------------------------------------- function Lerp(c1,c2,al) local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()} local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()} for i,v in pairs(com1) do com1[i] = v+(com2[i]-v)*al end return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) end ---------------------------------------------------- newWeld = function(wp0, wp1, wc0x, wc0y, wc0z) local wld = Instance.new("Weld", wp1) wld.Part0 = wp0 wld.Part1 = wp1 wld.C0 = CFrame.new(wc0x, wc0y, wc0z) end ---------------------------------------------------- function weld5(part0, part1, c0, c1) weeld=Instance.new("Weld", part0) weeld.Part0=part0 weeld.Part1=part1 weeld.C0=c0 weeld.C1=c1 return weeld end ---------------------------------------------------- function HasntTouched(plrname) local ret = true for _, v in pairs(Touche) do if v == plrname then ret = false end end return ret end ---------------------------------------------------- newWeld(torso, larm, -1.5, 0.5, 0) larm.Weld.C1 = CFrame.new(0, 0.5, 0) newWeld(torso, rarm, 1.5, 0.5, 0) rarm.Weld.C1 = CFrame.new(0, 0.5, 0) newWeld(torso, hed, 0, 1.5, 0) newWeld(torso, lleg, -0.5, -1, 0) lleg.Weld.C1 = CFrame.new(0, 1, 0) newWeld(torso, rleg, 0.5, -1, 0) rleg.Weld.C1 = CFrame.new(0, 1, 0) newWeld(root, torso, 0, -1, 0) torso.Weld.C1 = CFrame.new(0, -1, 0) ---------------------------------------------------- z = Instance.new("Sound", char) z.SoundId = "rbxassetid://0000" --303570180 --306372823 z.Looped = true z.Pitch = 1 z.Volume = 1 wait(.1) z:Play() ---------------------------------------------------- local Transforming = true hum.WalkSpeed = 0 local fx = Instance.new("Part",torso) fx.Anchored = true fx.Material = "Neon" fx.CanCollide = false fx.Locked = true fx.Transparency = 1 fx.Material = "SmoothPlastic" fx.Size = Vector3.new(1,1,1) fx.TopSurface = "SmoothNoOutlines" fx.BottomSurface = "SmoothNoOutlines" fx.BrickColor = BrickColor.new("Toothpaste") fxm = Instance.new("SpecialMesh",fx) fxm.MeshType = "Sphere" fxm.Scale = Vector3.new(1,1,1) for i = 1, 20 do rs:wait() fx.Transparency = fx.Transparency - (1/20) fx.CFrame = torso.CFrame fxm.Scale = fxm.Scale + Vector3.new(0.5,0.5,0.5) rs:wait() end ---------------------------------------------------- --[[local m = Instance.new("Model") m.Name = "Hair" p1 = Instance.new("Part", m) p1.BrickColor = BrickColor.new("Really black") p1.FormFactor = Enum.FormFactor.Symmetric p1.Size = Vector3.new(1, 1, 1) p1.CFrame = CFrame.new(-2.49043155, 8.24595642, -3.40113306, -5.48362732e-006, -0.978699088, 0.205299795, 3.27825546e-007, -0.205299854, -0.978699148, 1, -5.28991222e-006, 1.48639083e-006) p1.CanCollide = false p1.Locked = true p1.BottomSurface = Enum.SurfaceType.Smooth p1.TopSurface = Enum.SurfaceType.Smooth b1 = Instance.new("SpecialMesh", p1) b1.MeshId = "http://www.roblox.com/asset/?id=12212520" b1.TextureId = "" b1.MeshType = Enum.MeshType.FileMesh b1.Name = "Mesh" b1.VertexColor = Vector3.new(0, 0, 0) b1.Scale = Vector3.new(1, 1.60000002, 1.29999995) p2 = Instance.new("Part", m) p2.BrickColor = BrickColor.new("Pastel brown") p2.Transparency = 1 p2.Name = "Head" p2.FormFactor = Enum.FormFactor.Symmetric p2.Size = Vector3.new(2, 1, 1) p2.CFrame = CFrame.new(-1.70008016, 8.14794922, -3.40013027, 4.24603923e-006, 7.4505806e-008, -1, -1.50268988e-007, 1, 1.49011612e-008, 1.00000012, 6.79109462e-008, 4.23316806e-006) p2.CanCollide = false p2.Locked = true p2.TopSurface = Enum.SurfaceType.Smooth b2 = Instance.new("SpecialMesh", p2) b2.MeshType = Enum.MeshType.Head b2.Name = "Mesh" b2.Scale = Vector3.new(1.25, 1.25, 1.25) p3 = Instance.new("Part", m) p3.BrickColor = BrickColor.new("Really black") p3.FormFactor = Enum.FormFactor.Symmetric p3.Size = Vector3.new(2, 2, 2) p3.CFrame = CFrame.new(-1.70003617, 8.71796131, -3.4000442, 2.57710985e-006, 6.95607483e-008, -1.00000012, -1.20466638e-007, 1, 9.95640903e-009, 1.00000024, 3.81086345e-008, 2.56423846e-006) p3.CanCollide = false p3.Locked = true p3.BottomSurface = Enum.SurfaceType.Smooth p3.TopSurface = Enum.SurfaceType.Smooth b3 = Instance.new("SpecialMesh", p3) b3.MeshId = "http://www.roblox.com/asset/?id=16627529" b3.TextureId = "" b3.MeshType = Enum.MeshType.FileMesh b3.Name = "Mesh" b3.VertexColor = Vector3.new(0, 0, 0) b3.Scale = Vector3.new(1.04999995, 1.04999995, 1.04999995) p4 = Instance.new("Part", m) p4.BrickColor = BrickColor.new("Really black") p4.FormFactor = Enum.FormFactor.Symmetric p4.Size = Vector3.new(1, 1, 1) p4.CFrame = CFrame.new(-1.77981007, 8.84795475, -3.40016508, 5.79576135e-006, 7.9450956e-008, -1.00000012, -1.80071311e-007, 1, 1.98458743e-008, 1.00000024, 9.77132402e-008, 5.78289018e-006) p4.CanCollide = false p4.Locked = true p4.BottomSurface = Enum.SurfaceType.Smooth p4.TopSurface = Enum.SurfaceType.Smooth b4 = Instance.new("SpecialMesh", p4) b4.MeshId = "http://www.roblox.com/asset/?id=19326912" b4.TextureId = "" b4.MeshType = Enum.MeshType.FileMesh b4.Name = "Mesh" b4.VertexColor = Vector3.new(0, 0, 0) p5 = Instance.new("Part", m) p5.BrickColor = BrickColor.new("Really black") p5.FormFactor = Enum.FormFactor.Symmetric p5.Size = Vector3.new(1, 1, 1) p5.CFrame = CFrame.new(-1.70003772, 8.46796131, -3.40004301, -3.43517968e-007, 2.98088111e-007, -1, -1.00421907e-007, 1, 2.38484063e-007, 1.00000012, 1.80640072e-008, -3.56389592e-007) p5.CanCollide = false p5.Locked = true p5.BottomSurface = Enum.SurfaceType.Smooth p5.TopSurface = Enum.SurfaceType.Smooth b5 = Instance.new("SpecialMesh", p5) b5.MeshId = "http://www.roblox.com/asset/?id=45916884" b5.TextureId = "" b5.MeshType = Enum.MeshType.FileMesh b5.Name = "Mesh" b5.VertexColor = Vector3.new(0, 0, 0) b5.Scale = Vector3.new(1, 0.899999976, 1) p6 = Instance.new("Part", m) p6.BrickColor = BrickColor.new("Really black") p6.FormFactor = Enum.FormFactor.Symmetric p6.Size = Vector3.new(1, 1, 1) p6.CFrame = CFrame.new(-1.89967656, 8.58795834, -3.44990659, -5.81936433e-007, 5.36502284e-007, -0.99999994, -1.3998249e-007, 1, 4.76898265e-007, 1, 5.76247672e-008, -5.94808171e-007) p6.CanCollide = false p6.Locked = true p6.BottomSurface = Enum.SurfaceType.Smooth p6.TopSurface = Enum.SurfaceType.Smooth b6 = Instance.new("SpecialMesh", p6) b6.MeshId = "http://www.roblox.com/asset/?id=62246019" b6.TextureId = "" b6.MeshType = Enum.MeshType.FileMesh b6.Name = "Mesh" b6.VertexColor = Vector3.new(0, 0, 0) p7 = Instance.new("Part", m) p7.BrickColor = BrickColor.new("Really black") p7.FormFactor = Enum.FormFactor.Symmetric p7.Size = Vector3.new(1, 1, 1) p7.CFrame = CFrame.new(-1.89918542, 8.31796837, -3.50097537, -4.62727087e-007, 5.36502228e-007, -0.999999881, -1.39982518e-007, 1, 4.76898208e-007, 0.99999994, 5.76247459e-008, -4.75598938e-007) p7.CanCollide = false p7.Locked = true p7.BottomSurface = Enum.SurfaceType.Smooth p7.TopSurface = Enum.SurfaceType.Smooth b7 = Instance.new("SpecialMesh", p7) b7.MeshId = "http://www.roblox.com/asset/?id=76056263" b7.TextureId = "" b7.MeshType = Enum.MeshType.FileMesh b7.Name = "Mesh" b7.VertexColor = Vector3.new(0, 0, 0) p8 = Instance.new("Part", m) p8.BrickColor = BrickColor.new("Really black") p8.FormFactor = Enum.FormFactor.Symmetric p8.Size = Vector3.new(1, 1, 1) p8.CFrame = CFrame.new(-2.62433338, 7.66397905, -3.4010179, -1.17798254e-006, -0.805111349, 0.593123376, -2.5008859e-007, -0.593123615, -0.805111527, 0.999999881, -9.58229293e-007, 4.4941558e-007) p8.CanCollide = false p8.Locked = true p8.BottomSurface = Enum.SurfaceType.Smooth p8.TopSurface = Enum.SurfaceType.Smooth b8 = Instance.new("SpecialMesh", p8) b8.MeshId = "http://www.roblox.com/asset/?id=12212520" b8.TextureId = "" b8.MeshType = Enum.MeshType.FileMesh b8.Name = "Mesh" b8.VertexColor = Vector3.new(0, 0, 0) b8.Scale = Vector3.new(1, 1.60000002, 1.29999995) p9 = Instance.new("Part", m) p9.BrickColor = BrickColor.new("Really black") p9.FormFactor = Enum.FormFactor.Symmetric p9.Size = Vector3.new(2, 1, 2) p9.CFrame = CFrame.new(-1.76505995, 8.56096649, -3.40065479, -9.73168881e-007, -0.0995008349, -0.995037436, -1.70322267e-007, 0.995037675, -0.0995009243, 1, 1.13823972e-007, -6.80968242e-007) p9.CanCollide = false p9.Locked = true p9.BottomSurface = Enum.SurfaceType.Smooth p9.TopSurface = Enum.SurfaceType.Smooth b9 = Instance.new("SpecialMesh", p9) b9.MeshId = "http://www.roblox.com/asset/?id=12259089" b9.TextureId = "" b9.MeshType = Enum.MeshType.FileMesh b9.Name = "Mesh" b9.VertexColor = Vector3.new(0, 0, 0) b9.Scale = Vector3.new(1.01999998, 1.04999995, 1.04999995) p10 = Instance.new("Part", m) p10.BrickColor = BrickColor.new("Really black") p10.FormFactor = Enum.FormFactor.Symmetric p10.Size = Vector3.new(1, 1, 1) p10.CFrame = CFrame.new(-2.0207715, 9.06097031, -3.39961624, -1.10652763e-006, -0.683569431, -0.729885519, -2.85231891e-007, 0.729885638, -0.68356967, 1.00000012, -3.22293062e-007, -8.40051371e-007) p10.CanCollide = false p10.Locked = true p10.BottomSurface = Enum.SurfaceType.Smooth p10.TopSurface = Enum.SurfaceType.Smooth b10 = Instance.new("SpecialMesh", p10) b10.MeshId = "http://www.roblox.com/asset/?id=12212520" b10.TextureId = "" b10.MeshType = Enum.MeshType.FileMesh b10.Name = "Mesh" b10.VertexColor = Vector3.new(0, 0, 0) b10.Scale = Vector3.new(1, 1.60000002, 1.29999995) p11 = Instance.new("Part", m) p11.BrickColor = BrickColor.new("Really black") p11.FormFactor = Enum.FormFactor.Symmetric p11.Size = Vector3.new(1, 1, 1) p11.CFrame = CFrame.new(-2.16468835, 8.78595829, -3.40089417, -1.41617738e-006, -0.989475727, -0.144699216, -4.36450762e-007, 0.144699067, -0.989476085, 1.00000024, -9.47996682e-007, -7.38401468e-007) p11.CanCollide = false p11.Locked = true p11.BottomSurface = Enum.SurfaceType.Smooth p11.TopSurface = Enum.SurfaceType.Smooth b11 = Instance.new("SpecialMesh", p11) b11.MeshId = "http://www.roblox.com/asset/?id=12212520" b11.TextureId = "" b11.MeshType = Enum.MeshType.FileMesh b11.Name = "Mesh" b11.VertexColor = Vector3.new(0, 0, 0) b11.Scale = Vector3.new(1, 1.60000002, 1.29999995) p12 = Instance.new("Part", m) p12.BrickColor = BrickColor.new("Really black") p12.FormFactor = Enum.FormFactor.Custom p12.Size = Vector3.new(1, 3.5, 1) p12.CFrame = CFrame.new(-3.74216318, 6.74288082, -3.40101933, -1.20476273e-006, -0.553697288, 0.832718134, -3.31002866e-007, -0.832718611, -0.553697169, 1.00000036, -8.7345768e-007, 3.69213154e-007) p12.CanCollide = false p12.Locked = true p12.BottomSurface = Enum.SurfaceType.Smooth p12.TopSurface = Enum.SurfaceType.Smooth b12 = Instance.new("SpecialMesh", p12) b12.MeshId = "http://www.roblox.com/asset/?id=12212520" b12.TextureId = "" b12.MeshType = Enum.MeshType.FileMesh b12.Name = "Mesh" b12.VertexColor = Vector3.new(0, 0, 0) b12.Scale = Vector3.new(1, 3, 1.29999995) p13 = Instance.new("Part", m) p13.BrickColor = BrickColor.new("Really black") p13.FormFactor = Enum.FormFactor.Custom p13.Size = Vector3.new(1, 2, 1) p13.CFrame = CFrame.new(-3.32689047, 6.86741829, -3.40101862, -9.81709945e-007, -0.319307148, 0.947651446, -5.6545997e-007, -0.947651923, -0.31930691, 1.00000048, -8.39551717e-007, 1.79318391e-007) p13.CanCollide = false p13.Locked = true p13.BottomSurface = Enum.SurfaceType.Smooth p13.TopSurface = Enum.SurfaceType.Smooth b13 = Instance.new("SpecialMesh", p13) b13.MeshId = "http://www.roblox.com/asset/?id=12212520" b13.TextureId = "" b13.MeshType = Enum.MeshType.FileMesh b13.Name = "Mesh" b13.VertexColor = Vector3.new(0, 0, 0) b13.Scale = Vector3.new(1, 3, 1.29999995) p14 = Instance.new("Part", m) p14.BrickColor = BrickColor.new("Really black") p14.FormFactor = Enum.FormFactor.Custom p14.Size = Vector3.new(1, 2, 1) p14.CFrame = CFrame.new(-3.02689028, 7.96740961, -3.40101862, -1.33478545e-006, -0.750354111, 0.661036491, -5.20037702e-008, -0.661037207, -0.750354171, 1.0000006, -6.31296757e-007, 2.01137496e-007) p14.CanCollide = false p14.Locked = true p14.BottomSurface = Enum.SurfaceType.Smooth p14.TopSurface = Enum.SurfaceType.Smooth b14 = Instance.new("SpecialMesh", p14) b14.MeshId = "http://www.roblox.com/asset/?id=12212520" b14.TextureId = "" b14.MeshType = Enum.MeshType.FileMesh b14.Name = "Mesh" b14.VertexColor = Vector3.new(0, 0, 0) b14.Scale = Vector3.new(1, 3, 1.29999995) p15 = Instance.new("Part", m) p15.BrickColor = BrickColor.new("Really black") p15.FormFactor = Enum.FormFactor.Custom p15.Size = Vector3.new(1, 2.5, 1) p15.CFrame = CFrame.new(-2.96531463, 7.75924349, -2.90101862, 0.342019022, -0.520305753, 0.782499552, -1.1920929e-007, -0.832718909, -0.553697407, 0.939693451, 0.189374983, -0.284806281) p15.CanCollide = false p15.Locked = true p15.BottomSurface = Enum.SurfaceType.Smooth p15.TopSurface = Enum.SurfaceType.Smooth b15 = Instance.new("SpecialMesh", p15) b15.MeshId = "http://www.roblox.com/asset/?id=12212520" b15.TextureId = "" b15.MeshType = Enum.MeshType.FileMesh b15.Name = "Mesh" b15.VertexColor = Vector3.new(0, 0, 0) b15.Scale = Vector3.new(1, 3, 1.29999995) p16 = Instance.new("Part", m) p16.BrickColor = BrickColor.new("Really black") p16.FormFactor = Enum.FormFactor.Custom p16.Size = Vector3.new(1, 2.5, 1) p16.CFrame = CFrame.new(-2.96531439, 7.75924349, -3.80101967, -0.258820295, -0.534830391, 0.804343879, -1.78813934e-007, -0.832718968, -0.553697228, 0.96592629, -0.143308073, 0.215523779) p16.CanCollide = false p16.Locked = true p16.BottomSurface = Enum.SurfaceType.Smooth p16.TopSurface = Enum.SurfaceType.Smooth b16 = Instance.new("SpecialMesh", p16) b16.MeshId = "http://www.roblox.com/asset/?id=12212520" b16.TextureId = "" b16.MeshType = Enum.MeshType.FileMesh b16.Name = "Mesh" b16.VertexColor = Vector3.new(0, 0, 0) b16.Scale = Vector3.new(1, 3, 1.29999995) p17 = Instance.new("Part", m) p17.BrickColor = BrickColor.new("Really black") p17.FormFactor = Enum.FormFactor.Custom p17.Size = Vector3.new(1, 2.4000001, 1) p17.CFrame = CFrame.new(-2.69075108, 7.07788849, -3.40101933, -1.13248825e-006, -0.319307148, 0.947651625, -1.1920929e-006, -0.947652161, -0.319306791, 1.0000006, -1.54972076e-006, 1.04308128e-007) p17.CanCollide = false p17.Locked = true p17.BottomSurface = Enum.SurfaceType.Smooth p17.TopSurface = Enum.SurfaceType.Smooth b17 = Instance.new("SpecialMesh", p17) b17.MeshId = "http://www.roblox.com/asset/?id=12212520" b17.TextureId = "" b17.MeshType = Enum.MeshType.FileMesh b17.Name = "Mesh" b17.VertexColor = Vector3.new(0, 0, 0) b17.Scale = Vector3.new(1, 3, 1.29999995) p18 = Instance.new("Part", m) p18.BrickColor = BrickColor.new("Really black") p18.FormFactor = Enum.FormFactor.Custom p18.Size = Vector3.new(2, 2, 2) p18.CFrame = CFrame.new(-1.70003319, 8.71796608, -3.40004444, -2.37434961e-006, 1.78813934e-007, 1.00000036, -2.35242567e-007, 1.00000072, 3.27825546e-007, -1.0000006, 7.95440158e-009, -2.91315405e-006) p18.CanCollide = false p18.Locked = true p18.BottomSurface = Enum.SurfaceType.Smooth p18.TopSurface = Enum.SurfaceType.Smooth b18 = Instance.new("SpecialMesh", p18) b18.MeshId = "http://www.roblox.com/asset/?id=16627529" b18.TextureId = "" b18.MeshType = Enum.MeshType.FileMesh b18.Name = "Mesh" b18.VertexColor = Vector3.new(0, 0, 0) b18.Scale = Vector3.new(1.04999995, 1.04999995, 1.04999995) w1 = Instance.new("Weld", p1) w1.Name = "Head_Weld" w1.Part0 = p1 w1.C0 = CFrame.new(3.40111661, -0.744508088, 8.58160019, -5.48362732e-006, 3.27825546e-007, 1, -0.978699088, -0.205299854, -5.30481339e-006, 0.205299824, -0.978699148, 1.49011612e-006) w1.Part1 = p2 w1.C1 = CFrame.new(3.40013766, -8.14794827, -1.70006609, 4.23192978e-006, -1.08796726e-007, 1.00000012, 2.9664772e-008, 1, 1.08796598e-007, -1.00000012, 2.96642924e-008, 4.23192978e-006) w2 = Instance.new("Weld", p2) w2.Name = "Part_Weld" w2.Part0 = p2 w2.C0 = CFrame.new(3.40013766, -8.14794827, -1.70006609, 4.23192978e-006, -1.08796726e-007, 1.00000012, 2.9664772e-008, 1, 1.08796598e-007, -1.00000012, 2.96642924e-008, 4.23192978e-006) w2.Part1 = p3 w2.C1 = CFrame.new(3.40004802, -8.71796036, -1.70002759, 2.56299973e-006, -7.89943471e-008, 1, 2.47196947e-008, 1, 7.89942831e-008, -1, 2.47194887e-008, 2.56299973e-006) w3 = Instance.new("Weld", p3) w3.Name = "Part_Weld" w3.Part0 = p3 w3.C0 = CFrame.new(3.40004802, -8.71796036, -1.70002759, 2.56299973e-006, -7.89943471e-008, 1, 2.47196947e-008, 1, 7.89942831e-008, -1, 2.47194887e-008, 2.56299973e-006) w3.Part1 = p4 w3.C1 = CFrame.new(3.40017533, -8.8479538, -1.77979064, 5.78165054e-006, -1.38599077e-007, 1, 3.46098972e-008, 1, 1.38598878e-007, -1, 3.46090907e-008, 5.78165054e-006) w4 = Instance.new("Weld", p4) w4.Name = "Part_Weld" w4.Part0 = p4 w4.C0 = CFrame.new(3.40017533, -8.8479538, -1.77979064, 5.78165054e-006, -1.38599077e-007, 1, 3.46098972e-008, 1, 1.38598878e-007, -1, 3.46090907e-008, 5.78165054e-006) w4.Part1 = p5 w4.C1 = CFrame.new(3.40004182, -8.46796036, -1.70004117, -3.57627869e-007, -5.89495883e-008, 0.99999994, 2.53247009e-007, 1, 5.89496665e-008, -0.99999994, 2.53247009e-007, -3.57627869e-007) w5 = Instance.new("Weld", p5) w5.Name = "Part_Weld" w5.Part0 = p5 w5.C0 = CFrame.new(3.40004182, -8.46796036, -1.70004117, -3.57627869e-007, -5.89495883e-008, 0.99999994, 2.53247009e-007, 1, 5.89496665e-008, -0.99999994, 2.53247009e-007, -3.57627869e-007) w5.Part1 = p6 w5.C1 = CFrame.new(3.44990563, -8.58795738, -1.89968324, -5.96046448e-007, -9.85101565e-008, 1, 4.91661183e-007, 1, 9.85104407e-008, -1, 4.9166124e-007, -5.96046448e-007) w6 = Instance.new("Weld", p6) w6.Name = "Part_Weld" w6.Part0 = p6 w6.C0 = CFrame.new(3.44990563, -8.58795738, -1.89968324, -5.96046448e-007, -9.85101565e-008, 1, 4.91661183e-007, 1, 9.85104407e-008, -1, 4.9166124e-007, -5.96046448e-007) w6.Part1 = p7 w6.C1 = CFrame.new(3.50097466, -8.31796741, -1.89919162, -4.76837158e-007, -9.85101849e-008, 0.99999994, 4.91661126e-007, 1, 9.85104265e-008, -0.99999994, 4.91661183e-007, -4.76837158e-007) w7 = Instance.new("Weld", p7) w7.Name = "Part_Weld" w7.Part0 = p7 w7.C0 = CFrame.new(3.50097466, -8.31796741, -1.89919162, -4.76837158e-007, -9.85101849e-008, 0.99999994, 4.91661126e-007, 1, 9.85104265e-008, -0.99999994, 4.91661183e-007, -4.76837158e-007) w7.Part1 = p8 w7.C1 = CFrame.new(3.40101647, 2.43280101, 7.72691393, -1.1920929e-006, -2.08616257e-007, 1, -0.805111527, -0.593123555, -9.83476639e-007, 0.593123496, -0.805111527, 4.17232513e-007) w8 = Instance.new("Weld", p8) w8.Name = "Part_Weld" w8.Part0 = p8 w8.C0 = CFrame.new(3.40101647, 2.43280101, 7.72691393, -1.1920929e-006, -2.08616257e-007, 1, -0.805111527, -0.593123555, -9.83476639e-007, 0.593123496, -0.805111527, 4.17232513e-007) w8.Part1 = p9 w8.C1 = CFrame.new(3.40065455, -8.6941061, -0.904481649, -8.34465027e-007, -1.67638063e-007, 1.00000012, -0.0995008498, 0.995037496, 1.00582838e-007, -0.995037615, -0.0995008498, -8.34465027e-007) w9 = Instance.new("Weld", p9) w9.Name = "Part_Weld" w9.Part0 = p9 w9.C0 = CFrame.new(3.40065455, -8.6941061, -0.904481649, -8.34465027e-007, -1.67638063e-007, 1.00000012, -0.0995008498, 0.995037496, 1.00582838e-007, -0.995037615, -0.0995008498, -8.34465027e-007) w9.Part1 = p10 w9.C1 = CFrame.new(3.39961672, -7.99480963, 4.71886492, -9.53674316e-007, -2.98023224e-007, 1, -0.683569372, 0.729885519, -4.47034836e-007, -0.729885459, -0.683569431, -9.53674316e-007) w10 = Instance.new("Weld", p10) w10.Name = "Part_Weld" w10.Part0 = p10 w10.C0 = CFrame.new(3.39961672, -7.99480963, 4.71886492, -9.53674316e-007, -2.98023224e-007, 1, -0.683569372, 0.729885519, -4.47034836e-007, -0.729885459, -0.683569431, -9.53674316e-007) w10.Part1 = p11 w10.C1 = CFrame.new(3.40089583, -3.41323304, 8.38025856, -1.31130219e-006, -4.76837158e-007, 1.00000012, -0.989475787, 0.144699097, -1.07288361e-006, -0.144699246, -0.989475787, -7.15255737e-007) w11 = Instance.new("Weld", p11) w11.Name = "Part_Weld" w11.Part0 = p11 w11.C0 = CFrame.new(3.40089583, -3.41323304, 8.38025856, -1.31130219e-006, -4.76837158e-007, 1.00000012, -0.989475787, 0.144699097, -1.07288361e-006, -0.144699246, -0.989475787, -7.15255737e-007) w11.Part1 = p12 w11.C1 = CFrame.new(3.40101814, 3.54288888, 6.84968376, -9.53674316e-007, -4.47034836e-007, 1, -0.553697109, -0.832718134, -9.23871994e-007, 0.832718134, -0.553697109, 6.55651093e-007) w12 = Instance.new("Weld", p12) w12.Name = "Part_Weld" w12.Part0 = p12 w12.C0 = CFrame.new(3.40101814, 3.54288888, 6.84968376, -9.53674316e-007, -4.47034836e-007, 1, -0.553697109, -0.832718134, -9.23871994e-007, 0.832718134, -0.553697109, 6.55651093e-007) w12.Part1 = p13 w12.C1 = CFrame.new(3.40102005, 5.44561195, 5.34554911, -8.34465027e-007, -6.40749931e-007, 1.00000012, -0.319307029, -0.947651505, -8.19563866e-007, 0.947651386, -0.319307029, 3.57627869e-007) w13 = Instance.new("Weld", p13) w13.Name = "Part_Weld" w13.Part0 = p13 w13.C0 = CFrame.new(3.40102005, 5.44561195, 5.34554911, -8.34465027e-007, -6.40749931e-007, 1.00000012, -0.319307029, -0.947651505, -8.19563866e-007, 0.947651386, -0.319307029, 3.57627869e-007) w13.Part1 = p14 w13.C1 = CFrame.new(3.40101624, 2.99550176, 7.97925997, -9.53674316e-007, -1.49011612e-007, 1, -0.750353813, -0.661036491, -8.64267349e-007, 0.661036491, -0.750353813, 5.36441803e-007) w14 = Instance.new("Weld", p14) w14.Name = "Part_Weld" w14.Part0 = p14 w14.C0 = CFrame.new(3.40101624, 2.99550176, 7.97925997, -9.53674316e-007, -1.49011612e-007, 1, -0.750353813, -0.661036491, -8.64267349e-007, 0.661036491, -0.750353813, 5.36441803e-007) w14.Part1 = p15 w14.C1 = CFrame.new(3.74026394, 5.46776819, 5.79039907, 0.34201923, -3.27825546e-007, 0.939692974, -0.520305395, -0.832718134, 0.189374775, 0.782499313, -0.553697109, -0.284805775) w15 = Instance.new("Weld", p15) w15.Name = "Part_Weld" w15.Part0 = p15 w15.C0 = CFrame.new(3.74026394, 5.46776819, 5.79039907, 0.34201923, -3.27825546e-007, 0.939692974, -0.520305395, -0.832718134, 0.189374775, 0.782499313, -0.553697109, -0.284805775) w15.Part1 = p16 w15.C1 = CFrame.new(2.90401983, 4.33060169, 7.50061178, -0.258819938, -2.68220901e-007, 0.965925574, -0.534830093, -0.832718134, -0.143308043, 0.80434382, -0.55369705, 0.215523928) w16 = Instance.new("Weld", p16) w16.Name = "Part_Weld" w16.Part0 = p16 w16.C0 = CFrame.new(2.90401983, 4.33060169, 7.50061178, -0.258819938, -2.68220901e-007, 0.965925574, -0.534830093, -0.832718134, -0.143308043, 0.80434382, -0.55369705, 0.215523928) w16.Part1 = p17 w16.C1 = CFrame.new(3.4010253, 5.84818506, 4.80991411, -8.56413749e-007, -1.3483392e-006, 1, -0.31930685, -0.947651386, -1.55121427e-006, 0.947651386, -0.31930685, 3.81047698e-007) w17 = Instance.new("Weld", p17) w17.Name = "Part_Weld" w17.Part0 = p17 w17.C0 = CFrame.new(3.4010253, 5.84818506, 4.80991411, -8.56413749e-007, -1.3483392e-006, 1, -0.31930685, -0.947651386, -1.55121427e-006, 0.947651386, -0.31930685, 3.81047698e-007) w17.Part1 = p18 w17.C1 = CFrame.new(-3.40004683, -8.71796036, 1.70002675, -2.6504224e-006, -7.89943471e-008, -1, -2.47197018e-008, 1, -7.89942831e-008, 1, 2.47194887e-008, -2.6504224e-006) m.Parent = char m:MakeJoints() ---------------------------------------------------- local cor = Instance.new("Part", char.Hair) cor.Name = "Link" cor.Locked = true cor.BottomSurface = 0 cor.CanCollide = false cor.Size = Vector3.new(1, 9, 1) cor.Transparency = 1 cor.TopSurface = 0 corw = Instance.new("Weld", cor) corw.Part0 = hed corw.Part1 = cor corw.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) corw.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) weld1 = Instance.new("Weld", char.Hair) weld1.Part0 = cor weld1.Part1 = char.Hair.Head weld1.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) ]] ---------------------------------------------------- GroundWave1 = function() local HandCF = CFrame.new(root.Position - Vector3.new(0,3,0)) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) local Colors = {"Toothpaste", "Really black"} local wave = Instance.new("Part", torso) wave.BrickColor = BrickColor.new(Colors[math.random(1,#Colors)]) wave.Anchored = true wave.CanCollide = false wave.Locked = true wave.Size = Vector3.new(1, 1, 1) wave.TopSurface = "Smooth" wave.BottomSurface = "Smooth" wave.Transparency = 0.35 wave.CFrame = HandCF wm = Instance.new("SpecialMesh", wave) wm.MeshId = "rbxassetid://3270017" coroutine.wrap(function() for i = 1, 30, 1 do wm.Scale = Vector3.new(1 + i*1.2, 1 + i*1.2, 1) wave.Size = wm.Scale wave.CFrame = HandCF wave.Transparency = i/30 wait() end wait() wave:Destroy() end)() end ---------------------------------------------------- GroundWave = function() if Transforming == true then local wave = Instance.new("Part", torso) wave.BrickColor = BrickColor.new("Really black") wave.Anchored = true wave.CanCollide = false wave.Locked = true wave.Size = Vector3.new(1, 1, 1) wave.TopSurface = "Smooth" wave.BottomSurface = "Smooth" wave.Transparency = 0.35 wave.CFrame = fx.CFrame wm = Instance.new("SpecialMesh", wave) wm.MeshType = "Sphere" wm.Scale = Vector3.new(1,1,1) coroutine.wrap(function() for i = 1, 18, 1 do wm.Scale = Vector3.new(2 + i*2, 2 + i*2, 2 + i*2) --wave.Size = wm.Scale wave.CFrame = fx.CFrame wave.Transparency = i/14 wait() end wait() wave:Destroy() end)() elseif Transforming == false then wait() end end for i = 1, 100 do rs:wait() fx.CFrame = torso.CFrame end Spawn(function() while wait(1) do GroundWave() end end) wait(4) Transforming = false for i = 1, 20 do rs:wait() fx.Transparency = fx.Transparency + (1/20) fx.CFrame = torso.CFrame fxm.Scale = fxm.Scale + Vector3.new(0.5,0.5,0.5) rs:wait() end local HandCF = CFrame.new(root.Position - Vector3.new(0,3,0)) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) local wave = Instance.new("Part", torso) wave.BrickColor = BrickColor.new("Institutional white") wave.Anchored = true wave.CanCollide = false wave.Locked = true wave.Size = Vector3.new(1, 1, 1) wave.TopSurface = "Smooth" wave.BottomSurface = "Smooth" wave.Transparency = 0.35 wave.CFrame = HandCF wm = Instance.new("SpecialMesh", wave) wm.MeshId = "rbxassetid://3270017" coroutine.wrap(function() for i = 1, 14, 1 do wm.Scale = Vector3.new(1 + i*1.1, 1 + i*1.1, 1) wave.Size = wm.Scale wave.CFrame = HandCF wave.Transparency = i/14 wait() end wait() wave:Destroy() end)() hum.WalkSpeed = 16 ---------------------------------------------------- Blast = function() local Colors = {"Really red", "Really black"} local wave = Instance.new("Part", torso) wave.BrickColor = BrickColor.new(Colors[math.random(1,#Colors)]) wave.Anchored = true wave.CanCollide = false wave.Locked = true wave.Size = Vector3.new(1, 1, 1) wave.TopSurface = "Smooth" wave.BottomSurface = "Smooth" wave.Transparency = 0.35 wave.CFrame = rarm.CFrame wm = Instance.new("SpecialMesh", wave) wm.MeshType = "Sphere" wm.Scale = Vector3.new(1,1,1) z = Instance.new("Sound",wave) z.SoundId = "rbxassetid://237035051" z.Volume = 1 z.Pitch = .9 z:Play() coroutine.wrap(function() for i = 1, 30, 1 do wave.Size = Vector3.new(1 + i*4, 1 + i*4, 1 + i*4) --wave.Size = wm.Scale wave.CFrame = rarm.CFrame wave.Transparency = (1/14) rs:wait() end rs:wait() wave:Destroy() z:Destroy() end)() end ---------------------------------------------------- rarm.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then if Debounces.RPunch == true and Debounces.RPunched == false then Debounces.RPunched = true hit:FindFirstChild("Humanoid"):TakeDamage(math.random(5,8)) if Debounces.ks==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.RPunched = false end end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then if Debounces.RPunch == true and Debounces.RPunched == false then Debounces.RPunched = true hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(5,8)) if Debounces.ks==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.RPunched = false end end end end end) larm.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then if Debounces.LPunch == true and Debounces.LPunched == false then Debounces.LPunched = true hit:FindFirstChild("Humanoid"):TakeDamage(math.random(4,8)) if Debounces.ks2==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.LPunched = false end end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then if Debounces.LPunch == true and Debounces.LPunched == false then Debounces.LPunched = true hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(4,8)) if Debounces.ks2==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.LPunched = false end end end end end) ---------------------------------------------------- mod4 = Instance.new("Model",char) ptez = {0.7, 0.8, 0.9, 1} function FindNearestTorso(Position,Distance,SinglePlayer) if SinglePlayer then return(SinglePlayer.Torso.CFrame.p -Position).magnitude < Distance end local List = {} for i,v in pairs(workspace:GetChildren())do if v:IsA("Model")then if v:findFirstChild("Torso")then if v ~= char then if(v.Torso.Position -Position).magnitude <= Distance then table.insert(List,v) end end end end end return List end function Punch() part=Instance.new('Part',mod4) part.Anchored=true part.CanCollide=false part.FormFactor='Custom' part.Size=Vector3.new(.2,.2,.2) part.CFrame=root.CFrame*CFrame.new(0,1.5,-2.4)*CFrame.Angles(math.rad(0),0,0) part.Transparency=.7 part.BrickColor=BrickColor.new('Really black') mesh=Instance.new('SpecialMesh',part) mesh.MeshId='http://www.roblox.com/asset/?id=3270017' mesh.Scale=Vector3.new(3,3,3) part2=Instance.new('Part',mod4) part2.Anchored=true part2.CanCollide=false part2.FormFactor='Custom' part2.Size=Vector3.new(.2,.2,.2) part2.CFrame=root.CFrame*CFrame.new(0,1.5,-2.4)*CFrame.Angles(math.rad(90),0,0) part2.Transparency=.7 part2.BrickColor=BrickColor.new('Really red') mesh2=Instance.new('SpecialMesh',part2) mesh2.MeshId='http://www.roblox.com/asset/?id=20329976' mesh2.Scale=Vector3.new(3,1.5,3) for i,v in pairs(FindNearestTorso(torso.CFrame.p,4))do if v:FindFirstChild('Humanoid') then v.Humanoid:TakeDamage(math.random(2,6)) end end coroutine.resume(coroutine.create(function() for i=0,0.62,0.4 do wait() part.CFrame=part.CFrame part.Transparency=i mesh.Scale=mesh.Scale+Vector3.new(0.4,0.4,0.4) part2.CFrame=part2.CFrame part2.Transparency=i mesh2.Scale=mesh2.Scale+Vector3.new(0.4,0.2,0.4) end part.Parent=nil part2.Parent=nil end)) end ---------------------------------------------------- rarm.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then if Debounces.RPunch == true and Debounces.RPunched == false then Debounces.RPunched = true hit:FindFirstChild("Humanoid"):TakeDamage(math.random(5,8)) if Debounces.ks==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.RPunched = false end end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then if Debounces.RPunch == true and Debounces.RPunched == false then Debounces.RPunched = true hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(5,8)) if Debounces.ks==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.RPunched = false end end end end end) larm.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then if Debounces.LPunch == true and Debounces.LPunched == false then Debounces.LPunched = true hit:FindFirstChild("Humanoid"):TakeDamage(math.random(4,8)) if Debounces.ks2==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.LPunched = false end end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then if Debounces.LPunch == true and Debounces.LPunched == false then Debounces.LPunched = true hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(4,8)) if Debounces.ks2==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() end wait(.2) Debounces.LPunched = false end end end end end) ---------------------------------------------------- local player = game.Players.LocalPlayer local pchar = player.Character local mouse = player:GetMouse() local cam = workspace.CurrentCamera local rad = math.rad local keysDown = {} local flySpeed = 0 local MAX_FLY_SPEED = 150 local canFly = false local flyToggled = false local forward, side = 0, 0 local lastForward, lastSide = 0, 0 local floatBP = Instance.new("BodyPosition") floatBP.maxForce = Vector3.new(0, math.huge, 0) local flyBV = Instance.new("BodyVelocity") flyBV.maxForce = Vector3.new(9e9, 9e9, 9e9) local turnBG = Instance.new("BodyGyro") turnBG.maxTorque = Vector3.new(math.huge, math.huge, math.huge) mouse.KeyDown:connect(function(key) keysDown[key] = true if key == "f" then flyToggled = not flyToggled if not flyToggled then stanceToggle = "Normal" floatBP.Parent = nil flyBV.Parent = nil turnBG.Parent = nil root.Velocity = Vector3.new() pchar.Humanoid.PlatformStand = false end end end) mouse.KeyUp:connect(function(key) keysDown[key] = nil end) local function updateFly() if not flyToggled then return end lastForward = forward lastSide = side forward = 0 side = 0 if keysDown.w then forward = forward + 1 end if keysDown.s then forward = forward - 1 end if keysDown.a then side = side - 1 end if keysDown.d then side = side + 1 end canFly = (forward ~= 0 or side ~= 0) if canFly then stanceToggle = "Floating" turnBG.Parent = root floatBP.Parent = nil flyBV.Parent = root flySpeed = flySpeed + 1 + (flySpeed / MAX_FLY_SPEED) if flySpeed > MAX_FLY_SPEED then flySpeed = MAX_FLY_SPEED end else floatBP.position = root.Position floatBP.Parent = root flySpeed = flySpeed - 1 if flySpeed < 0 then flySpeed = 0 end end local camCF = cam.CoordinateFrame local in_forward = canFly and forward or lastForward local in_side = canFly and side or lastSide flyBV.velocity = ((camCF.lookVector * in_forward) + (camCF * CFrame.new(in_side, in_forward * 0.2, 0).p) - camCF.p) * flySpeed turnBG.cframe = camCF * CFrame.Angles(-rad(forward * (flySpeed / MAX_FLY_SPEED)), 0, 0) end game:service'RunService'.RenderStepped:connect(function() if flyToggled then pchar.Humanoid.PlatformStand = true end updateFly() end) ------------------------------- mouse.KeyDown:connect(function(key) if key == "q" then if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.NoIdl = true Debounces.on = true function FindNearestTorso(Position,Distance,SinglePlayer) if SinglePlayer then return(SinglePlayer.Torso.CFrame.p -Position).magnitude < Distance end local List = {} for i,v in pairs(workspace:GetChildren())do if v:IsA("Model")then if v:findFirstChild("Torso")then if v ~= char then if(v.Torso.Position -Position).magnitude <= Distance then table.insert(List,v) end end end end end return List end z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://382366855" z.Pitch = 1 z.Volume = 1 wait(0.2) z:Play() sp = Instance.new("Part",rarm) sp.Anchored = true sp.CanCollide = false sp.Locked = true sp.Transparency = 0 sp.Material = "Neon" sp.Size = Vector3.new(1,1,1) sp.TopSurface = "SmoothNoOutlines" sp.BottomSurface = "SmoothNoOutlines" sp.BrickColor = BrickColor.new("Toothpaste") spm = Instance.new("SpecialMesh",sp) spm.MeshType = "Sphere" spm.Scale = Vector3.new(21,21,21) sp2 = Instance.new("Part", rarm) sp2.Name = "Energy" sp2.BrickColor = BrickColor.new("Toothpaste") sp2.Size = Vector3.new(1, 1, 1) sp2.Shape = "Ball" sp2.CanCollide = false sp2.Anchored = true sp2.Locked = true sp2.TopSurface = 0 sp2.BottomSurface = 0 sp2.Transparency = 1 spm2 = Instance.new("SpecialMesh",sp2) spm2.MeshId = "rbxassetid://9982590" spm2.Scale = Vector3.new(2,2,2) for i = 1, 20 do spm.Scale = spm.Scale - Vector3.new(1,1,1) sp.CFrame = root.CFrame*CFrame.new(0,1,-2) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62,0)*CFrame.Angles(math.rad(-6),math.rad(-6),math.rad(8)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62,0)*CFrame.Angles(math.rad(-6),math.rad(6),math.rad(-8)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-8)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(8)), 0.4) if Debounces.on == false then break end rs:wait() end for i = 1, 100, 20 do rs:wait() sp.CFrame = root.CFrame*CFrame.new(0,1,-2) end for i = 1, 20 do sp.CFrame = root.CFrame*CFrame.new(0,1,-2) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(8)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62,.2)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(10),math.rad(-30),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(40), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-8)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(8)), 0.4) if Debounces.on == false then break end rs:wait() end sp.Transparency = 1 for i = 1, 20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(8)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.2,0.62,-.2)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(-50), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-8)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(8)), 0.4) if Debounces.on == false then break end rs:wait() end wait(1) sp.Transparency = 0 sp2.Transparency = 0.84 for i = 1, 20 do --spm.Scale = spm.Scale - Vector3.new(1,1,1) sp.CFrame = rarm.CFrame*CFrame.new(0,-1,0) sp2.CFrame = sp.CFrame * CFrame.new(0,0,0) * CFrame.Angles(math.rad(-i), math.rad(-i), math.rad(i)) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,0)*CFrame.Angles(math.rad(110),math.rad(-6),math.rad(140)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,0)*CFrame.Angles(math.rad(80),math.rad(6),math.rad(-40)), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(30),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-30), math.rad(0)), 0.3) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(20), 0, math.rad(-14)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-16), 0, math.rad(8)), 0.2) if Debounces.on == false then break end rs:wait() end for i = 1, 2880, 50 do rs:wait() sp.CFrame = rarm.CFrame*CFrame.new(0,-1,0) sp2.CFrame = rarm.CFrame * CFrame.new(0,-1,0) * CFrame.Angles(math.rad(-i/10), math.rad(-i/10), math.rad(i/10)) rs:wait() end sp:Destroy() sp2:Destroy() local X = Instance.new("Part",char) local O = Instance.new("ObjectValue",X) O.Name = "creator" X.Locked = true X.Name = "Shell" X.Anchored = false X.CanCollide = false X.Transparency = 0 X.Reflectance = 0 X.BottomSurface = 0 X.TopSurface = 0 X.Shape = 0 local V = Instance.new("ObjectValue",X) V.Value = char V.Name = "creator" X.BrickColor = BrickColor.new("Toothpaste") X.Size = Vector3.new(2,2,2) X.Material = "Neon" local Z = Instance.new("SpecialMesh",X) Z.MeshType = "Sphere" Z.Scale = Vector3.new(0.5,0.5,1) X.CFrame = rarm.CFrame*CFrame.new(-3,0,0) local bv = Instance.new("BodyVelocity",X) bv.maxForce = Vector3.new(99999,99999,99999) X.CFrame = CFrame.new(X.Position,mouse.Hit.p) bv.velocity = X.CFrame.lookVector*65 Explode = X.Touched:connect(function(hit) if hit ~= char and hit.Name ~= "Shell" then local cf = X.CFrame bv:Destroy() X.Anchored = true Z:Remove() Explode:disconnect() X.Size = Vector3.new(3,3,3) X.Touched:connect(function(hit) end) X.CanCollide = false local part3 = Instance.new("Part", rarm) part3.Anchored=true part3.CanCollide=false part3.Locked = true part3.TopSurface = "SmoothNoOutlines" part3.BottomSurface = "SmoothNoOutlines" part3.FormFactor='Custom' part3.Size=Vector3.new(1,1, 1) part3.CFrame=X.CFrame part3.Transparency=0 part3.BrickColor=BrickColor.new("Toothpaste") local mesh3 = Instance.new("SpecialMesh",part3) mesh3.MeshType = "Sphere" mesh3.Scale = Vector3.new(1,1,1) --debris:AddItem(X,8) local part4 = Instance.new("Part", rarm) part4.Material = "Neon" part4.Anchored=true part4.CanCollide=false part4.Locked = true part4.TopSurface = "SmoothNoOutlines" part4.BottomSurface = "SmoothNoOutlines" part4.FormFactor='Custom' part4.Size=Vector3.new(1,1, 1) part4.CFrame=X.CFrame part4.Transparency=0 part4.BrickColor=BrickColor.new("Hot pink") local mesh4 = Instance.new("SpecialMesh",part4) mesh4.MeshType = "Sphere" mesh4.Scale = Vector3.new(.5,.5,.5) local part7 = Instance.new("Part", rarm) part7.Material = "Neon" part7.Anchored=true part7.CanCollide=false part7.Locked = true part7.TopSurface = "SmoothNoOutlines" part7.BottomSurface = "SmoothNoOutlines" part7.FormFactor='Custom' part7.Size=Vector3.new(1,1, 1) part7.CFrame=X.CFrame part7.Transparency=0 part7.BrickColor=BrickColor.new("Really black") local mesh7 = Instance.new("SpecialMesh",part7) mesh7.MeshType = "Sphere" mesh7.Scale = Vector3.new(0.1, 0.1, 0.1) --[[X.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then hit:FindFirstChild("Humanoid"):TakeDamage(math.random(4,6)) wait(.3) end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(4,6)) wait(.3) end end end end) part3.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then hit:FindFirstChild("Humanoid"):TakeDamage(math.random(4,6)) wait(.3) end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(4,6)) wait(.3) end end end end)]]-- for i,v in pairs(FindNearestTorso(X.CFrame.p,140))do if v:FindFirstChild('Humanoid') then v.Humanoid:TakeDamage(math.random(60,90)) v.Humanoid.PlatformStand = true v:FindFirstChild("Torso").Velocity = hed.CFrame.lookVector * 100 end end local acos = math.acos local sqrt = math.sqrt local Vec3 = Vector3.new local fromAxisAngle = CFrame.fromAxisAngle local function toAxisAngle(CFr) local X,Y,Z,R00,R01,R02,R10,R11,R12,R20,R21,R22 = CFr:components() local Angle = math.acos((R00+R11+R22-1)/2) local A = (R21-R12)^2+(R02-R20)^2+(R10-R01)^2 A = A == 0 and 0.00001 or A local B = (R21-R12)^2+(R02-R20)^2+(R10-R01)^2 B = B == 0 and 0.00001 or B local C = (R21-R12)^2+(R02-R20)^2+(R10-R01)^2 C = C == 0 and 0.00001 or C local x = (R21-R12)/sqrt(A) local y = (R02-R20)/sqrt(B) local z = (R10-R01)/sqrt(C) return Vec3(x,y,z),Angle end function ApplyTrig(Num,Func) local Min,Max = Func(0),Func(1) local i = Func(Num) return (i-Min)/(Max-Min) end function LerpCFrame(CFrame1,CFrame2,Num) local Vec,Ang = toAxisAngle(CFrame1:inverse()*CFrame2) return CFrame1*fromAxisAngle(Vec,Ang*Num) + (CFrame2.p-CFrame1.p)*Num end function Crater(Torso,Radius) Spawn(function() local Ray = Ray.new(Torso.Position,Vector3.new(0,-1,0)*10) local Ignore = {} for i,v in pairs(game:GetService("Players"):GetPlayers()) do if v.Character ~= nil then Ignore[#Ignore+1] = v.Character end end local Hit,Pos,SurfaceNorm = Workspace:FindPartOnRayWithIgnoreList(Ray,Ignore) if Hit == nil then return end local Parts = {} for i = 1,360,10 do local P = Instance.new("Part",Torso.Parent) P.Anchored = true P.FormFactor = "Custom" P.BrickColor = Hit.BrickColor P.Material = Hit.Material P.TopSurface = "Smooth" P.BottomSurface = "Smooth" P.Size = Vector3.new(5,10,10)*(math.random(80,100)/100) P.CFrame = ((CFrame.new(Pos,Pos+SurfaceNorm)*CFrame.Angles(math.rad(90),0,0))-Vector3.new(0,7,0))*CFrame.Angles(math.rad(math.random(-50,50)),math.rad(math.random(-50,50)),math.rad(math.random(-50,50))) Parts[#Parts+1] = {P,P.CFrame,((CFrame.new(Pos,Pos+SurfaceNorm)*CFrame.Angles(math.rad(90),0,0))-Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(i),0)*CFrame.new(0,0,-Radius)*CFrame.Angles(math.rad(math.random(-50,-20)),math.rad(math.random(-15,15)),math.rad(math.random(-15,15))),P.Size} if math.random(0,5) == 0 then -- rubble local P = Instance.new("Part",Torso.Parent) P.Anchored = true P.FormFactor = "Custom" P.BrickColor = Hit.BrickColor P.Material = Hit.Material P.TopSurface = "Smooth" P.BottomSurface = "Smooth" P.Size = Vector3.new(2,2,2)*(math.random(80,100)/100) P.CFrame = ((CFrame.new(Pos,Pos+SurfaceNorm)*CFrame.Angles(math.rad(90),0,0))-Vector3.new(0,2.5,0))*CFrame.Angles(math.rad(math.random(-50,50)),math.rad(math.random(-50,50)),math.rad(math.random(-50,50))) Parts[#Parts+1] = {P,P.CFrame,(CFrame.new(Pos,Pos+SurfaceNorm)*CFrame.Angles(math.rad(90),0,0))*CFrame.Angles(0,math.rad(i),0)*CFrame.new(0,0,-Radius-8)*CFrame.Angles(math.rad(math.random(-90,90)),math.rad(math.random(-90,90)),math.rad(math.random(-90,90))),P.Size} end end for i = 0,1,0.05 do for i2,v in pairs(Parts) do v[1].CFrame = LerpCFrame(v[2],v[3],ApplyTrig(i,math.cos)) end wait(0.02) end for i,v in pairs(Parts) do if v[1].Size.X > 2.1 then v[1].CFrame = v[1].CFrame+Vector3.new(0,2,0) end v[1].Anchored = false end for i = 0,1,0.05 do for i2,v in pairs(Parts) do v[1].Transparency = i if i == 1 then v[1]:Destroy() elseif i >= 0.25 then v[1].CanCollide = false end end wait(0.02) end Parts = nil end) end ROW = function(out, trans, s, wt, t, ang, plus) for i = 1, 360, 360/t do local c = Instance.new("Part", game.Workspace) c.FormFactor = 3 c.TopSurface = 0 c.BottomSurface = 0 c.Size = s c.Anchored = true c.CanCollide = wt c.Material=workspace.Base.Material c.Transparency = trans c.BrickColor = workspace.Base.BrickColor c.CFrame = CFrame.new(X.CFrame.x,0,X.CFrame.z) * CFrame.Angles(0, math.rad(i + plus), 0) * CFrame.new(0, 0, out) * ang c.Locked=true game.Debris:AddItem(c,15) end end Part = function(x,y,z,color,tr,cc,an,parent) local p = Instance.new('Part',parent or Weapon) p.formFactor = 'Custom' p.Size = Vector3.new(x,y,z) p.BrickColor = BrickColor.new(color) p.CanCollide = cc p.Transparency = tr p.Anchored = an p.TopSurface,p.BottomSurface = 0,0 p.Locked=true p:BreakJoints() return p end Mesh = function(par,num,x,y,z) local msh = _ if num == 1 then msh = Instance.new("CylinderMesh",par) elseif num == 2 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 3 elseif num == 3 then msh = Instance.new("BlockMesh",par) elseif num == 4 then msh = Instance.new("SpecialMesh",par) msh.MeshType = "Torso" elseif type(num) == 'string' then msh = Instance.new("SpecialMesh",par) msh.MeshId = num end msh.Scale = Vector3.new(x,y,z) return msh end function explosion(col1,col2,cfr,sz,rng,dmg) local a= Part(1,1,1,col1,.5,false,true,workspace) local a2= Part(1,1,1,col2,.5,false,true,workspace) local a3= Part(1,1,1,col2,.5,false,true,workspace) v1,v2,v3=sz.x,sz.y,sz.z local m= Mesh(a,'http://www.roblox.com/asset/?id=1185246',v1,v2,v3) local m2= Mesh(a2,3,v1/3,v2/3,v3/3) local m3= Mesh(a3,3,v1/3,v2/3,v3/3) a.CFrame=cfr a2.CFrame=cfr*CFrame.Angles(math.random(),math.random(),math.random()) a3.CFrame=cfr*CFrame.Angles(math.random(),math.random(),math.random()) Spawn(function() while wait() do if a.Transparency >= 1 then a:Destroy() a2:Destroy() a3:Destroy() break end m.Scale=m.Scale+Vector3.new(.1,0.1,0.1) m2.Scale=m2.Scale+Vector3.new(.1,0.1,0.1) m3.Scale=m3.Scale+Vector3.new(.1,0.1,0.1) a.Transparency=a.Transparency+0.05 a2.Transparency=a2.Transparency+0.05 a3.Transparency=a3.Transparency+0.05 end end) end Crater(X,20) ROW(12, 0, Vector3.new(34.5, 30, 3), true, 8, CFrame.Angles(math.rad(math.random (30,60)), 0, math.rad (math.random(-30,30))), 0) z = Instance.new("Sound",X) z.SoundId = "rbxassetid://231917744" z.Pitch = .5 z.Volume = 10 z1 = Instance.new("Sound",X) z1.SoundId = "rbxassetid://231917744" z1.Pitch = .5 z1.Volume = 10 z2 = Instance.new("Sound",X) z2.SoundId = "rbxassetid://231917744" z2.Pitch = .5 z2.Volume = 10 z3 = Instance.new("Sound",X) z3.SoundId = "rbxassetid://340722848" z3.Pitch = .7 z3.Volume = 1 z4 = Instance.new("Sound",X) z4.SoundId = "rbxassetid://245537790" z4.Pitch = .7 z4.Volume = 1 wait(0.1) z:Play() z1:Play() z2:Play() z3:Play() z4:Play() local part=Instance.new('Part',rarm) part.Anchored=true part.CanCollide=false part.Locked = true part.FormFactor='Custom' part.Size=Vector3.new(1,1,1) part.CFrame=X.CFrame*CFrame.new(0,0,0) part.Transparency=0 part.BrickColor=BrickColor.new('Really black') local mesh=Instance.new('SpecialMesh',part) mesh.MeshId='http://www.roblox.com/asset/?id=20329976' mesh.Scale=Vector3.new(2,2,2) local part2=part:clone() part2.Parent = rarm part2.BrickColor=BrickColor.new("Toothpaste") local part5=part:clone() part5.Parent = rarm part5.BrickColor=BrickColor.new("Toothpaste") local part6=part:clone() part6.Parent = rarm part6.BrickColor=BrickColor.new("Black") local mesh2=mesh:clone() mesh2.Parent=part2 mesh2.Scale=Vector3.new(3, 3, 3) local mesh5=mesh:clone() mesh5.Parent=part5 mesh5.Scale=Vector3.new(3, 3, 3) local mesh6=mesh:clone() mesh6.Parent=part6 mesh6.Scale=Vector3.new(3, 3, 3) local blast = Instance.new("Part", rarm) blast.BrickColor = BrickColor.new("Really black") blast.Anchored = true blast.CanCollide = false blast.Locked = true blast.Size = Vector3.new(1, 1, 1) blast.TopSurface = "Smooth" blast.BottomSurface = "Smooth" blast.Transparency = 0 blast.CFrame = HandCF local bm = Instance.new("SpecialMesh", blast) bm.Scale = Vector3.new(5,1,5) bm.MeshId = "rbxassetid://3270017" local blast2 = Instance.new("Part", rarm) blast2.BrickColor = BrickColor.new("Really black") blast2.Anchored = true blast2.CanCollide = false blast2.Locked = true blast2.Size = Vector3.new(1, 1, 1) blast2.TopSurface = "Smooth" blast2.BottomSurface = "Smooth" blast2.Transparency = 0 blast2.CFrame = HandCF local bm2 = Instance.new("SpecialMesh", blast2) bm2.Scale = Vector3.new(3,1,3) bm2.MeshId = "rbxassetid://3270017" local blast3 = Instance.new("Part", rarm) blast3.BrickColor = BrickColor.new("Really black") blast3.Anchored = true blast3.CanCollide = false blast3.Locked = true blast3.Size = Vector3.new(1, 1, 1) blast3.TopSurface = "Smooth" blast3.BottomSurface = "Smooth" blast3.Transparency = 0 blast3.CFrame = HandCF local bm3 = Instance.new("SpecialMesh", blast3) bm3.Scale = Vector3.new(3,1,3) bm3.MeshId = "rbxassetid://3270017" for i = 1,120 do rs:wait() X.Transparency = X.Transparency + (1/120) part.Transparency = part.Transparency + (1/120) part2.Transparency = part2.Transparency + (1/120) part3.Transparency = part3.Transparency + (1/120) part4.Transparency = part4.Transparency + (1/120) part5.Transparency = part5.Transparency + (1/120) part6.Transparency = part6.Transparency + (1/120) part7.Transparency = part7.Transparency + (1/120) blast.Transparency = blast.Transparency + (1/120) blast2.Transparency = blast2.Transparency + (1/120) blast3.Transparency = blast3.Transparency + (1/120) X.Size = X.Size + Vector3.new(.8,.8,.8) --part3.Size = part3.Size + Vector3.new(3,3,3) mesh.Scale = mesh.Scale + Vector3.new(1,.2,1) mesh2.Scale = mesh2.Scale + Vector3.new(1.1,.2,1.1) mesh3.Scale = mesh3.Scale + Vector3.new(3,3,3) mesh4.Scale = mesh4.Scale + Vector3.new(1.7,1.7,1.7) mesh5.Scale = mesh5.Scale + Vector3.new(1.6,.2,1.6) mesh6.Scale = mesh6.Scale + Vector3.new(2,.2,2) mesh7.Scale = mesh7.Scale + Vector3.new(4,4,4) bm.Scale = bm.Scale + Vector3.new(6,6,.2) bm2.Scale = bm2.Scale + Vector3.new(4,4,.2) bm3.Scale = bm3.Scale + Vector3.new(4,4,.2) X.CFrame = cf part.CFrame=X.CFrame * CFrame.Angles(0,math.rad(i*2),0) part2.CFrame=X.CFrame * CFrame.Angles(0,math.rad(-i*2),0) part3.CFrame=X.CFrame part4.CFrame=X.CFrame part7.CFrame=X.CFrame part5.CFrame=X.CFrame * CFrame.Angles(0,math.rad(i*2.6),0) part6.CFrame=X.CFrame * CFrame.Angles(0,math.rad(-i*2.4),0) blast.CFrame=X.CFrame * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) blast2.CFrame=X.CFrame * CFrame.Angles(math.rad(-i*4), math.rad(i*4), math.rad(0)) blast3.CFrame=X.CFrame * CFrame.Angles(math.rad(180+i*4), math.rad(90-i*4), math.rad(0)) rs:wait() end X:Destroy() part:Destroy() part2:Destroy() part3:Destroy() part4:Destroy() part5:Destroy() part6:Destroy() blast:Destroy() blast2:Destroy() blast3:Destroy() z:Destroy() z1:Destroy() z2:Destroy() z3:Destroy() z4:Destroy() end end) for i = 1, 20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,0)*CFrame.Angles(math.rad(70),math.rad(-6),math.rad(-20)), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,0)*CFrame.Angles(math.rad(-6),math.rad(6),math.rad(-8)), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(30), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), 0, math.rad(-8)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-6), 0, math.rad(8)), 0.2) if Debounces.on == false then break end rs:wait() end if Debounces.CanAttack == false then Debounces.CanAttack = true Debounces.NoIdl = false Debounces.on = false end end end end) ---------------------------------------------------- mouse.KeyDown:connect(function(key) if key == "e" then if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.on = true Debounces.NoIdl = true pt = {1, 1.1, 1.2, 1.3, 1.4, 1.5} z = Instance.new("Sound", rarm) z.SoundId = "http://www.roblox.com/asset/?id=206083107"--160867463, 161006212 z.Volume = .6 z.Pitch = pt[math.random(1,#pt)] z.Looped = false z:Play() Debounces.RPunch = true Debounces.LPunch = true Debounces.ks = true Debounces.ks2 = true for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z2 = Instance.new("Sound", larm) z2.SoundId = "http://www.roblox.com/asset/?id=206083107" z2.Volume = .6 z2.Pitch = pt[math.random(1,#pt)] z2.Looped = false z2:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(120),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z3 = Instance.new("Sound", rarm) z3.SoundId = "http://www.roblox.com/asset/?id=206083107" z3.Volume = 0.6 z3.Pitch = pt[math.random(1,#pt)] z3.Looped = false z3:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(-20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z4 = Instance.new("Sound", larm) z4.SoundId = "http://www.roblox.com/asset/?id=206083107" z4.Volume = .6 z4.Pitch = pt[math.random(1,#pt)] z4.Looped = false z4:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z5 = Instance.new("Sound", rarm) z5.SoundId = "http://www.roblox.com/asset/?id=206083107" z5.Volume = .6 z5.Pitch = pt[math.random(1,#pt)] z5.Looped = false z5:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(110),math.rad(30),math.rad(20)), 0.9) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(50)), 0.9) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.9) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.9) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.9) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.9) if Debounces.on == false then break end wait() end z6 = Instance.new("Sound", larm) z6.SoundId = "http://www.roblox.com/asset/?id=206083107" z6.Volume = .6 z6.Pitch = pt[math.random(1,#pt)] z6.Looped = false z6:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z7 = Instance.new("Sound", rarm) z7.SoundId = "http://www.roblox.com/asset/?id=206083107"--160867463, 161006212 z7.Volume = .6 z7.Pitch = pt[math.random(1,#pt)] z7.Looped = false z7:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z8 = Instance.new("Sound", larm) z8.SoundId = "http://www.roblox.com/asset/?id=206083107" z8.Volume = .6 z8.Pitch = pt[math.random(1,#pt)] z8.Looped = false z8:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(120),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z9 = Instance.new("Sound", rarm) z9.SoundId = "http://www.roblox.com/asset/?id=206083107" z9.Volume = 0.6 z9.Pitch = pt[math.random(1,#pt)] z9.Looped = false z9:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(-20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z10 = Instance.new("Sound", larm) z10.SoundId = "http://www.roblox.com/asset/?id=206083107" z10.Volume = .6 z10.Pitch = pt[math.random(1,#pt)] z10.Looped = false z10:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z11 = Instance.new("Sound", rarm) z11.SoundId = "http://www.roblox.com/asset/?id=206083107" z11.Volume = .6 z11.Pitch = pt[math.random(1,#pt)] z11.Looped = false z11:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(110),math.rad(30),math.rad(20)), 0.9) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(50)), 0.9) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.9) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.9) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.9) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.9) if Debounces.on == false then break end wait() end z12 = Instance.new("Sound", larm) z12.SoundId = "http://www.roblox.com/asset/?id=206083107" z12.Volume = .6 z12.Pitch = pt[math.random(1,#pt)] z12.Looped = false z12:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(120),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z13 = Instance.new("Sound", rarm) z13.SoundId = "http://www.roblox.com/asset/?id=206083107" z13.Volume = 0.6 z13.Pitch = pt[math.random(1,#pt)] z13.Looped = false z13:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(-20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z14 = Instance.new("Sound", larm) z14.SoundId = "http://www.roblox.com/asset/?id=206083107" z14.Volume = .6 z14.Pitch = pt[math.random(1,#pt)] z14.Looped = false z14:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z15 = Instance.new("Sound", rarm) z15.SoundId = "http://www.roblox.com/asset/?id=206083107" z15.Volume = .6 z15.Pitch = pt[math.random(1,#pt)] z15.Looped = false z15:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(110),math.rad(30),math.rad(20)), 0.9) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(50)), 0.9) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.9) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.9) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.9) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.9) if Debounces.on == false then break end wait() end z16 = Instance.new("Sound", larm) z16.SoundId = "http://www.roblox.com/asset/?id=206083107" z16.Volume = .6 z16.Pitch = pt[math.random(1,#pt)] z16.Looped = false z16:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z17 = Instance.new("Sound", rarm) z17.SoundId = "http://www.roblox.com/asset/?id=206083107"--160867463, 161006212 z17.Volume = .6 z17.Pitch = pt[math.random(1,#pt)] z17.Looped = false z17:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z18 = Instance.new("Sound", larm) z18.SoundId = "http://www.roblox.com/asset/?id=206083107" z18.Volume = .6 z18.Pitch = pt[math.random(1,#pt)] z18.Looped = false z18:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(120),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z19 = Instance.new("Sound", rarm) z19.SoundId = "http://www.roblox.com/asset/?id=206083107" z19.Volume = 0.6 z19.Pitch = pt[math.random(1,#pt)] z19.Looped = false z19:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(-20),math.rad(20)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(0),math.rad(50)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z20 = Instance.new("Sound", larm) z20.SoundId = "http://www.roblox.com/asset/?id=206083107" z20.Volume = .6 z20.Pitch = pt[math.random(1,#pt)] z20.Looped = false z20:Play() for i = 1, 3 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.5,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-50)), 0.92) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.5,0)*CFrame.Angles(math.rad(60),math.rad(20),math.rad(-20)), 0.92) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(50),0), 0.92) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-50), 0), 0.92) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.6, -1, 0) * CFrame.Angles(math.rad(10), math.rad(50), math.rad(-15)), 0.92) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.6, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(50), math.rad(15)), 0.92) if Debounces.on == false then break end wait() end z:Destroy() z2:Destroy() z3:Destroy() z4:Destroy() z5:Destroy() z6:Destroy() z7:Destroy() z8:Destroy() z9:Destroy() z10:Destroy() z11:Destroy() z12:Destroy() z13:Destroy() z14:Destroy() z15:Destroy() z16:Destroy() z17:Destroy() z18:Destroy() z19:Destroy() z20:Destroy() Debounces.LPunch = false Debounces.RPunch = false Debounces.ks = false Debounces.ks2 = false if Debounces.CanAttack == false then Debounces.CanAttack = true Debounces.on = false Debounces.NoIdl = false end end end end) ------------------------------- mouse.KeyDown:connect(function(key) if key == "t" then if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.NoIdl = true Debounces.on = true Debounces.ks = true kik = rleg.Touched:connect(function(ht) hit = ht.Parent if ht and hit:IsA("Model") then if hit:FindFirstChild("Humanoid") then if hit.Name ~= p.Name then --[[if Debounces.Slashing == true and Debounces.Slashed == false then Debounces.Slashed = true]]-- if Debounces.ks==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Volume = 1 z:Play() Debounces.ks=false end hit:FindFirstChild("Humanoid"):TakeDamage(2) hit:FindFirstChild("Torso").Velocity = hit:FindFirstChild("Torso").CFrame.lookVector * -300 --Debounces.Slashed = false --end end end elseif ht and hit:IsA("Hat") then if hit.Parent.Name ~= p.Name then if hit.Parent:FindFirstChild("Humanoid") then --[[if Debounces.Slashing == true and Debounces.Slashed == false then Debounces.Slashed = true]]-- hit.Parent:FindFirstChild("Humanoid"):TakeDamage(2) hit:FindFirstChild("Torso").Velocity = hit:FindFirstChild("Torso").CFrame.lookVector * -300 --Debounces.Slashed = false --end end end end end) for i = 1,20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(8)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), math.rad(90)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-90)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(10)), 0.4) if Debounces.on == false then break end rs:wait() end kik:disconnect() if Debounces.CanAttack == false then Debounces.CanAttack = true Debounces.NoIdl = false Debounces.on = false end end end end) ---------------------------------------------------- mouse.KeyDown:connect(function(key) if key == "y" then x = Instance.new("Sound",char) x.SoundId = "rbxassetid://382366855" x.Pitch = 1 x.Volume = 30 wait(.1) x:Play() wait(1) if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.on = true Debounces.NoIdl = true for i = 1, 15 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,.6,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(30)), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,.6,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-90)), 0.6) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,0)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait(2.7) end x = Instance.new("Sound",char) x.SoundId = "rbxassetid://340722848" x.Pitch = 1 x.Volume = 1 wait(.1) x:Play() Debounces.on = false Debounces.Here = false shot = shot + 1 local rng = Instance.new("Part", larm) rng.Anchored = true rng.BrickColor = BrickColor.new("Toothpaste") rng.CanCollide = false rng.FormFactor = 3 rng.Name = "Ring" rng.Size = Vector3.new(1, 1, 1) rng.Transparency = 0.35 rng.TopSurface = 0 rng.BottomSurface = 0 rng2 = rng:clone() rng3 = rng2:clone() rng4 = rng2:clone() local rngm = Instance.new("SpecialMesh", rng) rngm.MeshId = "http://www.roblox.com/asset/?id=3270017" rngm.Scale = Vector3.new(10, 10, 1) rngm2 = rngm:clone() rngm2.Scale = Vector3.new(5, 5, 3) rngm3=rngm2:clone() rngm3.Parent = rng3 rngm3.Scale = Vector3.new(8, 8, 1) rngm4 = rngm2:clone() rngm4.Parent = rng4 rngm4.Scale = Vector3.new(6, 6, 1) local bem = Instance.new("Part", larm) bem.Anchored = true bem.BrickColor = BrickColor.new("Really black") bem.CanCollide = false bem.FormFactor = 3 bem.Name = "Beam" .. shot bem.Size = Vector3.new(1, 1, 1) bem.Transparency = 0.35 bem.TopSurface = 0 bem.BottomSurface = 0 local bemm = Instance.new("SpecialMesh", bem) bemm.MeshType = 4 bemm.Scale = Vector3.new(1, 4, 4) local out = Instance.new("Part", larm) out.Anchored = true out.BrickColor = BrickColor.new("Really black") out.CanCollide = false out.FormFactor = 3 out.Name = "Out" out.Size = Vector3.new(4, 4, 4) out.Transparency = 0.35 out.TopSurface = 0 out.BottomSurface = 0 local outm = Instance.new("SpecialMesh", out) outm.MeshId = "http://www.roblox.com/asset/?id=1033714" outm.Scale = Vector3.new(6, 4, 6) local bnd = Instance.new("Part", larm) bnd.Anchored = true bnd.BrickColor = BrickColor.new("Really red") bnd.CanCollide = false bnd.FormFactor = 3 bnd.Name = "Bend" bnd.Size = Vector3.new(1, 1, 1) bnd.Transparency = 1 bnd.TopSurface = 0 bnd.BottomSurface = 0 local bndm = Instance.new("SpecialMesh", bnd) bndm.MeshType = 3 bndm.Scale = Vector3.new(8, 8, 8) out.CFrame = larm.CFrame * CFrame.new(0, -2.7, 0) bem.CFrame = out.CFrame * CFrame.new(0, -2.5, 0) * CFrame.Angles(0, 0, math.rad(90)) bnd.CFrame = bem.CFrame * CFrame.new(0, 0, 0) rng.CFrame = out.CFrame * CFrame.Angles(math.rad(90), 0, 0) rng3.CFrame = rng.CFrame * CFrame.new(0, -.5, 0) rng4.CFrame = rng.CFrame * CFrame.new(0, -1, 0) Debounces.Shewt = true coroutine.wrap(function() for i = 1, 20, 0.2 do rngm.Scale = Vector3.new(10 + i*2, 10 + i*2, 1) rngm3.Scale = Vector3.new(8 + i*3, 8 + i*3, 1) rngm4.Scale = Vector3.new(6 + i*4, 6 + i*4, 1) rng.Transparency = i/20 rng3.Transparency = 1/24 rng4.Transparency = i/26 wait() end wait() rng:Destroy() end)() if Debounces.Shewt == true then larm:WaitForChild("Beam" .. shot).Touched:connect(function(ht) hit = ht.Parent if hit:IsA("Model") and hit:findFirstChild("Humanoid") then if HasntTouched(hit.Name) == true and deb == false then deb = true coroutine.wrap(function() hit:FindFirstChild("Humanoid").PlatformStand = true hit:FindFirstChild("Torso").Velocity = char.Head.CFrame.lookVector * 180 hit:FindFirstChild("Humanoid"):TakeDamage(math.random(24,73)) end)() table.insert(Touche, hit.Name) deb = false end elseif hit:IsA("Hat") and hit.Parent:findFirstChild("Humanoid") then if HasntTouched(hit.Parent.Name) == true and deb == false then deb = true coroutine.wrap(function() hit.Parent:FindFirstChild("Humanoid").PlatformStand = true hit.Parent:FindFirstChild("Torso").Velocity = char.Head.CFrame.lookVector * 180 wait(1) hit.Parent:FindFirstChild("Humanoid").PlatformStand = false end)() table.insert(Touche, hit.Parent.Name) deb = false for i, v in pairs(Touche) do print(v) end end end end) end for i = 0, 260, 8 do bem.Size = Vector3.new(i, 3, 3) out.CFrame = larm.CFrame * CFrame.new(0, -2.7, 0) bem.CFrame = larm.CFrame * CFrame.new(0, -4.2 -(i/2), 0) * CFrame.Angles(0, 0, math.rad(90)) bnd.CFrame = bem.CFrame * CFrame.new(-i/2, 0, 1.2) bnd.Size = Vector3.new(1,1,1) bndm.Scale = Vector3.new(8,8,8) if i % 10 == 0 then local newRng = rng2:Clone() newRng.Parent = larm newRng.CFrame = larm.CFrame * CFrame.new(0, -4.2-i, 0) * CFrame.Angles(math.rad(90), 0, 0) local newRngm = rngm2:clone() newRngm.Parent=newRng coroutine.wrap(function() for i = 1, 10, 0.2 do newRngm.Scale = Vector3.new(8 + i*2, 8 + i*2, 3) newRng.Transparency = i/10 wait() end wait() newRng:Destroy() end)() end wait() end wait() Debounces.Shewt = false bem:Destroy() out:Destroy() bnd:Destroy() Debounces.Ready = false for i, v in pairs(Touche) do table.remove(Touche, i) end wait() table.insert(Touche, char.Name) Debounces.NoIdl = false if Debounces.CanAttack == false then Debounces.CanAttack = true end end end end) ---------------------------------------------------- --[[mouse.KeyDown:connect(function(key) if key == "y" then if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.NoIdl = true Debounces.on = true local shell = Instance.new("Part",torso) shell.BrickColor = BrickColor.new("Toothpaste") shell.Anchored = false shell.CanCollide = false shell.Locked = true shell.TopSurface = "SmoothNoOutlines" shell.BottomSurface = "SmoothNoOutlines" shell.Size = Vector3.new(1.2,1.2,1.2) shell.FormFactor = 3 local shellm = Instance.new("SpecialMesh",shell) shellm.MeshType = "Sphere" shellm.Scale = Vector3.new(1.2,1.2,1.2) Omega = function() local X = Instance.new("Part",char) local O = Instance.new("ObjectValue",X) O.Name = "creator" X.Locked = true X.Name = "Shell" X.Anchored = false X.CanCollide = false X.Transparency = 0.5 X.Reflectance = 0 X.BottomSurface = 0 X.TopSurface = 0 X.Shape = 0 local V = Instance.new("ObjectValue",X) V.Value = char V.Name = "creator" X.BrickColor = BrickColor.new("Toothpaste") X.Size = Vector3.new(40,40,40) --X.Material = "Neon" local Z = Instance.new("SpecialMesh",X) Z.MeshType = "Sphere" Z.Scale = Vector3.new(0.2,0.2,0.2) X.CFrame = rarm.CFrame*CFrame.new(0,-6,0) local bv = Instance.new("BodyVelocity",X) bv.maxForce = Vector3.new(99999,99999,99999) X.CFrame = CFrame.new(X.Position,root.CFrame.lookVector*10) bv.velocity = root.CFrame.lookVector*10 Explode = X.Touched:connect(function(hit) if hit ~= char and hit.Name ~= "Shell" and hit ~= X and hit:IsA("Part") or hit:IsA("BasePart}") then local cf = X.CFrame bv:Destroy() X.Anchored = true Z:Remove() Explode:disconnect() X.Size = Vector3.new(3,3,3) X.Touched:connect(function(hit) end) X.CanCollide = false for i,v in pairs(FindNearestTorso(X.CFrame.p,200))do if v:FindFirstChild('Humanoid') then v.Humanoid:TakeDamage(math.random(80,120)) end end for i = 1, (40) do rs:wait() X.Transparency = X.Transparency + (1/40) X.Size = X.Size + Vector3.new(1,1,1) X.CFrame = root.CFrame * CFrame.new(0,0,-10) end X:Destroy() end end) end for i = 1,200 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.3,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(170)), 0.03) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) if Debounces.on == false then break end rs:wait() end for i = 1,30 do shell.CFrame = torso.CFrame * CFrame.new(0,8,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.3,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(170)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.3,0.62,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-170)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) if Debounces.on == false then break end rs:wait() end for i = 1,40 do shell.CFrame = torso.CFrame * CFrame.new(0,20,0) shell.Size = shell.Size + Vector3.new(1,1,1) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.4,0.6,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(100)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.4,0.6,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-100)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) if Debounces.on == false then break end rs:wait() end for i = 1,40 do shell.CFrame = torso.CFrame * CFrame.new(0,0,-30) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.4,0.6,0)*CFrame.Angles(math.rad(-50),math.rad(0),math.rad(20)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.4,0.6,0)*CFrame.Angles(math.rad(-50),math.rad(0),math.rad(-20)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) if Debounces.on == false then break end rs:wait() end for i = 1,60 do shell.CFrame = torso.CFrame * CFrame.new(0,0,-60) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.4,0.64,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-30)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.4,0.64,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(30)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) if Debounces.on == false then break end rs:wait() end for i = 1,60 do shell.CFrame = torso.CFrame * CFrame.new(0,0,-60) shell.Size = shell.Size + Vector3.new(1,1,1) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.4,0.64,0)*CFrame.Angles(math.rad(110),math.rad(0),math.rad(120)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.4,0.64,0)*CFrame.Angles(math.rad(110),math.rad(0),math.rad(-120)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(0),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(0)), 0.4) if Debounces.on == false then break end rs:wait() end if Debounces.CanAttack == false then Debounces.CanAttack = true Debounces.NoIdl = false Debounces.on = false end end end end)]]-- ---------------------------------------------------- Charging = false mouse.KeyDown:connect(function(key) if key == "r" then if Charging == false then Charging = true if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.NoIdl = true Debounces.on = true for i = 1,20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.65,-.4)*CFrame.Angles(math.rad(130),math.rad(0),math.rad(-40)), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.2,0.65,-.4)*CFrame.Angles(math.rad(130),math.rad(0),math.rad(40)), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(0),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-10), math.rad(0), 0), 0.2) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, .4, -0.8) * CFrame.Angles(math.rad(-6), math.rad(0), math.rad(0)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, .4, -0.8) * CFrame.Angles(math.rad(-6), math.rad(0), math.rad(0)), 0.2) if Debounces.on == false then break end rs:wait() end --[[for i = 1,20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.65,0)*CFrame.Angles(math.rad(-20),math.rad(-20),math.rad(50)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.65,0)*CFrame.Angles(math.rad(-20),math.rad(20),math.rad(-50)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,.1)*CFrame.Angles(math.rad(34),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(15), math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), 0, math.rad(-10)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), 0, math.rad(10)), 0.4) if Debounces.on == false then break end rs:wait() end]]-- pt=Instance.new('Part',torso) pt.Anchored=true pt.CanCollide=false pt.Locked = true pt.FormFactor='Custom' pt.Size=Vector3.new(1,1,1) pt.CFrame=root.CFrame*CFrame.new(0,-1,0) pt.Transparency=.6 pt.BrickColor=BrickColor.new('Really black') msh=Instance.new('SpecialMesh',pt) msh.MeshId='http://www.roblox.com/asset/?id=20329976' msh.Scale=Vector3.new(8,4,8) pt2=pt:clone() pt2.Parent = torso pt2.CFrame=root.CFrame*CFrame.new(0,-1,0) pt2.BrickColor=BrickColor.new("Toothpaste") msh2=msh:clone() msh2.Parent=pt2 msh2.Scale=Vector3.new(10,5,10) custommath={25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,-25,-26,-27,-28,-29,-30,-31,-32,-33,-34,-35,-36,-37,-38,-39,-40,-41,-42,-43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-57,-58,-59,-60,-61,-62,-63,-64,-65,-66,-67,-68,-69,-70,-71,-72,-73,-74,-75,-76,-77,-78,-79,-80,-81,-82,-83,-84,-85,-86,-87,-88,-89,-90,-91,-92,-93,-94,-95,-96,-97,-98,-99,-100} bl = Instance.new("Part", char) bl.Locked = true bl.Name = "Shell" bl.BrickColor = BrickColor.new("Really black") bl.Anchored = true bl.CanCollide = false bl.Transparency = 0 bl.Reflectance = 0 bl.BottomSurface = 0 bl.TopSurface = 0 bl.Shape = 0 blm = Instance.new("SpecialMesh",bl) blm.MeshType = "Sphere" blm.Scale = Vector3.new(1,1,1) blm.MeshId = "rbxassetid://9982590" coroutine.resume(coroutine.create(function() for i=1, math.huge, 4 do if Charging == true then rs:wait() bl.CFrame = root.CFrame * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-i/10), math.rad(-i/10), math.rad(i/10)) blm.Scale = blm.Scale + Vector3.new(0.1, 0.1, 0.1) bl.Transparency = bl.Transparency + 0.005 pt.CFrame = root.CFrame*CFrame.new(0,-1,0) * CFrame.Angles(0,math.rad(i*2),0) pt2.CFrame = root.CFrame*CFrame.new(0,-1,0) * CFrame.Angles(0,math.rad(-i*2),0) msh.Scale = msh.Scale + Vector3.new(0.05,0,0.05) msh2.Scale = msh2.Scale + Vector3.new(0.05,0,0.05) elseif Charging == false then break end end end)) repeat local p = Instance.new('Part',torso) p.formFactor = 'Custom' p.Size = Vector3.new(1,1,1) p.BrickColor = workspace.Base.BrickColor p.CanCollide = false p.Transparency = 0 p.Anchored = true p.Locked=true p.Material = workspace.Base.Material s = math.random(1,40)/10 local m = Instance.new("BlockMesh",p) m.Scale = Vector3.new(s,s,s) p.CFrame = torso.CFrame*CFrame.new(custommath[math.random(1,#custommath)]/10,-math.random(5,7),custommath[math.random(1,#custommath)]/10)*CFrame.Angles(math.random(),math.random(),math.random()) --[[coroutine.wrap(function() wait(2) while Charging == true do wait(2) GroundWave1() wait(2) end end)()]]-- Spawn(function() while rs:wait() do if Charging == true then rarm.Weld.C0 = CFrame.new(1.5,0.65,0)*CFrame.Angles(math.rad(math.random(-36,-20)),math.rad(math.random(-30,-20)),math.rad(math.random(30,50))) larm.Weld.C0 = CFrame.new(-1.5,0.65,0)*CFrame.Angles(math.rad(math.random(-36,-20)),math.rad(math.random(20,30)),math.rad(math.random(-50,-30))) hed.Weld.C0 = CFrame.new(0,1.5,.1)*CFrame.Angles(math.rad(math.random(26,34)),math.rad(math.random(-5,5)),math.rad(0)) torso.Weld.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(10), math.rad(math.random(-4,4)), math.rad(0)) lleg.Weld.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(math.random(-10,-6)), math.rad(math.random(10,20)), math.rad(math.random(-20,-10))) rleg.Weld.C0 = CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(math.random(-10,-6)), math.rad(math.random(-20,-10)), math.rad(math.random(10,20))) elseif Charging == false then break end end end) Spawn(function() while rs:wait() do if p.Transparency >= 1 then p:Destroy() break end p.CFrame = p.CFrame*CFrame.Angles(math.rad(2),math.rad(2),math.rad(2))+Vector3.new(0,0.2,0) p.Transparency = p.Transparency+0.01 end end) wait(.3) until Charging == false end end end end) ---------------------------------------------------- mouse.KeyUp:connect(function(key) if key == "r" then if Charging == true then Charging = false pt:Destroy() pt2:Destroy() bl:Destroy() if Debounces.CanAttack == false then Debounces.CanAttack = true Debounces.NoIdl = false Debounces.on = false end end end end) ---------------------------------------------------- mouse.KeyDown:connect(function(key) if key == "g" then if Debounces.CanAttack == true then Debounces.CanAttack = false Debounces.NoIdl = true Debounces.on = true local shell = Instance.new("Part",torso) shell.BrickColor = BrickColor.new("Toothpaste") shell.Anchored = true shell.CanCollide = false shell.Locked = true shell.TopSurface = "SmoothNoOutlines" shell.BottomSurface = "SmoothNoOutlines" shell.Size = Vector3.new(1,1,1) shellm = Instance.new("SpecialMesh",shell) shellm.MeshType = "Sphere" shellm.Scale = Vector3.new(1,1,1) local shell2 = Instance.new("Part",torso) shell2.BrickColor = BrickColor.new("Toothpaste") shell2.Anchored = true shell2.CanCollide = false shell2.Locked = true shell2.TopSurface = "SmoothNoOutlines" shell2.BottomSurface = "SmoothNoOutlines" shell2.Size = Vector3.new(1,1,1) shellm2 = Instance.new("SpecialMesh",shell2) shellm2.MeshType = "Sphere" shellm2.Scale = Vector3.new(1,1,1) function FindNearestTorso(Position,Distance,SinglePlayer) if SinglePlayer then return(SinglePlayer.Torso.CFrame.p -Position).magnitude < Distance end local List = {} for i,v in pairs(workspace:GetChildren())do if v:IsA("Model")then if v:findFirstChild("Torso")then if v ~= char then if(v.Torso.Position -Position).magnitude <= Distance then table.insert(List,v) end end end end end return List end Shell = function() local X = Instance.new("Part",char) local O = Instance.new("ObjectValue",X) O.Name = "creator" X.Locked = true X.Name = "Shell" X.Anchored = false X.CanCollide = false X.Transparency = 0 X.Reflectance = 0 X.BottomSurface = 0 X.TopSurface = 0 X.Shape = 0 local V = Instance.new("ObjectValue",X) V.Value = char V.Name = "creator" X.BrickColor = BrickColor.new("Toothpaste") X.Size = Vector3.new(1,1,1) --X.Material = "Neon" local Z = Instance.new("SpecialMesh",X) Z.MeshType = "Sphere" Z.Scale = Vector3.new(1,1,1) X.CFrame = rarm.CFrame*CFrame.new(0,-6,0) local bv = Instance.new("BodyVelocity",X) bv.maxForce = Vector3.new(99999,99999,99999) X.CFrame = CFrame.new(X.Position,root.CFrame.lookVector*10) bv.velocity = root.CFrame.lookVector*65 Explode = X.Touched:connect(function(hit) if hit ~= char and hit.Name ~= "Shell" and hit:IsA("Part") or hit:IsA("BasePart}") then local cf = X.CFrame bv:Destroy() X.Anchored = true Z:Remove() Explode:disconnect() X.Size = Vector3.new(3,3,3) X.Touched:connect(function(hit) end) X.CanCollide = false for i,v in pairs(FindNearestTorso(X.CFrame.p,40))do if v:FindFirstChild('Humanoid') then v.Humanoid:TakeDamage(math.random(6,12)) end end for i = 1, (40) do rs:wait() X.Transparency = X.Transparency + (1/40) X.Size = X.Size + Vector3.new(1,1,1) X.CFrame = cf end X:Destroy() end end) end Shell() for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(0),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(0), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(-50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 0 shell2.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell2.Transparency = 0 shell.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(-50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 0 shell2.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell2.Transparency = 0 shell.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(-50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 0 shell2.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(50),0), 0.5) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell2.Transparency = 0 shell.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(-50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 0 shell2.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell2.Transparency = 0 shell.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(-50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 0 shell2.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell2.Transparency = 0 shell.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(-50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end Shell() shell.Transparency = 0 shell2.Transparency = 1 for i = 1, 10 do shell.CFrame = rarm.CFrame * CFrame.new(0,-1,0) shell2.CFrame = larm.CFrame * CFrame.new(0,-1,0) rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.6,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(50),0), 0.7) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-50), 0), 0.7) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.7) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(20)), 0.7) if Debounces.on == false then break end rs:wait() end shell.Transparency = 1 if Debounces.CanAttack == false then Debounces.CanAttack = true Debounces.NoIdl = false Debounces.on = false end end end end) ---------------------------------------------------- Search = false mouse.KeyDown:connect(function(key) if key == "n" then if Search == false then Search = true for i,v in pairs(game.Players:getPlayers()) do if v.Name~=char.Name then for j,k in pairs(v.Character:GetChildren()) do if k:IsA("BasePart") and k.Transparency >= 1 then bawx=Instance.new("SelectionBox",cam) bawx.Color = BrickColor.new("Bright red") bawx.Transparency = .5 bawx.Adornee = k end end end end elseif Search == true then Search = false for i, v in pairs(cam:GetChildren()) do if v:IsA("SelectionBox") then v:Destroy() end end end end end) ---------------------------------------------------- Grab = false mouse.KeyDown:connect(function(key) if key == "z" then Debounces.on = true Debounces.NoIdl = true Debounces.ks = true if Grab == false then gp = nil for i = 1, 20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.65,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(110)), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.65,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-110)), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(0),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(0), 0), 0.2) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(30), math.rad(-20)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(-15), math.rad(20)), 0.2) if Debounces.on == false then break end rs:wait() end con1=larm.Touched:connect(function(hit) -- this is grab ht = hit.Parent hum1=ht:FindFirstChild('Humanoid') if hum1 ~= nil then if Debounces.ks==true then z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Volume = 1 z:Play() Debounces.ks=false end hum1.PlatformStand=true gp = ht Grab = true asd=weld5(root,ht:FindFirstChild("Torso"),CFrame.new(0,0,-2.4),CFrame.new(0,0,0)) asd.Parent = larm asd.Name = "asd" asd.C0=asd.C0*CFrame.Angles(math.rad(0),math.rad(180),0) --[[elseif hum1 == nil then con1:disconnect() wait() return]]-- end end) for i = 1, 20 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.3,0.65,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-40)), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.3,0.65,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(40)), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-10),math.rad(0),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(0), 0), 0.2) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(10), math.rad(30), math.rad(-20)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-10), math.rad(-15), math.rad(20)), 0.2) if Debounces.on == false then break end rs:wait() end if hum1 == nil then Debounces.on = false Debounces.NoIdl = false end con1:disconnect() elseif Grab == true then Grab = false Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.4,-.5)*CFrame.Angles(math.rad(80),math.rad(0),math.rad(-50)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.6) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(110)), 0.6) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(-40),math.rad(0),math.rad(20)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90), 0), 0.65) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.4,-.5)*CFrame.Angles(math.rad(80),math.rad(0),math.rad(-50)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.6) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(110)), 0.6) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(-40),math.rad(0),math.rad(20)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90), 0), 0.65) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.4,-.5)*CFrame.Angles(math.rad(80),math.rad(0),math.rad(-50)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.6) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(110)), 0.6) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(-40),math.rad(0),math.rad(20)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90), 0), 0.65) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.4,-.5)*CFrame.Angles(math.rad(80),math.rad(0),math.rad(-50)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.6) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(110)), 0.6) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(-40),math.rad(0),math.rad(20)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90), 0), 0.65) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.4,-.5)*CFrame.Angles(math.rad(80),math.rad(0),math.rad(-50)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.6) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(110)), 0.6) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(-40),math.rad(0),math.rad(20)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90), 0), 0.65) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.2,0.4,-.5)*CFrame.Angles(math.rad(80),math.rad(0),math.rad(-50)), 0.7) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(-110)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-90), 0), 0.6) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end Punch() z = Instance.new("Sound",hed) z.SoundId = "rbxassetid://169380525" z.Pitch = ptz[math.random(1,#ptz)] z.Volume = 1 z:Play() for i = 1, 10 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.7,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(110)), 0.6) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.7,0)*CFrame.Angles(math.rad(-40),math.rad(0),math.rad(20)), 0.7) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(-90),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(90), 0), 0.65) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.2) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.2) if Debounces.on == false then break end rs:wait() end con1:disconnect() Debounces.on = false Debounces.NoIdl = false if gp ~= nil then gp:FindFirstChild("Torso").Velocity = hed.CFrame.lookVector * 140 for i,v in pairs(larm:GetChildren()) do if v.Name == "asd" and v:IsA("Weld") then v:Remove() end end --[[bv = Instance.new("BodyVelocity",gp:FindFirstChild("Torso")) bv.maxForce = Vector3.new(400000, 400000, 400000) bv.P = 125000 bv.velocity = char.Head.CFrame.lookVector * 200]]-- hum1=nil ht=nil Debounces.on = false Debounces.NoIdl = false elseif ht == nil then wait() Grab = false Debounces.on = false Debounces.NoIdl = false end end end end) ---------------------------------------------------- mouse.KeyDown:connect(function(key) if string.byte(key) == 52 then char.Humanoid.WalkSpeed = 60 end end) mouse.KeyUp:connect(function(key) if string.byte(key) == 52 then char.Humanoid.WalkSpeed = 8 end end) ------------------------------- local animpose = "Idle" local lastanimpose = "Idle" local sine = 0 local change = 1 local val = 0 local ffing = false ------------------------------- game:GetService("RunService").RenderStepped:connect(function() --[[if char.Humanoid.Jump == true then jump = true else jump = false end]] char.Humanoid.FreeFalling:connect(function(f) if f then ffing = true else ffing = false end end) sine = sine + change if jumpn == true then animpose = "Jumping" elseif ffing == true then animpose = "Freefalling" elseif (torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 2 then animpose = "Idle" elseif (torso.Velocity*Vector3.new(1, 0, 1)).magnitude < 20 then animpose = "Walking" elseif (torso.Velocity*Vector3.new(1, 0, 1)).magnitude > 20 then animpose = "Running" end if animpose ~= lastanimpose then sine = 0 if Debounces.NoIdl == false then if animpose == "Idle" then for i = 1, 2 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62,0)*CFrame.Angles(math.rad(-6),math.rad(-6),math.rad(8)), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62,0)*CFrame.Angles(math.rad(-6),math.rad(6),math.rad(-8)), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14),math.rad(0),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-8)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(8)), 0.4) end elseif animpose == "Walking" then for i = 1, 2 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,0)*CFrame.Angles(math.rad(-16),math.rad(-12),math.rad(10+2*math.cos(sine/14))), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,0)*CFrame.Angles(math.rad(-16),math.rad(12),math.rad(-10-2*math.cos(sine/14))), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.2) * CFrame.Angles(math.rad(-14),0,0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-10),0, math.rad(0)), 0.05) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-8), 0, math.rad(-8)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-8), 0, math.rad(8)), 0.4) end elseif animpose == "Running" then for i = 1, 2 do rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,0)*CFrame.Angles(math.rad(-20),math.rad(-14),math.rad(8+2*math.cos(sine/14))), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,0)*CFrame.Angles(math.rad(-20),math.rad(14),math.rad(-8-2*math.cos(sine/14))), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.2) * CFrame.Angles(math.rad(-10),0,0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20),0, math.rad(0)), 0.4) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-12), 0, math.rad(-7)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-12), 0, math.rad(7)), 0.4) wait() end end else end end lastanimpose = animpose if Debounces.NoIdl == false then if animpose == "Idle" then change = 0.5 rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.62+0.1*math.cos(sine/14),0)*CFrame.Angles(math.rad(-6),math.rad(-6),math.rad(8+2*math.cos(sine/14))), 0.4) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.62+0.1*math.cos(sine/14),0)*CFrame.Angles(math.rad(-6),math.rad(6),math.rad(-8-2*math.cos(sine/14))), 0.4) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0,1.5,-.2)*CFrame.Angles(math.rad(-14+1*math.cos(sine/14)),math.rad(0),0), 0.2) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0-0.1*math.cos(sine/14), 0) * CFrame.Angles(0, math.rad(0), math.rad(0)), 0.05) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(-8-2*math.cos(sine/14))), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(0, 0, math.rad(8+2*math.cos(sine/14))), 0.4) elseif animpose == "Walking" then change = 1 rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.55,0)*CFrame.Angles(math.rad(-16),math.rad(-12),math.rad(10+2*math.cos(sine/14))), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.5,0.55,0)*CFrame.Angles(math.rad(-16),math.rad(12),math.rad(-10-2*math.cos(sine/14))), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, -.2) * CFrame.Angles(math.rad(-14),0,0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0-0.1*math.cos(sine/14), 0) * CFrame.Angles(math.rad(-10),0, math.rad(0)), 0.05) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.rad(-8), 0, math.rad(-8)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-8), 0, math.rad(8)), 0.4) elseif animpose == "Running" then change = 1 rarm.Weld.C0 = Lerp(rarm.Weld.C0, CFrame.new(1.5,0.35,.4)*CFrame.Angles(math.rad(-30),math.rad(14),math.rad(-30+2*math.cos(sine/14))), 0.2) larm.Weld.C0 = Lerp(larm.Weld.C0, CFrame.new(-1.2,0.55,-.4)*CFrame.Angles(math.rad(110),math.rad(0),math.rad(40-2*math.cos(sine/14))), 0.2) hed.Weld.C0 = Lerp(hed.Weld.C0, CFrame.new(0, 1.5, .2) * CFrame.Angles(math.rad(20),math.rad(10),0), 0.4) torso.Weld.C0 = Lerp(torso.Weld.C0, CFrame.new(0, 0-0.1*math.cos(sine/14), 0) * CFrame.Angles(math.rad(-40),math.rad(-10), math.rad(0)), 0.2) lleg.Weld.C0 = Lerp(lleg.Weld.C0, CFrame.new(-0.5, 0, -1.2) * CFrame.Angles(math.rad(-20), math.rad(10), math.rad(0)), 0.4) rleg.Weld.C0 = Lerp(rleg.Weld.C0, CFrame.new(0.5, -1, 0) * CFrame.Angles(math.rad(-12), math.rad(10), math.rad(0)), 0.4) end end end) hum.MaxHealth = 9001 wait(3) hum.Health = 9001 function Lightning(Part0,Part1,Times,Offset,Color,Thickness,Trans) -- Lightning module --[[Part0 = Vector3 (Start pos) Part1 = Vector3 (End pos) Times = number (Amount of lightning parts) Offset = number (Offset) Color = color (brickcolor value) Thickness = number (thickness) Trans = number (transparency) ]]-- local magz = (Part0 - Part1).magnitude local curpos = Part0 local trz = {-Offset,Offset} for i=1,Times do local li = Instance.new("Part", torso) li.Name = "Lightning" li.TopSurface =0 li.Material = "Neon" li.BottomSurface = 0 li.Anchored = true li.Locked = true li.Transparency = Trans or 0.4 li.BrickColor = BrickColor.new(Color) li.formFactor = "Custom" li.CanCollide = false li.Size = Vector3.new(Thickness,Thickness,magz/Times) local Offzet = Vector3.new(trz[math.random(1,2)],trz[math.random(1,2)],trz[math.random(1,2)]) local trolpos = CFrame.new(curpos,Part1)*CFrame.new(0,0,magz/Times).p+Offzet if Times == i then local magz2 = (curpos - Part1).magnitude li.Size = Vector3.new(Thickness,Thickness,magz2) li.CFrame = CFrame.new(curpos,Part1)*CFrame.new(0,0,-magz2/2) else li.CFrame = CFrame.new(curpos,trolpos)*CFrame.new(0,0,magz/Times/2) end curpos = li.CFrame*CFrame.new(0,0,magz/Times/2).p game.Debris:AddItem(li,.1) end end BodyParts = {} -- Parts to emit lightning effects from for _, v in pairs(char:GetChildren()) do if v:IsA("Part") then table.insert(BodyParts, v) end end Bounding = {} -- Calculate the bounding boxes for _, v in pairs(BodyParts) do local temp = {X=nil, Y=nil, Z=nil} temp.X = v.Size.X/2 * 10 temp.Y = v.Size.Y/2 * 10 temp.Z = v.Size.Z/2 * 10 Bounding[v.Name] = temp --table.insert(Bounding, v.Name, temp) end while wait(math.random(1,10)/10) do -- Emit the Lightning effects randomly local Body1 = BodyParts[math.random(#BodyParts)] local Body2 = BodyParts[math.random(#BodyParts)] local Pos1 = Vector3.new( math.random(-Bounding[Body1.Name].X, Bounding[Body1.Name].X)/10, math.random(-Bounding[Body1.Name].Y, Bounding[Body1.Name].Y)/10, math.random(-Bounding[Body1.Name].Z, Bounding[Body1.Name].Z)/10 ) local Pos2 = Vector3.new( math.random(-Bounding[Body2.Name].X, Bounding[Body2.Name].X)/10, math.random(-Bounding[Body2.Name].Y, Bounding[Body2.Name].Y)/10, math.random(-Bounding[Body2.Name].Z, Bounding[Body2.Name].Z)/10 ) local SPos1 = Body1.Position + Pos1 local SPos2 = Body2.Position + Pos2 Lightning(SPos1, SPos2, 4, 3, "Bright blue", .3, .56) end wait(0) else run.Text = "Wrong Passcode" wait(2) run.Text = "RUN" end end run.MouseButton1Click:connect(onClicked)
local m = {} function m.table_slice(tbl, first, last, step) local sliced = {} for i = first or 1, last or #tbl, step or 1 do sliced[#sliced+1] = tbl[i] end return sliced end function m.string_to_byte_array (str) local arr = {} for i = 1, #str do table.insert(arr, string.byte(str, i, i)) end return arr end function m.byte_array_to_string (arr) local str = '' for i = 1, #arr do str = str .. string.char(arr[i]) end return str end local char_to_hex = function(c) return string.format("%%%02X", string.byte(c)) end function m.urlencode (url) if url == nil then return end url = url:gsub("\n", "\r\n") url = url:gsub("([^%w ])", char_to_hex) url = url:gsub(" ", "+") return url end return m
local PLUGIN = PLUGIN local PLUGIN = PLUGIN PLUGIN.name = "Utility Menu" PLUGIN.author = "Subleader" PLUGIN.desc = "A menu that can be opened by pressing F1, compatible with the plugin Enhanced Description." ix.util.Include("sv_plugin.lua")
local Background = {} function Background:new(layer, context) local newBack = {}; -- set meta tables so lookups will work setmetatable(newBack, self); self.__index = self; local uiConst = context.uiConst; --[[ local bounds = context.displayBounds; local rect = display.newRect(layer, bounds.centerX , bounds.centerY, bounds.width, bounds.height); rect.fill = { type = "gradient", color1 = uiConst.backgroundBottomColor, color2 = uiConst.backgroundTopColor, direction = "up" } ]] self:fromColorArray(layer, context, --{uiConst.backgroundTopColor,{0.2,0.5,0.1},{0.55,0.4,0.65}, uiConst.backgroundBottomColor} --{uiConst.backgroundTopColor, uiConst.backgroundBottomColor} --{{0.909,0.538,0.199},{0.72,0.591,0.206},{0.307, 0.641,0.758},{0.118,0.32,0.391},{0.118,0.32,0.39}} --{{0.85,0.497,0.127},{0.476,0.574,0.412},{0.093,0.478,0.611}} --{{0.85,0.497,0.127},{0.412,0.573,0.536},{0.093,0.478,0.611}} --{uiConst.backgroundTopColor,{0.412,0.573,0.536},{0.093,0.478,0.611}} --{{0.851,0.531,0.129},{0.412,0.573,0.536},{0.093,0.478,0.611}} --{{0.851,0.531,0.129},{0.412,0.573,0.536},uiConst.backgroundBottomColor} --{uiConst.backgroundTopColor,{0.412,0.573,0.536},{0.093,0.478,0.611}} {uiConst.backgroundTopColor,{0.412,0.573,0.536},uiConst.backgroundBottomColor} --{{0.851,0.531,0.129},uiConst.backgroundBottomColor} ) --newBack.backRect = rect; --rect.fill.effect = "filter.vignette"; --rect.fill.effect.radius = 0.8; --newBack:addBackscape(layer, context) return newBack; end function Background:fromColorArray(layer, context, colors) local bounds = context.displayBounds; local numOfsegments = #colors-1; local segmentH = math.floor(bounds.height / numOfsegments); local mod = bounds.height-segmentH*numOfsegments; local cy = bounds.minY + segmentH*0.5; --print("mod:" .. mod) for i=1,numOfsegments do local rect = display.newRect(layer, bounds.centerX , cy, bounds.width, segmentH); rect.fill = { type = "gradient", color1 = colors[i], color2 = colors[i+1], direction = "down" } cy = cy + segmentH; end end --[[ function Background:addBackscape(layer, context) local bounds = context.displayBounds; local uiConst = context.uiConst; local mask = graphics.newMask("img/comm/mm_stripes_mask.png") local maskSize = 64; local c = uiConst.backgroundTopColor; local o = 0.6; local gradient= { type = "gradient", color1 = uiConst.backgroundBottomColor, color2 = {c[1]*o, c[2]*o,c[3]*o}, direction = "up" } local x,y = bounds.minX+bounds.width*0.15, bounds.minY+bounds.height*0.1; local h,w = bounds.height*0.5, bounds.width*0.55; local m1 = display.newPolygon(layer, x,y+0.5*h, {0,0,w*0.5,h,-0.5*w,h}); m1.fill = gradient; m1:setMask(mask); m1.maskScaleX = w/maskSize; m1.maskScaleY = h/maskSize; m1.blendMode = "multiply" local cic = display.newCircle(layer, x, y, 5) cic:setFillColor(0.9,0.1,0.1); cic.alpha = 0.5; end ]] return Background;
-- required libs require 'parallel' require 'torch' -- calibration code: function calib() require 'torch' require 'sys' s = torch.Tensor(100000):fill(1) d = torch.Tensor(100000):fill(0) parallel.yield() sys.tic() for i = 1,10000 do d:add(13,s) end time = sys.toc() parallel.parent:send(time) end -- parent code: function parent() for i = 1,2 do -- for 4 processes parallel.sfork(4) -- verify creation parallel.print('currently have ' .. parallel.nchildren .. ' children') -- exec code parallel.children:exec(calib) -- trigger computations parallel.children:join() -- receive results times = parallel.children:receive() for i,time in pairs(times) do print('time taken by process ' .. i .. ': ' .. time) end -- sync processes (wait for them to die) parallel.children:sync() -- end status parallel.print('currently have ' .. parallel.nchildren .. ' children') end end -- protected execution: ok,err = pcall(parent) if not ok then print(err) end parallel.close()