content
stringlengths 5
1.05M
|
|---|
blacklistedModels = { -- Vehicles which doesn't need fuel
"BMX",
"CRUISER",
"TRIBIKE2",
"FIXTER",
"SCORCHER",
"TRIBIKE3",
"TRIBIKE",
"POLMAV",
"AMBULANCE",
"BENSON",
}
electric_model = {
"VOLTIC",
"SURGE",
"DILETTANTE",
"KHAMELION",
"CADDY",
"CADDY2",
"AIRTUG",
"CYCLONE"
}
plane_model = {
"BESRA",
"CARGOPLANE",
"CUBAN800",
"DODO",
"DUSTER",
"HYDRA",
"JET",
"LUXOR",
"LUXOR2",
"STUNT",
"MAMMATUS",
"MILJET",
"NIMBUS",
"LAZER",
"SHAMAL",
"TITAN",
"VELUM",
"VELUM2",
"VESTRA"
}
heli_model = {
"ANNIHILATOR",
"BUZZARD",
"BUZZARD2",
"CARGOBOB",
"CARGOBOB2",
"CARGOBOB3",
"FROGGER",
"FROGGER2",
"MAVERICK",
"SAVAGE",
"SKYLIFT",
"SVOLITO",
"SVOLITO2",
"SWIFT",
"SWIFT2",
"VALKYRIE",
"VALKYRIE2",
"VOLATUS"
}
|
-- luaannotate.lua
-- (C) 2010, David Manura
-- Load annotations file.
local function load_annotations(path)
local filename = path:match'[^\\/]+$'
if not filename then
error('Invalid path ' .. path)
end
local annotations = {}
local id
local text = ''
local function commit()
if id then
--print('DEBUG-luacomment-commit', id, text)
text = text:gsub('[\r\n]$', '')
annotations[id] = text
end
end
-- Process line-by-line.
local fh = assert(io.open(path))
local linenum = 1
for line in fh:lines() do
if line:match'^#' then
commit()
local sfile, sname = line:match'^#%s*([^:]+):([%w_]*)'
if not sfile then
error('Invalid directive in ' .. path .. ':' .. linenum)
end
text = ''
id = sfile .. ':' .. sname
else
text = text .. (text ~= '' and '\n' or '') .. line
end
linenum = linenum + 1
end
commit()
return annotations
end
-- Locates where annotations should go in source string `code`
-- in file path `path`.
local function place_annotations(code, path, annotations)
local sfile = path:match'[^\\/]+$'
local notes = {}
-- Comments on functions/macros/structs
-- TODO: could be improved (robustness)
local iline = 1
for line in (code .. '\n'):gmatch'(.-)\r?\n' do
local sname =
line:match'^[%w_ ]-[%w_*]+%s([%w_]+)%s*%b()%s*%{?$' or
line:match'^#define%s+([%w_]+)' or
line:match'^typedef%s+struct%s+([%w_]+)' or
line:match'^typedef%s+union%s+([%w_]+)' or
line:match'^typedef%s+.*%s+([%w_]+);'
if sname then
local id = sfile .. ':' .. sname
local comment = annotations[id]
--print('DEBUG-luacomment-comment', comment, id)
if comment then
table.insert(notes, {iline, comment})
end
end
iline = iline + 1
end
-- Comments on file.
local filecomment = annotations[sfile .. ':']
if filecomment then
if notes[1] and notes[1][1] == 1 then -- existing comment on line 1
local comment = filecomment .. '\n\n' .. notes[1][2]
notes[1][2] = comment
else
table.insert(notes, 1, {1, filecomment})
end
end
return notes
end
-- Utility function to check whether file exists (actually, is readable).
local function exists_file(path)
local fh = io.open(path)
if fh then fh:close() return true end
return false
end
-- Utility function to load file into string (text mode).
local function read_file(path)
local fh, err = io.open(path)
if not fh then
error('Could not open ' .. path .. ' : ' .. err)
end
local data = fh:read'*a'
fh:close()
return data
end
-- SciTE specific
if scite_OnOpen then -- if ExtMan installed
-- Add annotation notes to SciTE buffer.
local function scite_annotate_buffer(notes)
editor.AnnotationVisible = 2
for _, note in ipairs(notes) do
local iline, comment = unpack(note)
editor:AnnotationSetText(iline-1, comment)
--editor:AnnotationStyle[iline] = 1
end
end
-- SciTE ExtMan callback function, on file opened.
scite_OnOpen(function(path)
local annotations_path = path:gsub('[^\\/]+$', 'annotations.txt')
print('DEBUG-luacomment-open', path, annotations_path)
if exists_file(annotations_path) then
local code = editor:GetText()
local annotations = load_annotations(annotations_path)
local notes = place_annotations(code, path, annotations)
scite_annotate_buffer(notes)
end
end)
return
end
-- Escapes characters in text to allow embedding inside C comment (/* */).
local function cpp_escape_comment(text)
text = text:gsub('%*/', '* /')
return text
end
-- Adds annotations to code.
local function cpp_annotate(code, notes)
local commentofline = {} -- index
for _, linecomment in ipairs(notes) do
local iline, comment = unpack(linecomment)
commentofline[iline] = comment
end
-- TODO: could be improved: avoid nested comments
local iline = 1
code = (code .. '\n'):gsub('(.-\r?\n)', function(line)
if commentofline[iline] then
line = '/*# ' .. cpp_escape_comment(commentofline[iline]) .. '*/\n' .. line
end
iline = iline + 1
return line
end)
return code
end
-- Command-line usage: lua luacomment.lua <filename>
local path = ...
if path then
local annotations_path = path:gsub('[^\\/]+$', 'annotations.txt')
local code = read_file(path)
local annotations = load_annotations(annotations_path)
local notes = place_annotations(code, path, annotations)
code = cpp_annotate(code, notes)
io.stdout:write(code)
else
io.stderr:write('usage: luaannotate.lua <filename>')
os.exit(1)
end
|
function love.conf(t)
t.window.width = 960
t.window.width = 1024
t.window.height = 720
t.gammacorrect = true
t.window.highdpi = false
end
|
local lu = require('luaunit')
local CoroutineScheduler = require("jls.util.CoroutineScheduler")
function Test_schedule()
local v = 0
local scheduler = CoroutineScheduler:new()
scheduler:schedule(function ()
for i = 1, 3 do
v = v + 1
coroutine.yield(-1)
end
end, false)
scheduler:run()
lu.assertEquals(v, 3)
end
function Test_schedule_daemon()
local v = 0
local vd = 0
local scheduler = CoroutineScheduler:new()
scheduler:schedule(function ()
for i = 1, 3 do
v = v + 1
coroutine.yield(-1)
end
end, false)
scheduler:schedule(function ()
while true do
vd = vd + 1
coroutine.yield(-1)
end
end, true)
scheduler:run()
lu.assertEquals(v, 3)
lu.assertEquals(vd, 3)
end
os.exit(lu.LuaUnit.run())
|
data:extend(
{
{
type = "item",
name = "oxidizer",
icon = "__LaNMod__/graphics/icons/oxidizer.png",
icon_size = 32,
fuel_category = "chemical",
fuel_value = "6MJ",
fuel_acceleration_multiplier = 3.0,
fuel_top_speed_multiplier = 0.2,
fuel_emissions_multiplier = 30.0,
fuel_glow_color = {r = 1.0, g = 0.8, b = 0.6, 1.},
subgroup = "raw-material",
order = "c[solid-fuel]",
stack_size = 50
}
})
|
-------------------------------------------------------------------------------
--- AUTHOR: Nostrademous
--- GITHUB REPO: https://github.com/pydota2
-------------------------------------------------------------------------------
local BotInfo = {}
--------------------------------------------------------
function BotInfo:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
--[[
function BotInfo:Init()
end
--]]
--------------------------------------------------------
return BotInfo
|
local m_reactions={}
local m_configForm = nil
local m_template = nil
local m_searchAllTree = nil
local m_currAllList = {}
local m_subscribedUnits = {}
local m_secondsCnt = 0
local m_wasSomeChangesToSave = false
function AddReaction(name, func)
if not m_reactions then m_reactions={} end
m_reactions[name]=func
end
function RunReaction(widget)
local name=getName(widget)
if name == "GetModeBtn" then
name=getName(getParent(widget))
end
if not name or not m_reactions or not m_reactions[name] then return end
m_reactions[name](widget)
end
function ButtonPressed(aParams)
changeCheckBox(aParams.widget)
RunReaction(aParams.widget)
end
function RightClick(params)
end
function ChangeMainWndVisible()
if isVisible(m_configForm) then
hide(m_configForm)
else
UpdatePressed()
show(m_configForm)
end
collectgarbage()
end
local function GetTimestamp()
return common.GetMsFromDateTime( common.GetLocalDateTime() )
end
function AddBuffToEncylopedia(aBuffInfo, aNeedSaveOnChanges)
if aBuffInfo and aBuffInfo.name and not common.IsEmptyWString(aBuffInfo.name) then
local myInfo = {}
myInfo.name = aBuffInfo.name
myInfo.buffs = {}
local buffResourceAlreadyAdded = false
local addRes = m_searchAllTree:add(myInfo)
if not addRes then
for _, buff in pairs(myInfo.buffs) do
if buff.buffId:IsEqual(aBuffInfo.buffId) then
buffResourceAlreadyAdded = true
break
end
end
end
if not buffResourceAlreadyAdded then
local unicBuff = {}
unicBuff.isCleanable = IsCleanable(aBuffInfo)
unicBuff.isControls = IsControls(aBuffInfo)
unicBuff.isPositive = aBuffInfo.isPositive
unicBuff.isNeedVisualize = aBuffInfo.isNeedVisualize
unicBuff.isStackable = aBuffInfo.isStackable
unicBuff.isGradual = aBuffInfo.isGradual
unicBuff.producerType = aBuffInfo.producerType or GetProducerType(aBuffInfo)
unicBuff.description = aBuffInfo.description
unicBuff.texture = aBuffInfo.texture
unicBuff.buffId = aBuffInfo.buffId
table.insert(myInfo.buffs, unicBuff)
if aNeedSaveOnChanges then
m_wasSomeChangesToSave = true
end
end
end
end
function CheckAllUnits()
local unitList = avatar.GetUnitList()
table.insert(unitList, avatar.GetId())
for _, objID in pairs(unitList) do
if objID then
local unitParams = {}
unitParams.objectId = objID
m_subscribedUnits[unitParams.objectId] = unitParams
common.RegisterEventHandler(OnBuffAdded, 'EVENT_OBJECT_BUFF_ADDED', unitParams)
local buffs = object.GetBuffs(objID)
if next(buffs) then
local buffsInfo = object.GetBuffsInfo(buffs)
for _, buffInfo in pairs( buffsInfo or {} ) do
AddBuffToEncylopedia(buffInfo, true)
end
end
end
end
end
function OnBuffAdded(aParams)
AddBuffToEncylopedia(object.GetBuffInfo(aParams.buffId), true)
end
function OnUnitChanged(aParams)
for i=0, GetTableSize(aParams.spawned)-1 do
if aParams.spawned[i] and not m_subscribedUnits[aParams.spawned[i]] then
local unitParams = {}
unitParams.objectId = aParams.spawned[i]
m_subscribedUnits[unitParams.objectId] = unitParams
common.RegisterEventHandler(OnBuffAdded, 'EVENT_OBJECT_BUFF_ADDED', unitParams)
end
end
for i=0, GetTableSize(aParams.despawned)-1 do
if aParams.despawned[i] and m_subscribedUnits[aParams.despawned[i]] then
common.UnRegisterEventHandler(OnBuffAdded, 'EVENT_OBJECT_BUFF_ADDED', m_subscribedUnits[aParams.despawned[i]])
m_subscribedUnits[aParams.despawned[i]] = nil
end
end
end
function OnEventSecondTimer()
local unitList = avatar.GetUnitList()
table.insert(unitList, avatar.GetId())
for id, _ in pairs(m_subscribedUnits) do
local reallyExist = false
for _, objID in pairs(unitList) do
if objID == id then
reallyExist = true
break
end
end
if not reallyExist then
common.UnRegisterEventHandler(OnBuffAdded, 'EVENT_OBJECT_BUFF_ADDED', m_subscribedUnits[id])
m_subscribedUnits[id] = nil
end
end
m_secondsCnt = m_secondsCnt + 1
if m_secondsCnt > 20 then
m_secondsCnt = 0
if m_wasSomeChangesToSave then
SavePressed()
end
end
end
function GetProducerType(aBuffInfo)
return isExist(aBuffInfo.producer.casterId) and object.IsUnit(aBuffInfo.producer.casterId) and unit.IsPlayer(aBuffInfo.producer.casterId) and PLAYER_PRODUCER
or isExist(aBuffInfo.producer.casterId) and UNIT_PRODUCER
or aBuffInfo.producer.spellId and SPELL_PRODUCER
or aBuffInfo.producer.abilityId and ABILITY_PRODUCER
or aBuffInfo.producer.buffId and BUFF_PRODUCER
or UNKNOWN_PRODUCER
end
function IsControls(aBuffInfo)
local isControls = false
for _, groupName in pairs(aBuffInfo.groups) do
if groupName == "controls" or
groupName == "stuns" or
groupName == "Disarms" or
groupName == "fears"
then
isControls = true
break
end
end
return isControls
end
function IsCleanable(aBuffInfo)
local isCleanable = false
for _, groupName in pairs(aBuffInfo.groups) do
if groupName == "magics" or
groupName == "stackablemagics"
then
isCleanable = true
break
end
end
return isCleanable
end
function SavePressed()
local settings = GetCurrentSettings()
settings.db = {}
for record in m_searchAllTree:iterate() do
for _, buffInfo in pairs(record.buffs) do
local simpleInfo = {}
simpleInfo.producerType = buffInfo.producerType
simpleInfo.buffId = buffInfo.buffId
table.insert(settings.db, simpleInfo)
end
end
SaveSettings()
end
function LoadFormSettings()
m_searchAllTree = GetAVLWStrTree()
LoadSettings()
local settings = GetCurrentSettings()
for _, simpleInfo in pairs(settings.db) do
local info = object.GetBuffInfo(simpleInfo.buffId)
if info then
info.producerType = simpleInfo.producerType
AddBuffToEncylopedia(info, false)
end
end
CheckAllUnits()
end
function UpdatePressed()
m_currAllList = {}
for record in m_searchAllTree:iterate() do
for _, buffInfo in pairs(record.buffs) do
buffInfo.name = record.name
buffInfo.nameStr = toLowerString(record.name)
table.insert(m_currAllList, buffInfo)
end
end
SetScrollList(m_configForm, m_currAllList)
end
function ShowBuffInfoPressed(aWdg)
local index = GetIndexForWidget(aWdg) + 1
local buffInfoForm = InitBuffInfoForm()
SetBuffInfoFormSetting(buffInfoForm, GetSearchScrollList(), index)
show(buffInfoForm)
end
function EditLineChanged()
ChangedFilter()
end
function ChangedFilter()
local cleanable, nocleanable, negative, positive = GetFilters(m_configForm)
local filtredBuffs = {}
for _, buffInfo in pairs(m_currAllList) do
if (cleanable and buffInfo.isCleanable
or nocleanable and not buffInfo.isCleanable)
and (negative and not buffInfo.isPositive
or positive and buffInfo.isPositive)
then
table.insert(filtredBuffs, buffInfo)
end
end
local findedBuffs = {}
local currText = string.lower(getTextString(getChild(m_configForm, "searchEdit")))
if currText ~= "" then
for _, buffInfo in pairs(filtredBuffs) do
local res = string.find(buffInfo.nameStr, currText)
if res then
table.insert(findedBuffs, buffInfo)
end
end
SetScrollList(m_configForm, findedBuffs)
else
SetScrollList(m_configForm, filtredBuffs)
end
end
function OnSlashCommand(aParams)
if userMods.FromWString(aParams.text) == "/bereset1" or userMods.FromWString(aParams.text) == "\\bereset1" then
move(getChild(mainForm, "BEButton"), 300, 120)
end
if userMods.FromWString(aParams.text) == "/bereset2" or userMods.FromWString(aParams.text) == "\\bereset2" then
SaveDefaultSettings()
common.StateUnloadManagedAddon( "UserAddon/BuffEncyclopedia" )
common.StateLoadManagedAddon( "UserAddon/BuffEncyclopedia" )
end
end
function Init()
m_template = createWidget(nil, "Template", "Template")
setTemplateWidget(m_template)
local button=createWidget(mainForm, "BEButton", "Button", WIDGET_ALIGN_LOW, WIDGET_ALIGN_LOW, 25, 25, 300, 120)
setText(button, "BE")
DnD:Init(button, button, true)
m_configForm = InitSearchForm()
LoadFormSettings()
common.RegisterReactionHandler( RightClick, "RIGHT_CLICK" )
common.RegisterReactionHandler(ButtonPressed, "execute")
common.RegisterReactionHandler(EditLineChanged, "editLineChanged")
common.RegisterEventHandler(OnUnitChanged, "EVENT_UNITS_CHANGED")
--по таймеру проверять валидность списка подписанных
common.RegisterEventHandler(OnEventSecondTimer, "EVENT_SECOND_TIMER")
common.RegisterEventHandler( OnSlashCommand, "EVENT_UNKNOWN_SLASH_COMMAND" )
AddReaction("BEButton", function () ChangeMainWndVisible() end)
AddReaction("closeMainButton", function (aWdg) ChangeMainWndVisible() end)
AddReaction("closeButton", function (aWdg) swap(getParent(aWdg)) end)
AddReaction("closeBuffButton", function (aWdg) swap(getParent(aWdg)) end)
AddReaction("scrollBtncontainerBuffs", ShowBuffInfoPressed)
AddReaction("showCleanable", ChangedFilter)
AddReaction("showNoCleanable", ChangedFilter)
AddReaction("showNegative", ChangedFilter)
AddReaction("showPositive", ChangedFilter)
AoPanelSupportInit()
end
if (avatar.IsExist()) then
Init()
else
common.RegisterEventHandler(Init, "EVENT_AVATAR_CREATED")
end
|
function loadPaths()
node_x,node_y,node_z = {},{},{}
node_rx,node_ry = {},{}
node_conns = {}
node_lanes = {left = {},right = {}}
conn_n1,conn_n2,conn_nb = {},{},{}
conn_type,conn_light1,conn_light2,conn_maxspeed = {},{},{},{}
conn_lanes,conn_density = {left = {},right = {}},{}
conn_lanepos = {left = {},right = {}}
conn_forbidden = {}
local starttime = getTickCount()
local maplist = getPathMapList()
for mapnum,mapname in ipairs(maplist) do
local starttime = getTickCount()
if loadPathMapFile(mapname) then
outputServerLog("Loaded path map "..mapname.." in "..getTickCount()-starttime.." ms")
end
end
outputServerLog("Loaded all path maps in "..getTickCount()-starttime.." ms")
end
function getPathMapList()
local maps = {}
local maplist = xmlLoadFile("paths/maplist.xml")
if not maplist then
outputDebugString("Failed to open path maps list: paths/maplist.xml",2)
return
end
local mapnodes = xmlNodeGetChildren(maplist)
for mapnum,mapnode in ipairs(mapnodes) do
local filename = xmlNodeGetAttribute(mapnode,"src")
if filename then
filename = "paths/maps/"..filename
if fileExists(filename) then
table.insert(maps,filename)
else
outputDebugString("Map file "..filename.." does not exist",2)
end
else
outputDebugString("Failed to read file path of map "..mapnum,2)
end
end
xmlUnloadFile(maplist)
return maps
end
function loadPathMapFile(filename)
local file = fileOpen(filename,true)
if not file then
outputDebugString("Failed to open path map file: "..filename,2)
return
end
local header_bytes = fileRead(file,12)
if #header_bytes ~= 12 then
outputDebugString("Failed to read the header of path map file: "..filename,2)
fileClose(file)
return
end
local node_ids,conn_ids = {},{}
local nodecount,conncount,forbcount = bytesToData("3i",header_bytes)
for nodenum = 1,nodecount do
local node_bytes = fileRead(file,16)
if #node_bytes ~= 16 then
outputDebugString("Failed to read all nodes from path map file: "..filename,2)
fileClose(file)
return
end
local new_id = #node_z+1
node_ids[nodenum] = new_id
local x,y,z,rx,ry = bytesToData("3i2s",node_bytes)
node_x[new_id],node_y[new_id],node_z[new_id] = x/1000,y/1000,z/1000
node_rx[new_id],node_ry[new_id] = rx/1000,ry/1000
node_conns[new_id] = {}
checkThreadYieldTime()
end
for connnum = 1,conncount do
local conn_bytes = fileRead(file,20)
if #conn_bytes ~= 20 then
outputDebugString("Failed to read all connections from path map file: "..filename,2)
fileClose(file)
return
end
local new_id = #conn_type+1
conn_ids[connnum] = new_id
local n1,n2,nb,trtype,lit,speed,ll,rl,density = bytesToData("3i2ubus2ubus",conn_bytes)
local lit1,lit2 = lit%4,math.floor(lit/4)
n1,n2 = node_ids[n1],node_ids[n2]
conn_n1[new_id],conn_n2[new_id] = n1,n2
conn_nb[new_id] = nb ~= -1 and node_ids[nb] or nil
conn_type[new_id] = trtype == 1 and "peds" or trtype == 2 and "cars" or trtype == 3 and "boats" or trtype == 4 and "planes"
conn_light1[new_id] = lit1 == 1 and "NS" or lit1 == 2 and "WE" or lit1 == 3 and "ped" or nil
conn_light2[new_id] = lit2 == 1 and "NS" or lit2 == 2 and "WE" or lit2 == 3 and "ped" or nil
conn_maxspeed[new_id] = speed/10
conn_lanes.left[new_id],conn_lanes.right[new_id] = ll,rl
conn_density[new_id] = density/1000
conn_forbidden[new_id] = {}
if rl ~= 0 or ll == 0 then node_conns[n1][n2] = new_id end
if ll ~= 0 or rl == 0 then node_conns[n2][n1] = new_id end
addConnToTrafficMap(new_id)
checkThreadYieldTime()
end
for forbnum = 1,forbcount do
local forb_bytes = fileRead(file,8)
if #forb_bytes ~= 8 then
outputDebugString("Failed to read all forbidden connection sequences from path map file: "..filename,2)
fileClose(file)
return
end
local c1,c2 = bytesToData("2i",forb_bytes)
conn_forbidden[conn_ids[c1]][conn_ids[c2]] = true
checkThreadYieldTime()
end
fileClose(file)
return true
end
|
local player = game.Players.LocalPlayer
local FUNTAIN = workspace.Levels.Forest.SpawnPoint
local LEVEL = player.Level.Value
while wait() do
if player.Character then
player.Character.Humanoid.WalkSpeed = 40
for i,v in pairs(workspace.Levels[LEVEL].Enemies:GetChildren()) do
if v.ClassName == "Model" and v:FindFirstChild("HumanoidRootPart") and (player.Character.HumanoidRootPart.Position-v.HumanoidRootPart.Position).Magnitude < 50 then
game:GetService("ReplicatedStorage").Remote.CastSpell:FireServer(1, v)
game:GetService("ReplicatedStorage").Remote.CastSpell:FireServer(2, v)
FUNTAIN.CFrame=player.Character.HumanoidRootPart.CFrame+Vector3.new(0,0,0)
end
end
for i,v in pairs(workspace.BossArenas:GetDescendants()) do
if v.ClassName == "Model" and v:FindFirstChild("HumanoidRootPart") then
game:GetService("ReplicatedStorage").Remote.CastSpell:FireServer(1, v)
game:GetService("ReplicatedStorage").Remote.CastSpell:FireServer(2, v)
FUNTAIN.CFrame=player.Character.HumanoidRootPart.CFrame+Vector3.new(0,0,0)
end
end
end
end
|
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
local Clockwork = Clockwork;
local COMMAND = Clockwork.command:New("StorageTakeItem");
COMMAND.tip = "CmdStorageTakeItem";
COMMAND.text = "CmdStorageTakeItemDesc";
COMMAND.flags = CMD_DEFAULT;
COMMAND.arguments = 2;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
local storageTable = player:GetStorageTable();
local uniqueID = arguments[1];
local itemID = tonumber(arguments[2]);
if (storageTable and (!storageTable.entity or IsValid(storageTable.entity))) then
local itemTable = Clockwork.inventory:FindItemByID(
storageTable.inventory, uniqueID, itemID
);
if (!itemTable) then
Clockwork.player:Notify(player, {"StorageHasNoInstance"});
return;
end;
Clockwork.storage:TakeFrom(player, itemTable);
else
Clockwork.player:Notify(player, {"YouHaveNoStorageOpen"});
end;
end;
COMMAND:Register();
|
--[[
© 2013 CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode
--]]
local COMMAND = Clockwork.command:New("statusdisable");
COMMAND.tip = "Disable your 'Status'";
COMMAND.flags = CMD_DEFAULT;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
player:SetNWBool("statusenabled", false)
Clockwork.player:Notify(player, "Disabled your status");
end;
COMMAND:Register();
|
return {
{
ID = 11037920, --ID
Description = "测试", --字符串
TestNest1 =
{
1, --注释1
1, --注释2
},
TestNest2 =
{
"1", --注释3
--Key代表注释4
{
[1] =
1, --注释5
},
},
TestNest3 =
--Key代表注释6
{
["1"] =
{
NestEle2 = 1, --注释7
NestEle3 =
{
1, --注释8
1, --注释9
},
},
},
TestNest4 =
--Key代表注释10
{
["1"] =
{
NestEle2 = 1, --注释11
NestEle3 = 1, --注释12
},
},
},
{
ID = 11037999, --ID
Description = {"\"测试1\"", "\"测试2\""},--字符串
TestNest1 =
{
2, --注释1
2, --注释2
},
TestNest2 =
{
"2", --注释3
--Key代表注释4
{
[2] =
2, --注释5
},
},
TestNest3 =
--Key代表注释6
{
["2"] =
{
NestEle2 = 2, --注释7
NestEle3 =
{
2, --注释8
2, --注释9
},
},
},
TestNest4 =
--Key代表注释10
{
["2"] =
{
NestEle2 = 2, --注释11
NestEle3 = 2, --注释12
},
},
},
{
ID = 11038000, --ID
TestNest2 =
{
--Key代表注释4
{
[3] =
3, --注释5
},
},
TestNest3 =
--Key代表注释6
{
["3"] =
{
NestEle2 = 3, --注释7
NestEle3 =
{
3, --注释8
3, --注释9
},
},
},
TestNest4 =
--Key代表注释10
{
["3"] =
{
NestEle2 = 3, --注释11
NestEle3 = 3, --注释12
},
},
},
{
ID = 11038001, --ID
Description = "测试\"字符串\"", --字符串
TestNest1 =
{
4, --注释1
4, --注释2
},
TestNest2 =
{
"4", --注释3
--Key代表注释4
{
[4] =
4, --注释5
},
},
TestNest3 =
--Key代表注释6
{
["4"] =
{
NestEle2 = 4, --注释7
NestEle3 =
{
4, --注释8
4, --注释9
},
},
},
TestNest4 =
--Key代表注释10
{
["4"] =
{
NestEle2 = 4, --注释11
NestEle3 = 4, --注释12
},
},
},
{
ID = 11038002, --ID
Description = "测试“字符串”", --字符串
TestNest1 =
{
5, --注释1
5, --注释2
},
TestNest2 =
{
"5", --注释3
--Key代表注释4
{
[5] =
5, --注释5
},
},
TestNest3 =
--Key代表注释6
{
["5"] =
{
NestEle2 = 5, --注释7
NestEle3 =
{
5, --注释8
5, --注释9
},
},
},
TestNest4 =
--Key代表注释10
{
["5"] =
{
NestEle2 = 5, --注释11
NestEle3 = 5, --注释12
},
},
},
}
|
ys = ys or {}
slot1 = class("BattleSkillEditTag", ys.Battle.BattleSkillEffect)
ys.Battle.BattleSkillEditTag = slot1
slot1.__name = "BattleSkillEditTag"
slot1.TAG_OPERATION_APPEND = 1
slot1.TAG_OPERATION_REMOVE = -1
slot1.Ctor = function (slot0, slot1, slot2)
slot0.super.Ctor(slot0, slot1, slot2)
slot0._tag = slot0._tempData.arg_list.tag
slot0._op = slot0._tempData.arg_list.operation
end
slot1.DoDataEffect = function (slot0, slot1, slot2)
if slot0._op == slot0.TAG_OPERATION_APPEND then
slot2:AddLabelTag(slot0._tag)
elseif slot0._op == slot0.TAG_OPERATION_REMOVE then
slot2:RemoveLabelTag(slot0._tag)
end
end
return
|
function getRequiredComponents()
return {players = {"deformation"}}
end
function update()
if next(players) == nil then
-- no player anmyore
if game.input:isKeyDown("r") then
game.core:resetScene()
end
end
end
|
CurrentWeather = Config.StartWeather
local baseTime = Config.BaseTime
local timeOffset = Config.TimeOffset
local freezeTime = Config.FreezeTime
local blackout = Config.Blackout
local newWeatherTimer = Config.NewWeatherTimer
RegisterServerEvent('qb-weathersync:server:RequestStateSync')
AddEventHandler('qb-weathersync:server:RequestStateSync', function()
TriggerClientEvent('qb-weathersync:client:SyncWeather', -1, CurrentWeather, blackout)
TriggerClientEvent('qb-weathersync:client:SyncTime', -1, baseTime, timeOffset, freezeTime)
end)
RegisterServerEvent('qb-weathersync:server:RequestCommands')
AddEventHandler('qb-weathersync:server:RequestCommands', function()
local src = source
if isAllowedToChange(src) then
TriggerClientEvent('qb-weathersync:client:RequestCommands', src, true)
end
end)
RegisterServerEvent('qb-weathersync:server:setWeather')
AddEventHandler('qb-weathersync:server:setWeather', function(weather)
local validWeatherType = false
for i,wtype in ipairs(Config.AvailableWeatherTypes) do
if wtype == string.upper(weather) then
validWeatherType = true
end
end
if validWeatherType then
print(_U('weather_updated'))
CurrentWeather = string.upper(weather)
newWeatherTimer = Config.NewWeatherTimer
TriggerEvent('qb-weathersync:server:RequestStateSync')
else
print(_U('weather_invalid'))
end
end)
RegisterServerEvent('qb-weathersync:server:setTime')
AddEventHandler('qb-weathersync:server:setTime', function(hour, minute)
if hour ~= nil and minute ~= nil then
local argh = tonumber(hour)
local argm = tonumber(minute)
if argh < 24 then
ShiftToHour(argh)
else
ShiftToHour(0)
end
if argm < 60 then
ShiftToMinute(argm)
else
ShiftToMinute(0)
end
print(_U('time_change', argh, argm))
TriggerEvent('qb-weathersync:server:RequestStateSync')
else
print(_U('time_invalid'))
end
end)
function isAllowedToChange(player)
if QBCore.Functions.HasPermission(player, "admin") then
return true
else
return false
end
end
RegisterServerEvent('qb-weathersync:server:toggleBlackout')
AddEventHandler('qb-weathersync:server:toggleBlackout', function()
blackout = not blackout
TriggerEvent('qb-weathersync:server:RequestStateSync')
end)
RegisterCommand('freezetime', function(source, args)
if source ~= 0 then
if isAllowedToChange(source) then
freezeTime = not freezeTime
if freezeTime then
TriggerClientEvent('QBCore:Notify', source, _U('time_frozenc'))
else
TriggerClientEvent('QBCore:Notify', source, _U('time_unfrozenc'))
end
else
TriggerClientEvent('QBCore:Notify', source, _U('not_allowed'), 'error')
end
else
freezeTime = not freezeTime
if freezeTime then
print(_U('time_now_frozen'))
else
print(_U('time_now_unfrozen'))
end
end
end)
RegisterCommand('freezeweather', function(source, args)
if source ~= 0 then
if isAllowedToChange(source) then
Config.DynamicWeather = not Config.DynamicWeather
if not Config.DynamicWeather then
TriggerClientEvent('QBCore:Notify', source, _U('dynamic_weather_disabled'))
else
TriggerClientEvent('QBCore:Notify', source, _U('dynamic_weather_enabled'))
end
else
TriggerClientEvent('QBCore:Notify', source, _U('not_allowed'), 'error')
end
else
Config.DynamicWeather = not Config.DynamicWeather
if not Config.DynamicWeather then
print(_U('weather_now_frozen'))
else
print(_U('weather_now_unfrozen'))
end
end
end)
RegisterCommand('weather', function(source, args)
if source == 0 then
local validWeatherType = false
if args[1] == nil then
print(_U('weather_invalid_syntax'))
return
else
for i,wtype in ipairs(Config.AvailableWeatherTypes) do
if wtype == string.upper(args[1]) then
validWeatherType = true
end
end
if validWeatherType then
print(_U('weather_updated'))
CurrentWeather = string.upper(args[1])
newWeatherTimer = Config.NewWeatherTimer
TriggerEvent('qb-weathersync:server:RequestStateSync')
else
print(_U('weather_invalid'))
end
end
else
if isAllowedToChange(source) then
local validWeatherType = false
if args[1] == nil then
TriggerClientEvent('QBCore:Notify', source, _U('weather_invalid_syntaxc'), 'error')
else
for i,wtype in ipairs(Config.AvailableWeatherTypes) do
if wtype == string.upper(args[1]) then
validWeatherType = true
end
end
if validWeatherType then
TriggerClientEvent('QBCore:Notify', source, _U('weather_willchangeto', string.lower(args[1])))
CurrentWeather = string.upper(args[1])
newWeatherTimer = Config.NewWeatherTimer
TriggerEvent('qb-weathersync:server:RequestStateSync')
else
TriggerClientEvent('QBCore:Notify', source, _U('weather_invalidc'), 'error')
end
end
else
TriggerClientEvent('QBCore:Notify', source, _U('not_access'), 'error')
print(_U('weather_accessdenied'))
end
end
end)
RegisterCommand('blackout', function(source)
if source == 0 then
blackout = not blackout
if blackout then
print(_U('blackout_enabled'))
else
print(_U('blackout_disabled'))
end
else
if isAllowedToChange(source) then
blackout = not blackout
if blackout then
TriggerClientEvent('QBCore:Notify', source, _U('blackout_enabledc'))
else
TriggerClientEvent('QBCore:Notify', source, _U('blackout_disabledc'))
end
TriggerEvent('qb-weathersync:server:RequestStateSync')
end
end
end)
RegisterCommand('morning', function(source)
if source == 0 then
print(_U('time_console'))
return
end
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(9)
TriggerClientEvent('QBCore:Notify', source, _U('time_morning'))
TriggerEvent('qb-weathersync:server:RequestStateSync')
end
end)
RegisterCommand('noon', function(source)
if source == 0 then
print(_U('time_console'))
return
end
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(12)
TriggerClientEvent('QBCore:Notify', source, _U('time_noon'))
TriggerEvent('qb-weathersync:server:RequestStateSync')
end
end)
RegisterCommand('evening', function(source)
if source == 0 then
print(_U('time_console'))
return
end
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(18)
TriggerClientEvent('QBCore:Notify', source, _U('time_evening'))
TriggerEvent('qb-weathersync:server:RequestStateSync')
end
end)
RegisterCommand('night', function(source)
if source == 0 then
print(_U('time_console'))
return
end
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(23)
TriggerClientEvent('QBCore:Notify', source, _U('time_night'))
TriggerEvent('qb-weathersync:server:RequestStateSync')
end
end)
function ShiftToMinute(minute)
timeOffset = timeOffset - ( ( (baseTime+timeOffset) % 60 ) - minute )
end
function ShiftToHour(hour)
timeOffset = timeOffset - ( ( ((baseTime+timeOffset)/60) % 24 ) - hour ) * 60
end
RegisterCommand('time', function(source, args, rawCommand)
if source == 0 then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
local argh = tonumber(args[1])
local argm = tonumber(args[2])
if argh < 24 then
ShiftToHour(argh)
else
ShiftToHour(0)
end
if argm < 60 then
ShiftToMinute(argm)
else
ShiftToMinute(0)
end
print(_U('time_change', argh, argm))
TriggerEvent('qb-weathersync:server:RequestStateSync')
else
print(_U('time_invalid'))
end
elseif source ~= 0 then
if isAllowedToChange(source) then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
local argh = tonumber(args[1])
local argm = tonumber(args[2])
if argh < 24 then
ShiftToHour(argh)
else
ShiftToHour(0)
end
if argm < 60 then
ShiftToMinute(argm)
else
ShiftToMinute(0)
end
local newtime = math.floor(((baseTime+timeOffset)/60)%24) .. ":"
local minute = math.floor((baseTime+timeOffset)%60)
if minute < 10 then
newtime = newtime .. "0" .. minute
else
newtime = newtime .. minute
end
TriggerClientEvent('QBCore:Notify', source, _U('time_changec', newtime))
TriggerEvent('qb-weathersync:server:RequestStateSync')
else
TriggerClientEvent('QBCore:Notify', source, _U('time_invalid'), 'error')
end
else
TriggerClientEvent('QBCore:Notify', source, _U('not_access'), 'error')
print(_U('time_access'))
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local newBaseTime = os.time(os.date("!*t"))/2 + 360
if freezeTime then
timeOffset = timeOffset + baseTime - newBaseTime
end
baseTime = newBaseTime
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(5000)
TriggerClientEvent('qb-weathersync:client:SyncTime', -1, baseTime, timeOffset, freezeTime)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(300000)
TriggerClientEvent('qb-weathersync:client:SyncWeather', -1, CurrentWeather, blackout)
end
end)
Citizen.CreateThread(function()
while true do
newWeatherTimer = newWeatherTimer - 1
Citizen.Wait((1000 * 60) * Config.NewWeatherTimer)
if newWeatherTimer == 0 then
if Config.DynamicWeather then
NextWeatherStage()
end
newWeatherTimer = Config.NewWeatherTimer
end
end
end)
function NextWeatherStage()
if CurrentWeather == "CLEAR" or CurrentWeather == "CLOUDS" or CurrentWeather == "EXTRASUNNY" then
local new = math.random(1,2)
if new == 1 then
CurrentWeather = "CLEARING"
else
CurrentWeather = "OVERCAST"
end
elseif CurrentWeather == "CLEARING" or CurrentWeather == "OVERCAST" then
local new = math.random(1,6)
if new == 1 then
if CurrentWeather == "CLEARING" then CurrentWeather = "FOGGY" else CurrentWeather = "RAIN" end
elseif new == 2 then
CurrentWeather = "CLOUDS"
elseif new == 3 then
CurrentWeather = "CLEAR"
elseif new == 4 then
CurrentWeather = "EXTRASUNNY"
elseif new == 5 then
CurrentWeather = "SMOG"
else
CurrentWeather = "FOGGY"
end
elseif CurrentWeather == "THUNDER" or CurrentWeather == "RAIN" then
CurrentWeather = "CLEARING"
elseif CurrentWeather == "SMOG" or CurrentWeather == "FOGGY" then
CurrentWeather = "CLEAR"
end
TriggerEvent("qb-weathersync:server:RequestStateSync")
end
|
local common = require("plugins.lsp.common")
return {
on_attach = common.on_attach,
capabilities = common.capabilities,
flags = {
debounce_text_changes = 150,
},
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
diagnostics = {
disabled = { "macro-error" },
},
},
},
}
|
require('../logic/sop');
require('../logic/algorithms');
-- page 51
F = sop({
cubeFromStrings("0--"),
cubeFromStrings("11-"),
cubeFromStrings("-11"),
});
Fsimple = sopSimplify(F);
assert(#Fsimple == 2);
assert(sopHasCube(Fsimple, cubeFromStrings("-1-")) ~= 0);
assert(sopHasCube(Fsimple, cubeFromStrings("0--")) ~= 0);
|
-------------------------------------------------------------------------------
-- Render library
-------------------------------------------------------------------------------
--- Called when a frame is requested to be drawn. You may want to unhook from this if you don't need
-- to render anything for a bit
-- @name render
-- @class hook
-- @client
--- Render library. Screens are 512x512 units. Most functions require
-- that you be in the rendering hook to call, otherwise an error is
-- thrown. +x is right, +y is down
-- @entity starfall_screen
-- @field TEXT_ALIGN_LEFT
-- @field TEXT_ALIGN_CENTER
-- @field TEXT_ALIGN_RIGHT
-- @field TEXT_ALIGN_TOP
-- @field TEXT_ALIGN_BOTTOM
local render_library, _ = SF.Libraries.RegisterLocal("render")
render_library.TEXT_ALIGN_LEFT = TEXT_ALIGN_LEFT
render_library.TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER
render_library.TEXT_ALIGN_RIGHT = TEXT_ALIGN_RIGHT
render_library.TEXT_ALIGN_TOP = TEXT_ALIGN_TOP
render_library.TEXT_ALIGN_BOTTOM = TEXT_ALIGN_BOTTOM
--- Vertex format
-- @name Vertex Format
-- @class table
-- @field x X coordinate
-- @field y Y coordinate
-- @field u U coordinate (optional, default is 0)
-- @field v V coordinate (optional, default is 0)
local render = render
local surface = surface
local clamp = math.Clamp
local max = math.max
local cam = cam
local dgetmeta = debug.getmetatable
local matrix_meta = SF.VMatrix.Metatable --debug.getregistry().VMatrix
local v_unwrap = SF.VMatrix.Unwrap
local currentcolor
local MATRIX_STACK_LIMIT = 8
local matrix_stack = {}
SF.Libraries.AddHook("prepare",function(instance, hook)
if hook == "render" then
currentcolor = Color(0,0,0,0)
end
end)
SF.Libraries.AddHook("cleanup", function(instance, hook)
for i=#matrix_stack,1,-1 do
cam.PopModelMatrix()
matrix_stack[i] = nil
end
end)
local texturecache = {}
local validfonts = {
DebugFixed = true,
DebugFixedSmall = true,
DefaultFixedOutline = true,
MenuItem = true,
Default = true,
TabLarge = true,
DefaultBold = true,
DefaultUnderline = true,
DefaultSmall = true,
DefaultSmallDropShadow = true,
DefaultVerySmall = true,
DefaultLarge = true,
UiBold = true,
MenuLarge = true,
ConsoleText = true,
Marlett = true,
Trebuchet18 = true,
Trebuchet19 = true,
Trebuchet20 = true,
Trebuchet22 = true,
Trebuchet24 = true,
HUDNumber = true,
HUDNumber1 = true,
HUDNumber2 = true,
HUDNumber3 = true,
HUDNumber4 = true,
HUDNumber5 = true,
HudHintTextLarge = true,
HudHintTextSmall = true,
CenterPrintText = true,
HudSelectionText = true,
DefaultFixed = true,
DefaultFixedDropShadow = true,
CloseCaption_Normal = true,
CloseCaption_Bold = true,
CloseCaption_BoldItalic = true,
TitleFont = true,
TitleFont2 = true,
ChatFont = true,
TargetID = true,
TargetIDSmall = true,
HL2MPTypeDeath = true,
BudgetLabel = true,
}
surface.CreateFont("sf_screen_font_Default_16_400_9_0000", {size = 16, weight = 400,
antialias=false, additive = false, font = "Default",
shadow = false, outline = false, blur = 0})
local defined_fonts = {
["sf_screen_font_Default_16_400_9_0000"] = true
}
local defaultFont = "sf_screen_font_Default_16_400_9_0000"
local poly_methods, poly_metamethods = SF.Typedef("Polygon")
local wrappoly, unwrappoly = SF.CreateWrapper(poly_metamethods)
local function checkvertex(vert)
return {
x = SF.CheckType(vert.x or vert[1],"number",1),
y = SF.CheckType(vert.y or vert[2],"number",1),
u = tonumber(vert.u or vert[3]) or 0,
v = tonumber(vert.v or vert[4]) or 0,
}
end
function poly_metamethods:__index(k)
SF.CheckType(self,poly_metamethods)
SF.CheckType(k,"number")
local poly = unwrappoly(self)
if not poly then return nil end
if k <= 0 or k > #poly then return nil end
return table.Copy(poly[k])
end
function poly_metamethods:__len()
SF.CheckType(self,poly_metamethods)
local poly = unwrappoly(self)
return poly and #poly or nil
end
function poly_metamethods:__newindex(k,v)
SF.CheckType(self,poly_metamethods)
SF.CheckType(k,"number")
SF.CheckType(v,"table")
local poly = unwrappoly(self)
if not poly then return end
if k <= 0 or k > (#poly)+1 then return SF.throw( "poly index out of bounds: " .. k .. " out of " .. #poly, 2 ) end
poly[k] = checkvertex(v)
end
-- ------------------------------------------------------------------ --
--- Pushes a matrix onto the matrix stack.
-- @param m The matrix
function render_library.pushMatrix(m)
SF.CheckType(m,matrix_meta)
local renderdata = SF.instance.data.render
if not renderdata.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
local id = #matrix_stack
if id + 1 > MATRIX_STACK_LIMIT then SF.throw( "Pushed too many matricies", 2 ) end
local newmatrix
if matrix_stack[id] then
newmatrix = matrix_stack[id] * v_unwrap(m)
else
newmatrix = v_unwrap(m)
end
matrix_stack[id+1] = newmatrix
cam.PushModelMatrix(newmatrix)
end
--- Pops a matrix from the matrix stack.
function render_library.popMatrix()
local renderdata = SF.instance.data.render
if not renderdata.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
if #matrix_stack <= 0 then SF.throw( "Popped too many matricies", 2 ) end
matrix_stack[#matrix_stack] = nil
cam.PopModelMatrix()
end
--- Sets the draw color
-- @param clr Color type
function render_library.setColor ( clr )
SF.CheckType( clr, SF.Types[ "Color" ] )
currentcolor = clr
surface.SetDrawColor( clr )
surface.SetTextColor( clr )
end
--- Looks up a texture ID by file name.
-- @param tx Texture file path
function render_library.getTextureID ( tx )
local id = surface.GetTextureID( tx )
if id then
texturecache[ id ] = { tx }
local cacheentry = texturecache[ id ]
local mat = Material( tx ) -- Hacky way to get ITexture, if there is a better way - do it!
cacheentry[ 2 ] = CreateMaterial( "SF_TEXTURE_" .. id, "UnlitGeneric", {
[ "$nolod" ] = 1,
[ "$ignorez" ] = 1,
[ "$vertexcolor" ] = 1,
[ "$vertexalpha" ] = 1
} )
cacheentry[ 2 ]:SetTexture( "$basetexture", mat:GetTexture( "$basetexture" ) )
return id
end
end
--- Sets the texture
-- @param id Texture id
function render_library.setTexture ( id )
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
if not id then
draw.NoTexture()
elseif texturecache[ id ] then
surface.SetMaterial( texturecache[ id ][ 2 ] )
end
end
--- Clears the surface
-- @param clr Color type to clear with
function render_library.clear ( clr )
if clr == nil then
if not SF.instance.data.render.isRendering then SF.throw( "Not in a rendering hook.", 2 ) end
render.Clear( 0, 0, 0, 255 )
else
SF.CheckType( clr, SF.Types[ "Color" ] )
if not SF.instance.data.render.isRendering then SF.throw( "Not in a rendering hook.", 2 ) end
render.Clear( clr.r, clr.g, clr.b, clr.a )
end
end
--- Draws a rectangle using the current color.
-- @param x Top left corner x coordinate
-- @param y Top left corner y coordinate
-- @param w Width
-- @param h Height
function render_library.drawRect(x,y,w,h)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawRect(x,y,w,h)
end
--- Draws a rectangle outline using the current color.
-- @param x Top left corner x coordinate
-- @param y Top left corner y coordinate
-- @param w Width
-- @param h Height
function render_library.drawRectOutline(x,y,w,h)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawOutlinedRect(x,y,w,h)
end
--- Draws a circle outline
-- @param x Center x coordinate
-- @param y Center y coordinate
-- @param r Radius
function render_library.drawCircle(x,y,r)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawCircle(x,y,r,currentcolor)
end
--- Draws a textured rectangle.
-- @param x Top left corner x coordinate
-- @param y Top left corner y coordinate
-- @param w Width
-- @param h Height
function render_library.drawTexturedRect(x,y,w,h)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawTexturedRect(x,y,w,h)
end
--- Draws a textured rectangle with UV coordinates
-- @param x Top left corner x coordinate
-- @param y Top left corner y coordinate
-- @param w Width
-- @param h Height
-- @param startU Texture mapping at rectangle origin
-- @param startV Texture mapping at rectangle origin
-- @param endV Texture mapping at rectangle end
-- @param endV Texture mapping at rectangle end
function render_library.drawTexturedRectUV(x,y,w,h,startU,startV,endU,endV)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawTexturedRectUV(x,y,w,h,startU,startV,endU,endV)
end
--- Draws a rotated, textured rectangle.
-- @param x X coordinate of center of rect
-- @param y Y coordinate of center of rect
-- @param w Width
-- @param h Height
-- @param rot Rotation in degrees
function render_library.drawTexturedRectRotated(x,y,w,h,rot)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawTexturedRectRotated(x, y, w, h, rot)
end
--- Draws a line
-- @param x1 X start coordinate
-- @param y1 Y start coordinate
-- @param x2 X end coordinate
-- @param y2 Y end coordinate
function render_library.drawLine(x1,y1,x2,y2)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
surface.DrawLine(x1,y1,x2,y2)
end
-- Creates a font. Does not require rendering hook
-- @param font Base font to use
-- @param size Font size
-- @param weight Font weight (default: 400)
-- @param antialias Antialias font?
-- @param additive If true, adds brightness to pixels behind it rather than drawing over them.
-- @param shadow Enable drop shadow?
-- @param outline Enable outline?
-- @param A table representing the font (doesn't contain anything)
function render_library.createFont(font,size,weight,antialias,additive,shadow,outline,blur)
if not validfonts[font] then SF.throw( "invalid font", 2 ) end
size = tonumber(size) or 16
weight = tonumber(weight) or 400
blur = tonumber(blur) or 0
antialias = antialias and true or false
additive = additive and true or false
shadow = shadow and true or false
outline = outline and true or false
local name = string.format("sf_screen_font_%s_%d_%d_%d_%d%d%d%d",
font, size, weight, blur,
antialias and 1 or 0,
additive and 1 or 0,
shadow and 1 or 0,
outline and 1 or 0)
if not defined_fonts[name] then
surface.CreateFont(name, {size = size, weight = weight,
antialias=antialias, additive = additive, font = font,
shadow = shadow, outline = outline, blur = blur})
defined_fonts[name] = true
end
return name
end
--- Gets the size of the specified text. Don't forget to use setFont before calling this function
-- @param text Text to get the size of
-- @return width of the text
-- @return height of the text
function render_library.getTextSize( text )
SF.CheckType(text,"string")
surface.SetFont(SF.instance.data.render.font or defaultFont)
return surface.GetTextSize( text )
end
--- Sets the font
-- @param font The font to use
function render_library.setFont(font)
if not defined_fonts[font] then SF.throw( "Font does not exist.", 2 ) end
SF.instance.data.render.font = font
--surface.SetFont(font)
end
--- Gets the default font
-- @return Default font
function render_library.getDefaultFont()
return defaultFont
end
--- Draws text using a font
-- @param font Font table returned by createFont
-- @param x X coordinate
-- @param y Y coordinate
-- @param text Text to draw
-- @param alignment Text alignment
function render_library.drawText(x,y,text,alignment)
if not SF.instance.data.render.isRendering then SF.throw( "Not in rendering hook.", 2 ) end
SF.CheckType(text,"string")
local font = SF.instance.data.render.font or defaultFont
draw.DrawText(text, font, tonumber(x) or 0, tonumber(y) or 0, currentcolor, tonumber(alignment) or TEXT_ALIGN_LEFT)
end
--- Creates a vertex for use with polygons. This just creates a table; it doesn't really do anything special
-- @param x x coordinate
-- @param y y coordinate
-- @param u u texture coordinate
-- @param v v texture coordinate
-- @return vertex table
function render_library.vertex(x,y,u,v)
return {x=x, y=y, u=u, v=v}
end
--- Compiles a 2D poly. This is needed so that poly don't have to be
-- type-checked each frame. Polys can be indexed by a number, in which
-- a copy of the vertex at that spot is returned. They can also be assigned
-- a new vertex at 1 <= i <= #poly+1. And the length of the poly can be taken.
-- @param verts Array of verticies to convert.
-- @return compiled polygon
function render_library.createPoly(verts)
SF.CheckType(verts,"table")
local poly = {}
local wrappedpoly = wrappoly(poly)
for i=1,#verts do
local v = verts[i]
SF.CheckType(v,"table")
poly[i] = checkvertex(v)
end
return wrappedpoly
end
--- Draws a polygon. Takes a compiled/uncompiled poly to draw.
-- Note that if you do use an uncompiled poly, you will use up ops
-- very quickly!
-- @param poly Compiled poly or array of vertexes
function render_library.drawPoly(poly)
if dgetmeta(poly) ~= poly_metamethods then
SF.CheckType(poly,"table")
local verts = poly
poly = {}
for i=1,#verts do
local v = verts[i]
SF.CheckType(v,"table")
poly[i] = checkvertex(v)
end
else
poly = unwrappoly(poly)
end
surface.DrawPoly(poly)
end
--- Gets a 2D cursor position where ply is aiming.
-- @param ply player to get cursor position from
-- @return x position
-- @return y position
function render_library.cursorPos( ply )
-- Taken from EGPLib
local Normal, Pos, monitor, Ang
local screen = SF.instance.data.entity
if not screen then return nil end
ply = SF.Entities.Unwrap( ply )
-- Get monitor screen pos & size
monitor = WireGPU_Monitors[ screen:GetModel() ]
-- Monitor does not have a valid screen point
if not monitor then return nil end
Ang = screen:LocalToWorldAngles( monitor.rot )
Pos = screen:LocalToWorld( monitor.offset )
Normal = Ang:Up()
local Start = ply:GetShootPos()
local Dir = ply:GetAimVector()
local A = Normal:Dot(Dir)
-- If ray is parallel or behind the screen
if A == 0 or A > 0 then return nil end
local B = Normal:Dot(Pos-Start) / A
if (B >= 0) then
local HitPos = WorldToLocal( Start + Dir * B, Angle(), Pos, Ang )
local x = (0.5+HitPos.x/(monitor.RS*512/monitor.RatioX)) * 512
local y = (0.5-HitPos.y/(monitor.RS*512)) * 512
if x < 0 or x > 512 or y < 0 or y > 512 then return nil end -- Aiming off the screen
return x, y
end
return nil
end
--- Returns information about the screen, such as dimentions and rotation.
-- Note: this does a table copy so move it out of your draw hook
-- @return A table describing the screen.
function render_library.getScreenInfo()
local gpu = SF.instance.data.render.gpu
if not gpu then return end
local info, _, _ = gpu:GetInfo()
return table.Copy(info)
end
--- Returns the screen surface's world position and angle
-- @return The screen position
-- @return The screen angle
function render_library.getScreenPos()
local gpu = SF.instance.data.render.gpu
if not gpu then return end
local _, pos, rot = gpu:GetInfo()
return pos, rot
end
---
-- @name Screen information table
-- @class table
-- @field Name Pretty name of model
-- @field offset Offset of screen from prop
-- @field RS Resolution/scale
-- @field RatioX Inverted Aspect ratio (height divided by width)
-- @field x1 Corner of screen in local coordinates (relative to offset?)
-- @field x2 Corner of screen in local coordinates (relative to offset?)
-- @field y1 Corner of screen in local coordinates (relative to offset?)
-- @field y2 Corner of screen in local coordinates (relative to offset?)
-- @field z Screen plane offset in local coordinates (relative to offset?)
-- @field rot Screen rotation
|
--*****************************************************************************
--* _______ __
--* |_ _| |--.----.---.-.--.--.--.-----.-----.
--* | | | | _| _ | | | | |__ --|
--* |___| |__|__|__| |___._|________|__|__|_____|
--* ______
--* | __ \.-----.--.--.-----.-----.-----.-----.
--* | <| -__| | | -__| | _ | -__|
--* |___|__||_____|\___/|_____|__|__|___ |_____|
--* |_____|
--*
--* @Author: [EaWX]Pox
--* @Date: 2020-12-29
--* @Project: Empire at War Expanded
--* @Filename: init.lua
--* @License: MIT
--*****************************************************************************
require("deepcore/std/plugintargets")
return {
target = PluginTargets.interval(45),
requires_planets = true,
init = function(self, ctx)
return {
---@param planet Planet
update = function(self, planet)
if planet:get_game_object() ~= FindPlanet("Kuat") then
return
end
local empire = Find_Player("Empire")
local rebel = Find_Player("Rebel")
local current_owner = planet:get_owner()
if current_owner == empire then
planet:get_game_object().Change_Owner(rebel)
else
planet:get_game_object().Change_Owner(empire)
end
end
}
end
}
|
local runner = require("test_executive")
local packet = require("packet")
-- CCSDS Packetizer Unit Test --
cmdoutq = msg.subscribe("cmdoutq")
payinq = msg.publish("payinq")
packetizer = ccsds.packetizer("payinq", "cmdoutq", 0xBF, ccsds.CMD, 3)
payinq:sendstring("HELLOWORLD\0")
val1 = cmdoutq:recvstring(3000)
packet.printPacket(val1, 32)
cmd.exec("CCSDS::DEFINE_COMMAND match.cmd NULL 0xBF 3 19 2")
cmd.exec("ADD_FIELD match.cmd CS UINT8 7 1 NA")
cmd.exec("ADD_FIELD match.cmd msg STRING 8 11 NA")
packet.sendCommand("/match.cmd msg=HELLOWORLD", msg.publish("cmdoutq"), "CS", true)
val2 = cmdoutq:recvstring(3000)
runner.check(packet.comparePacket(val1, val2))
-- Report Results --
runner.report()
|
--Created by Alex Crowley
--On November 3, 2016
--Copyright (c) 2016, TBD
--Licensed under the MIT license
--See LICENSE file for terms
--[[
Runs a validation check on a declaration to make sure the declaration is valid.
Also updates the scope where the declaration occured
Returns:
Error code, 0 if successful
--]]
function checkDeclaration(line, scope)
local name = line.name
if line.scope == "global" then
--Global variable declared in class or function
if scope.func ~= nil then
print("ERROR: global variable " .. name .. " must be declared in outermost scope")
return 1
--Global variable already declared
elseif scope.global.variables[line.name] ~= nil then
print("ERROR: global variable " .. name .. " already declared")
return 1
--Local variable declaration followed by global declaration
elseif scope.file.variables[line.name] ~= nil then
print("ERROR: global variable " .. name .. " already declared with file scope")
return 1
else
scope.global.variables[line.name] = line.ctype
end
else
if scope.func ~= nil then
--Variable already declared in function scope
if scope.func.variables[line.name] ~= nil then
print("ERROR: variable " .. name .. " already declared in scope")
return 1
else
scope.func.variables[line.name] = line.ctype
--table.insert(scope.func.variables, line)
end
--Varible already declared in file
elseif scope.file.variables[line.name] ~= nil then
print("ERROR: variable " .. name .. " already declared in file")
return 1
--Global variable declaration followed by local declaration
-- elseif scope.global.variables[line.name] ~= nil then
-- print("ERROR: variable " .. name .. " already declared with global scope")
-- return 1
else
scope.file.variables[line.name] = line.ctype
end
end
--No problems
return 0
end
|
local M = {}
M.config = function()
local status_ok, sidebar = pcall(require, "sidebar-nvim")
if not status_ok then
return
end
sidebar.setup {
open = false,
initial_width = 30,
enable_profile = false,
sections = { "datetime", "git-status", "lsp-diagnostics", "containers" },
datetime = {
icon = "",
format = "%a %b %d, %H:%M",
clocks = {
{ name = "local" },
},
},
todos = {
icon = "",
ignored_paths = { "~" }, -- ignore certain paths, this will prevent huge folders like $HOME to hog Neovim with TODO searching
initially_closed = false, -- whether the groups should be initially closed on start. You can manually open/close groups later.
},
}
end
return M
|
local AttributeUtils = require "AttributeUtils"
-- Table printing utility
local function tprint(tbl, prefix, indent)
if not indent then indent = 0 end
if not prefix then prefix = "" end
if type(tbl) ~= 'table' then
print(prefix .. tostring(tbl))
return
end
for k, v in pairs(tbl) do
local formatting = prefix .. string.rep(" ", indent) .. k .. ": "
local valueType = type(v)
if valueType == "table" then
print(formatting)
tprint(v, indent+1, prefix)
else
print(formatting .. tostring(v))
end
end
end
-- Test data setup
local testDataTable =
{
key1 = "value1",
key2 = "value2"
}
local testDataArray =
{
{
key = "key1",
value = "value1"
},
{
key = "key2",
value = "value2"
}
}
--[[ Both of these should create the following attribute table:
| Key | Value |
|--------|--------|
| key1 | value1 |
| key1 | value2 |
--]]
--======= createAttributeTable =======--
-- Table input
local testAttTbl = AttributeUtils.createAttributeTable(vrScenesNode(), testDataTable)
vrNodeSetName(testAttTbl,"testDataTable")
--======= createAttributeTableFromArray =======--
-- Array input
local testAttTbl_Array = AttributeUtils.createAttributeTableFromArray(vrScenesNode(), testDataArray)
vrNodeSetName(testAttTbl_Array,"testDataArray")
--======= getAttributeIterator =======--
--[[ Should print:
Key key1 Value value1
Key key2 Value value2
--]]
for k,v in AttributeUtils.getAttributeIterator(testAttTbl) do
print("Key",k,"Value",v)
end
--======= getAllAttributes =======--
--[[ Should print:
key1: value1
key2: value2
--]]
tprint(AttributeUtils.getAllAttributes(testAttTbl))
--[[ Should print:
PREFIX_key1: value1
PREFIX_key2: value2
--]]
tprint(AttributeUtils.getAllAttributes(testAttTbl,"PREFIX_"))
--======= getAttribute =======--
-- Should print "value1"
print(AttributeUtils.getAttribute(testAttTbl,"key1"))
|
return require('packer').startup(function()
use 'wbthomason/packer.nvim'
use {
'ellisonleao/gruvbox.nvim',
requires = { 'rktjmp/lush.nvim' }
}
use 'folke/which-key.nvim'
use 'sainnhe/everforest'
use 'rakr/vim-one'
use {
'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons'
}
use {
'akinsho/bufferline.nvim',
requires = 'kyazdani42/nvim-web-devicons'
}
use 'akinsho/toggleterm.nvim'
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use { 'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer' }
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/nvim-cmp'
-- vsnip
use 'hrsh7th/cmp-vsnip'
use 'hrsh7th/vim-vsnip'
use 'rafamadriz/friendly-snippets'
-- lspkind
use 'onsails/lspkind-nvim'
use 'simrat39/rust-tools.nvim'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use {
'numToStr/Comment.nvim',
config = function()
require('Comment').setup()
end
}
use 'windwp/nvim-autopairs'
use 'tpope/vim-surround'
use {
"startup-nvim/startup.nvim",
requires = {"nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"}
}
use 'lukas-reineke/indent-blankline.nvim'
use {
'lewis6991/gitsigns.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
use 'norcalli/nvim-colorizer.lua'
use 'arkav/lualine-lsp-progress'
use 'mhartington/formatter.nvim'
use 'rescript-lang/vim-rescript'
end)
|
--
-- tests/actions/vstudio/cs2005/test_project_refs.lua
-- Test the project dependencies block of a Visual Studio 2005+ C# project.
-- Copyright (c) 2012 Jason Perkins and the Premake project
--
T.vstudio_cs2005_project_refs = {}
local suite = T.vstudio_cs2005_project_refs
local cs2005 = premake.vstudio.cs2005
local project = premake5.project
--
-- Setup and teardown
--
local sln, prj
function suite.setup()
_ACTION = "vs2005"
sln, prj = test.createsolution()
end
local function prepare()
cs2005.projectReferences(prj)
end
--
-- Block should be empty if the project has no dependencies.
--
function suite.emptyGroup_onNoDependencies()
prepare()
test.capture [[
<ItemGroup>
</ItemGroup>
]]
end
|
require 'nn'
require 'rnn'
require 'cunn'
require 'cudnn'
require 'sys'
local loadW2V = paths.dofile(paths.thisfile('w2v.lua'))
local function mkIngrLut(opts)
-- Ingredient lookup table
local ingrW2V = loadW2V(opts.ingrW2V)
local lut = nn.LookupTableMaskZero(ingrW2V:size(1)+1, ingrW2V:size(2))
lut.weight:sub(3, -1):copy(ingrW2V) -- 1 is 0, 2 is </i>
return lut
end
function get_trijoint(opts)
local visionMLP
local semantic_branch
local visual_embedding
-- Loads VGG or ResNet models
paths.dofile('vision.lua')
visionMLP = get_vision_branch(opts)
-- Add embedding layer & activation
visual_embedding = nn.Linear(opts.imfeatDim, opts.embDim)
visionMLP:add(visual_embedding):add(cudnn.Tanh()):add(nn.Normalize(2))
-- Parallelize vision branch into multiple gpus if needed
paths.dofile('../drivers/utils.lua')
visionMLP = makeDataParallel(visionMLP,opts)
--end
-- Skip-thoughts LSTM
local stRNN = nn.Sequential()
:add(cudnn.LSTM(opts.stDim, opts.srnnDim, opts.nRNNs))
:add(nn.Select(1, -1))
-- Ingredients Bidirectional LSTM
local irnn = nn.SeqBRNN(opts.ingrW2VDim, opts.irnnDim, nil, nn.JoinTable(2, 2))
irnn.maskzero = true
local ingRNN = nn.Sequential()
:add(mkIngrLut(opts))
:add(nn.Transpose({1, 2}))
:add(irnn)
:add(nn.Select(1, -1))
-- Build model with 3 inputs
model = nn.Sequential()
:add(nn.ParallelTable()
:add(visionMLP)
:add(stRNN)
:add(ingRNN)
)
:add(nn.ConcatTable()
:add(nn.SelectTable(1)) -- visual embedding
:add(nn.Sequential() -- recipe embedding
:add(nn.NarrowTable(2, 2)) -- select two last branches of parallel table
:add(nn.JoinTable(2, 2)) -- concatenate two last branches in the second dim
:add(nn.Linear(opts.irnnDim*2+opts.srnnDim, opts.embDim)) -- fc layer for recipe
:add(cudnn.Tanh())
:add(nn.Normalize(2))
)
)
-- Adds classification layer
if opts.semantic then
local semantic_branch = nn.Linear(opts.embDim, opts.numClasses)
local semantic_branch2 = semantic_branch:clone('weight', 'bias', 'gradWeight', 'gradBias')
model:add(nn.ConcatTable() -- the embedding outputs
:add(nn.ConcatTable()
:add(nn.SelectTable(1)) -- image embedding
:add(nn.SelectTable(2)) -- recipe embedding
)
:add(nn.Sequential()
:add(nn.SelectTable(1)) -- image embedding
:add(semantic_branch2)
:add(nn.LogSoftMax())
)
:add(nn.Sequential()
:add(nn.SelectTable(2)) -- recipe embedding
:add(semantic_branch)
:add(nn.LogSoftMax())
)
)
end
return model
end
|
--[[
Copyright (c) 2019, Vsevolod Stakhov <vsevolod@highsecure.ru>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
--[[[
-- @module lua_ffi/dkim
-- This module contains ffi interfaces to DKIM
--]]
local ffi = require 'ffi'
ffi.cdef[[
struct rspamd_dkim_sign_context_s;
struct rspamd_dkim_key_s;
struct rspamd_task;
enum rspamd_dkim_key_format {
RSPAMD_DKIM_KEY_FILE = 0,
RSPAMD_DKIM_KEY_PEM,
RSPAMD_DKIM_KEY_BASE64,
RSPAMD_DKIM_KEY_RAW,
};
enum rspamd_dkim_type {
RSPAMD_DKIM_NORMAL,
RSPAMD_DKIM_ARC_SIG,
RSPAMD_DKIM_ARC_SEAL
};
struct rspamd_dkim_sign_context_s*
rspamd_create_dkim_sign_context (struct rspamd_task *task,
struct rspamd_dkim_key_s *priv_key,
int headers_canon,
int body_canon,
const char *dkim_headers,
enum rspamd_dkim_type type,
void *unused);
struct rspamd_dkim_key_s* rspamd_dkim_sign_key_load (const char *what, size_t len,
enum rspamd_dkim_key_format,
void *err);
void rspamd_dkim_key_unref (struct rspamd_dkim_key_s *k);
struct GString *rspamd_dkim_sign (struct rspamd_task *task,
const char *selector,
const char *domain,
unsigned long expire,
size_t len,
unsigned int idx,
const char *arc_cv,
struct rspamd_dkim_sign_context_s *ctx);
]]
local function load_sign_key(what, format)
if not format then
format = ffi.C.RSPAMD_DKIM_KEY_PEM
else
if format == 'file' then
format = ffi.C.RSPAMD_DKIM_KEY_FILE
elseif format == 'base64' then
format = ffi.C.RSPAMD_DKIM_KEY_BASE64
elseif format == 'raw' then
format = ffi.C.RSPAMD_DKIM_KEY_RAW
else
return nil,'unknown key format'
end
end
return ffi.C.rspamd_dkim_sign_key_load(what, #what, format, nil)
end
local default_dkim_headers =
"(o)from:(o)sender:(o)reply-to:(o)subject:(o)date:(o)message-id:" ..
"(o)to:(o)cc:(o)mime-version:(o)content-type:(o)content-transfer-encoding:" ..
"resent-to:resent-cc:resent-from:resent-sender:resent-message-id:" ..
"(o)in-reply-to:(o)references:list-id:list-owner:list-unsubscribe:" ..
"list-subscribe:list-post"
local function create_sign_context(task, privkey, dkim_headers, sign_type)
if not task or not privkey then
return nil,'invalid arguments'
end
if not dkim_headers then
dkim_headers = default_dkim_headers
end
if not sign_type then
sign_type = 'dkim'
end
if sign_type == 'dkim' then
sign_type = ffi.C.RSPAMD_DKIM_NORMAL
elseif sign_type == 'arc-sig' then
sign_type = ffi.C.RSPAMD_DKIM_ARC_SIG
elseif sign_type == 'arc-seal' then
sign_type = ffi.C.RSPAMD_DKIM_ARC_SEAL
else
return nil,'invalid sign type'
end
return ffi.C.rspamd_create_dkim_sign_context(task:topointer(), privkey,
1, 1, dkim_headers, sign_type, nil)
end
local function do_sign(task, sign_context, selector, domain,
expire, len, arc_idx)
if not task or not sign_context or not selector or not domain then
return nil,'invalid arguments'
end
if not expire then expire = 0 end
if not len then len = 0 end
if not arc_idx then arc_idx = 0 end
local gstring = ffi.C.rspamd_dkim_sign(task:topointer(), selector, domain, expire, len, arc_idx, nil, sign_context)
if not gstring then
return nil,'cannot sign'
end
local ret = ffi.string(gstring.str, gstring.len)
ffi.C.g_string_free(gstring, true)
return ret
end
return {
load_sign_key = load_sign_key,
create_sign_context = create_sign_context,
do_sign = do_sign
}
|
-- -*- mode: lua; tab-width: 2; indent-tabs-mode: 1; st-rulers: [70] -*-
-- vim: ts=4 sw=4 ft=lua noet
----------------------------------------------------------------------
-- @author Daniel Barney <daniel@pagodabox.com>
-- @copyright 2015, Pagoda Box, Inc.
-- @doc
--
-- @end
-- Created : 15 May 2015 by Daniel Barney <daniel@pagodabox.com>
----------------------------------------------------------------------
local log = require('logger')
local os = require('os')
function main()
if args[1] == '-server' then
log.add_logger('info','console',function(...) p(os.date("%x %X"),...) end)
log.info("starting server")
table.remove(args,1)
require('./lib/server')
-- not reached
else
log.add_logger('debug','console',function(...) p(...) end)
log.debug("entering cli mode")
require('./lib/cli')
end
end
main()
|
-- minetest time speed
local time_speed = tonumber(minetest.setting_get("time_speed"))
if not time_speed then
time_speed = 1
else
time_speed = time_speed/72
end
local function get_date()
return os.date("%y %d %H %M %S")
end
-- returns the time difference in seconds
local function get_timediff(d1, d2)
local d = string.split(d1, " ")
for n,i in pairs(string.split(d2, " ")) do
d[n] = i-d[n]
end
local secs = 0
local y,d,h,m,s = unpack(d)
if s ~= 0 then
secs = secs+s
end
if m ~= 0 then
secs = secs+m*60
end
if h ~= 0 then
secs = secs+h*3600 -- 60*60
end
if d ~= 0 then
secs = secs+d*86400 -- 60*60*24
end
if y ~= 0 then
secs = secs+y*31557600 -- 60*60*24*365.25
end
--secs = math.floor(secs+0.5)
if secs < 0 then
minetest.log("action", "play warzone2100?")
end
return secs*time_speed
end
-- copied from older default furnace code and edited a bit
function nether.get_furnace_active_formspec(pos, percent)
local formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
return formspec
end
nether.furnace_inactive_formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
minetest.register_node("nether:furnace", {
description = "Furnace",
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", nether.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return count
else
return 0
end
elseif to_list == "src" then
return count
elseif to_list == "dst" then
return 0
end
end,
})
minetest.register_node("nether:furnace_active", {
description = "Furnace",
tiles = {
"default_furnace_top.png",
"default_furnace_bottom.png",
"default_furnace_side.png",
"default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}
},
paramtype2 = "facedir",
light_source = 8,
drop = "nether:furnace",
groups = {cracky=2, not_in_creative_inventory=1,hot=1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", nether.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return count
else
return 0
end
elseif to_list == "src" then
return count
elseif to_list == "dst" then
return 0
end
end,
})
local function swap_node(pos,name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos,node)
end
minetest.register_abm({
nodenames = {"nether:furnace","nether:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("timedif") == "" then
meta:set_float("timedif", 0.0)
end
-- lag shouldn't control the furnace speed
local current_time = get_date()
local last_time = meta:get_string("last_active")
if last_time == "" then
meta:set_string("last_active", current_time)
return
end
if last_time == current_time then
return
end
local timediff = get_timediff(last_time, current_time)+meta:get_string("timedif")
local times = math.floor(timediff)
meta:set_string("last_active", current_time)
meta:set_float("timedif", timediff-times)
for i = 1,times do
for _,name in pairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time",
}) do
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
local aftercooked
if srclist then
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_float("src_time", meta:get_float("src_time") + 1)
if cooked
and cooked.item
and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
inv:set_stack("src", 1, aftercooked.items[1])
else
--print("Could not insert '"..cooked.item:to_string().."'")
end
meta:set_string("src_time", 0)
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Furnace active: "..percent.."%")
swap_node(pos,"nether:furnace_active")
meta:set_string("formspec",nether.get_furnace_active_formspec(pos, percent))
return
end
local fuel = nil
local afterfuel
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if not fuel or fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
swap_node(pos,"nether:furnace")
meta:set_string("formspec", nether.furnace_inactive_formspec)
return
end
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext","Furnace is empty")
swap_node(pos,"nether:furnace")
meta:set_string("formspec", nether.furnace_inactive_formspec)
end
return
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
inv:set_stack("fuel", 1, afterfuel.items[1])
end
end,
})
|
local t = require( "taptest" )
local collectk = require( "collectk" )
local like = require( "like" )
src = { a="x", b="y", c="z" }
keys = collectk( pairs( src ) )
t( like( keys, { "a", "b", "c" } ), true )
t()
|
-- Generated by LairTool
dantooine_janta_leader_camp_neutral_large_theater = Lair:new {
mobiles = {{"janta_clan_leader",1},{"janta_harvester",1},{"janta_tribesman",1}},
spawnLimit = 15,
buildingsVeryEasy = {"object/building/poi/dantooine_janta_large2.iff"},
buildingsEasy = {"object/building/poi/dantooine_janta_large2.iff"},
buildingsMedium = {"object/building/poi/dantooine_janta_large2.iff"},
buildingsHard = {"object/building/poi/dantooine_janta_large2.iff"},
buildingsVeryHard = {"object/building/poi/dantooine_janta_large2.iff"},
mobType = "npc",
buildingType = "theater"
}
addLairTemplate("dantooine_janta_leader_camp_neutral_large_theater", dantooine_janta_leader_camp_neutral_large_theater)
|
return {
id = "NG0024",
events = {
{
alpha = 0.4,
style = {
text = "META研究室中拥有<color=#ff5c5c>能量激活</color>、<color=#ff5c5c>舰装强化</color>、<color=#ff5c5c>战术研习</color>、<color=#ff5c5c>资讯同步</color>四个系统模块。",
mode = 2,
posY = -230.2,
dir = 1,
posX = -332.5
}
},
{
alpha = 0.4,
style = {
text = "来看看META角色的战术研习吧。",
mode = 2,
posY = -186.8,
dir = 1,
posX = 634.32
},
ui = {
path = "UICamera/Canvas/UIMain/MetaCharacterUI(Clone)/HidePanel/MenuPanel/TacticsBtn",
triggerType = {
1
},
fingerPos = {
posX = 81.69,
posY = -58.49,
rotateX = 0,
rotateZ = 0,
rotateY = 0
}
}
},
{
alpha = 0.4,
style = {
text = "META角色的技能在进行升级之前首先需要解锁。",
mode = 2,
posY = -133,
dir = 1,
posX = 0
},
ui = {
path = "OverlayCamera/Overlay/UIMain/MetaCharacterTacticsUI(Clone)/SkillPanel/Skills/Content",
pathIndex = 0,
triggerType = {
1
},
fingerPos = {
posX = 0,
posY = 0,
rotateX = 0,
rotateZ = 0,
rotateY = 0
}
}
},
{
alpha = 0.4,
style = {
text = "需要消耗一定数量与技能类型相同的技能书进行解锁操作。",
mode = 2,
posY = 0,
dir = -1,
posX = 383.59
}
}
}
}
|
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Glass"
ENT.Spawnable = true
ENT.Category = "BLUES BAR"
function ENT:SetupDataTables()
self:NetworkVar( "String", 0, "BottleName")
self:NetworkVar("String" , 3 , "Ingredients")
self:NetworkVar("Entity",4, "Customer")
self:NetworkVar( "Bool" , 5 , "IsBusy")
end
|
local BasePlugin = require "kong.plugins.base_plugin"
local access = require "kong.plugins.kong-request-header.access"
local UpstreamHMACHandler = BasePlugin:extend()
function UpstreamHMACHandler:new()
UpstreamHMACHandler.super.new(self, "kong-request-header")
end
function UpstreamHMACHandler:access(conf)
UpstreamHMACHandler.super.access(self)
access.execute(conf)
end
UpstreamHMACHandler.PRIORITY = 666
return UpstreamHMACHandler
|
-- Kong core
--
-- This consists of local_events that need to
-- be ran at the very beginning and very end of the lua-nginx-module contexts.
-- It mainly carries information related to a request from one context to the next one,
-- through the `ngx.ctx` table.
--
-- In the `access_by_lua` phase, it is responsible for retrieving the API being proxied by
-- a Consumer. Then it is responsible for loading the plugins to execute on this request.
local utils = require "kong.tools.utils"
local Router = require "kong.core.router"
local reports = require "kong.core.reports"
local balancer = require "kong.core.balancer"
local constants = require "kong.constants"
local responses = require "kong.tools.responses"
local singletons = require "kong.singletons"
local certificate = require "kong.core.certificate"
local tostring = tostring
local sub = string.sub
local lower = string.lower
local fmt = string.format
local ngx = ngx
local ERR = ngx.ERR
local DEBUG = ngx.DEBUG
local log = ngx.log
local ngx_now = ngx.now
local unpack = unpack
local router, router_err, router_version
local server_header = _KONG._NAME.."/".._KONG._VERSION
local function get_now()
return ngx_now() * 1000 -- time is kept in seconds with millisecond resolution.
end
local function build_router(dao, version)
local apis, err = dao.apis:find_all()
if err then
return nil, "could not load APIs: " .. err
end
for i = 1, #apis do
-- alias since the router expects 'headers' as a map
if apis[i].hosts then
apis[i].headers = { host = apis[i].hosts }
end
end
router, err = Router.new(apis)
if not router then
return nil, "could not create router: " .. err
end
if version then
router_version = version
end
return true
end
-- in the table below the `before` and `after` is to indicate when they run:
-- before or after the plugins
return {
build_router = build_router,
init_worker = {
before = function()
reports.init_worker()
-- initialize local local_events hooks
local dao = singletons.dao
local cache = singletons.cache
local worker_events = singletons.worker_events
local cluster_events = singletons.cluster_events
-- events dispatcher
worker_events.register(function(data)
if not data.schema then
log(ngx.ERR, "[events] missing schema in crud subscriber")
return
end
if not data.entity then
log(ngx.ERR, "[events] missing entity in crud subscriber")
return
end
-- invalidate this entity anywhere it is cached if it has a
-- caching key
local cache_key = dao[data.schema.table]:entity_cache_key(data.entity)
if cache_key then
cache:invalidate(cache_key)
end
-- if we had an update, but the cache key was part of what was updated,
-- we need to invalidate the previous entity as well
if data.old_entity then
cache_key = dao[data.schema.table]:entity_cache_key(data.old_entity)
if cache_key then
cache:invalidate(cache_key)
end
end
if not data.operation then
log(ngx.ERR, "[events] missing operation in crud subscriber")
return
end
local entity_channel = data.schema.table
local entity_operation_channel = fmt("%s:%s", data.schema.table,
data.operation)
-- crud:apis
local ok, err = worker_events.post_local("crud", entity_channel, data)
if not ok then
log(ngx.ERR, "[events] could not broadcast crud event: ", err)
return
end
-- crud:apis:create
ok, err = worker_events.post_local("crud", entity_operation_channel, data)
if not ok then
log(ngx.ERR, "[events] could not broadcast crud event: ", err)
return
end
end, "dao:crud")
-- local events (same worker)
worker_events.register(function()
log(DEBUG, "[events] API updated, invalidating router")
cache:invalidate("router:version")
end, "crud", "apis")
-- SSL certs / SNIs invalidations
worker_events.register(function(data)
log(DEBUG, "[events] SNI updated, invalidating cached certificates")
local sni = data.entity
cache:invalidate("pem_ssl_certificates:" .. sni.name)
cache:invalidate("parsed_ssl_certificates:" .. sni.name)
end, "crud", "ssl_servers_names")
worker_events.register(function(data)
log(DEBUG, "[events] SSL cert updated, invalidating cached certificates")
local certificate = data.entity
local rows, err = dao.ssl_servers_names:find_all {
ssl_certificate_id = certificate.id
}
if not rows then
log(ERR, "[events] could not find associated SNIs for certificate: ",
err)
end
for i = 1, #rows do
local sni = rows[i]
cache:invalidate("pem_ssl_certificates:" .. sni.name)
cache:invalidate("parsed_ssl_certificates:" .. sni.name)
end
end, "crud", "ssl_certificates")
-- targets invalidations
worker_events.register(function(data)
log(DEBUG, "[events] Target updated, invalidating target in balancer")
local target = data.entity
cache:invalidate("balancer:targets:" .. target.upstream_id)
end, "crud", "targets")
-- balancer invalidations
worker_events.register(function(data)
log(DEBUG, "[events] Upstream updated, invalidating balancer")
local upstream = data.entity
local ok, err = worker_events.post("balancer", "invalidate", upstream)
if not ok then
log(ERR, "failed broadcasting balancer invalidation to workers: ", err)
end
local data = fmt("%s:%s", upstream.id, upstream.name)
local ok, err = cluster_events:broadcast("balancer:invalidate", data)
if not ok then
log(ERR, "failed broadcasting balancer invalidation to cluster: ", err)
end
end, "crud", "upstreams")
worker_events.register(function(upstream)
cache:invalidate_local("balancer:upstreams")
cache:invalidate_local("balancer:upstreams:" .. upstream.id)
cache:invalidate_local("balancer:targets:" .. upstream.id)
balancer.invalidate_balancer(upstream.name)
end, "balancer", "invalidate")
cluster_events:subscribe("balancer:invalidate", function(data)
local upstream_id, upstream_name = unpack(utils.split(data, ":"))
local ok, err = worker_events.post("balancer", "invalidate", {
id = upstream_id,
name = upstream_name,
})
if not ok then
log(ERR, "failed broadcasting balancer invalidation to workers: ", err)
end
end)
end
},
certificate = {
before = function(ctx)
certificate.execute()
end
},
rewrite = {
before = function(ctx)
ctx.KONG_REWRITE_START = get_now()
end,
after = function (ctx)
ctx.KONG_REWRITE_TIME = get_now() - ctx.KONG_REWRITE_START -- time spent in Kong's rewrite_by_lua
end
},
access = {
before = function(ctx)
-- ensure router is up-to-date
local version, err = singletons.cache:get("router:version", {
ttl = 0
}, function() return utils.uuid() end)
if err then
log(ngx.CRIT, "could not ensure router is up to date: ", err)
elseif router_version ~= version then
-- router needs to be rebuilt in this worker
log(DEBUG, "rebuilding router")
local ok, err = build_router(singletons.dao, version)
if not ok then
router_err = err
log(ngx.CRIT, "could not rebuild router: ", err)
end
end
if not router then
return responses.send_HTTP_INTERNAL_SERVER_ERROR("no router to " ..
"route request (reason: " .. tostring(router_err) .. ")")
end
-- routing request
local var = ngx.var
ctx.KONG_ACCESS_START = get_now()
local match_t = router.exec(ngx)
if not match_t then
return responses.send_HTTP_NOT_FOUND("no API found with those values")
end
local api = match_t.api
local upstream_url_t = match_t.upstream_url_t
local realip_remote_addr = var.realip_remote_addr
local trusted_ip = singletons.ip.trusted(realip_remote_addr)
if api.https_only and not utils.check_https(trusted_ip,
api.http_if_terminated)
then
ngx.header["connection"] = "Upgrade"
ngx.header["upgrade"] = "TLS/1.2, HTTP/1.1"
return responses.send(426, "Please use HTTPS protocol")
end
local balancer_address = {
type = utils.hostname_type(upstream_url_t.host), -- the type of `host`; ipv4, ipv6 or name
host = upstream_url_t.host, -- target host per `upstream_url`
port = upstream_url_t.port, -- final target port
try_count = 0, -- retry counter
tries = {}, -- stores info per try
retries = api.retries, -- number of retries for the balancer
connect_timeout = api.upstream_connect_timeout or 60000,
send_timeout = api.upstream_send_timeout or 60000,
read_timeout = api.upstream_read_timeout or 60000,
-- ip = nil, -- final target IP address
-- balancer = nil, -- the balancer object, in case of a balancer
-- hostname = nil, -- the hostname belonging to the final target IP
}
ctx.api = api
ctx.router_matches = match_t.matches
ctx.balancer_address = balancer_address
-- `scheme` is the scheme to use for the upstream call
-- `uri` is the URI with which to call upstream, as returned by the
-- router, which might have truncated it (`strip_uri`).
-- `host_header` is the original header to be preserved if set.
var.upstream_scheme = upstream_url_t.scheme
var.upstream_uri = match_t.upstream_uri
var.upstream_host = match_t.upstream_host
-- Keep-Alive and WebSocket Protocol Upgrade Headers
if var.http_upgrade and lower(var.http_upgrade) == "websocket" then
var.upstream_connection = "upgrade"
var.upstream_upgrade = "websocket"
else
var.upstream_connection = "keep-alive"
end
-- X-Forwarded-* Headers
--
-- We could use $proxy_add_x_forwarded_for, but it does not work properly
-- with the realip module. The realip module overrides $remote_addr and
-- it is okay for us to use it in case no X-Forwarded-For header was
-- present. But in case it was given, we will append the
-- $realip_remote_addr that contains the IP that was originally in
-- $remote_addr before realip module overrode that (aka the client that
-- connected us).
local http_x_forwarded_for = var.http_x_forwarded_for
if http_x_forwarded_for then
var.upstream_x_forwarded_for = http_x_forwarded_for .. ", " ..
realip_remote_addr
else
var.upstream_x_forwarded_for = var.remote_addr
end
if trusted_ip then
var.upstream_x_forwarded_proto = var.http_x_forwarded_proto or
var.scheme
var.upstream_x_forwarded_host = var.http_x_forwarded_host or
var.host
var.upstream_x_forwarded_port = var.http_x_forwarded_port or
var.server_port
else
var.upstream_x_forwarded_proto = var.scheme
var.upstream_x_forwarded_host = var.host
var.upstream_x_forwarded_port = var.server_port
end
end,
-- Only executed if the `router` module found an API and allows nginx to proxy it.
after = function(ctx)
local var = ngx.var
do
-- Nginx's behavior when proxying a request with an empty querystring
-- `/foo?` is to keep `$is_args` an empty string, hence effectively
-- stripping the empty querystring.
-- We overcome this behavior with our own logic, to preserve user
-- desired semantics.
local upstream_uri = var.upstream_uri
if var.is_args == "?" or sub(var.request_uri, -1) == "?" then
var.upstream_uri = upstream_uri .. "?" .. (var.args or "")
end
end
local ok, err = balancer.execute(ctx.balancer_address)
if not ok then
return responses.send_HTTP_INTERNAL_SERVER_ERROR(
"failed the initial dns/balancer resolve for '" ..
ctx.balancer_address.host .. "' with: " ..
tostring(err))
end
do
-- set the upstream host header if not `preserve_host`
local upstream_host = var.upstream_host
if not upstream_host or upstream_host == "" then
local addr = ctx.balancer_address
upstream_host = addr.hostname
local upstream_scheme = var.upstream_scheme
if upstream_scheme == "http" and addr.port ~= 80 or
upstream_scheme == "https" and addr.port ~= 443
then
upstream_host = upstream_host .. ":" .. addr.port
end
var.upstream_host = upstream_host
end
end
local now = get_now()
ctx.KONG_ACCESS_TIME = now - ctx.KONG_ACCESS_START -- time spent in Kong's access_by_lua
ctx.KONG_ACCESS_ENDED_AT = now
-- time spent in Kong before sending the reqeust to upstream
ctx.KONG_PROXY_LATENCY = now - ngx.req.start_time() * 1000 -- ngx.req.start_time() is kept in seconds with millisecond resolution.
ctx.KONG_PROXIED = true
end
},
balancer = {
before = function()
local addr = ngx.ctx.balancer_address
local current_try = addr.tries[addr.try_count]
current_try.balancer_start = get_now()
end,
after = function ()
local ctx = ngx.ctx
local addr = ctx.balancer_address
local current_try = addr.tries[addr.try_count]
-- record try-latency
local try_latency = get_now() - current_try.balancer_start
current_try.balancer_latency = try_latency
current_try.balancer_start = nil
-- record overall latency
ctx.KONG_BALANCER_TIME = (ctx.KONG_BALANCER_TIME or 0) + try_latency
end
},
header_filter = {
before = function(ctx)
if ctx.KONG_PROXIED then
local now = get_now()
ctx.KONG_WAITING_TIME = now - ctx.KONG_ACCESS_ENDED_AT -- time spent waiting for a response from upstream
ctx.KONG_HEADER_FILTER_STARTED_AT = now
end
end,
after = function(ctx)
local header = ngx.header
if ctx.KONG_PROXIED then
if singletons.configuration.latency_tokens then
header[constants.HEADERS.UPSTREAM_LATENCY] = ctx.KONG_WAITING_TIME
header[constants.HEADERS.PROXY_LATENCY] = ctx.KONG_PROXY_LATENCY
end
if singletons.configuration.server_tokens then
header["Via"] = server_header
end
else
if singletons.configuration.server_tokens then
header["Server"] = server_header
else
header["Server"] = nil
end
end
end
},
body_filter = {
after = function(ctx)
if ngx.arg[2] and ctx.KONG_PROXIED then
-- time spent receiving the response (header_filter + body_filter)
-- we could uyse $upstream_response_time but we need to distinguish the waiting time
-- from the receiving time in our logging plugins (especially ALF serializer).
ctx.KONG_RECEIVE_TIME = get_now() - ctx.KONG_HEADER_FILTER_STARTED_AT
end
end
},
log = {
after = function(ctx)
reports.log()
end
}
}
|
-- MIT License
--
-- Copyright (c) 2021
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
local my_info =
{
version = "1.0.0",
description = "Dissector to parse the Rail Safe Transport Application (RaSTA) protocol.",
repository = "https://github.com/Railway-CCS/dissectors"
}
set_plugin_info(my_info)
------------------------
---- RASTA PROTOCOL ----
-- Wireshark path:
-- Mac: Contents/Plugins/wireshark
--
------------------------
package.prepend_path("rasta_modules")
local MD4 = require("md4");
local Stream = require("stream");
local CRC = require("rasta_crc");
local CRC_LENGTH = 0
local CRC_OPTION = nil
-- print("#######################")
local p_rasta = Proto("rasta", "RaSTA Protocol")
-- Register preferences --
local ALGO_MD4 = 0
local ALGO_BLAKE2 = 1
local ALGO_SIPHASH = 2
local algo_prefs = {
{1, "MD4", ALGO_MD4},
{2, "Blake2b", ALGO_BLAKE2},
{3, "SIPHASH-2-4", ALGO_SIPHASH},
}
local CRC_NONE = 0
local CRC32_EE5B42FD = 1
local CRC32_1EDC6F41 = 2
local CRC16_1021 = 3
local CRC16_8005 = 4
local crc_type = {
{1, "None (Option A)", CRC_NONE},
{1, "CRC32, Poly=EE5B42FD (Option B)", CRC32_EE5B42FD},
{1, "CRC32, Poly=1EDC6F41 (Option C)", CRC32_1EDC6F41},
{1, "CRC16, Poly=1021(Option D)", CRC16_1021},
{1, "CRC16, Poly=8005(Option E)", CRC16_8005},
}
-- safety code parameters
p_rasta.prefs.safety_code_header = Pref.statictext("----- Safety Code -----", "Configuration option for the safety code the send/retransmission layer")
p_rasta.prefs.safety_code_len = Pref.uint("Length", 8, "Length of the safety code in bytes")
p_rasta.prefs.safety_code_algo = Pref.enum("Safety Code Algorithm", ALGO_MD4, "Safety Code Algorithm", algo_prefs, false)
p_rasta.prefs.md4_a = Pref.uint( "MD4 A", 0x67452301, "A value for MD4 safety code calculation as hex string")
p_rasta.prefs.md4_b = Pref.uint( "MD4 B", 0xefcdab89, "B value for MD4 safety code calculation as hex string")
p_rasta.prefs.md4_c = Pref.uint( "MD4 C", 0x98badcfe, "C value for MD4 safety code calculation as hex string")
p_rasta.prefs.md4_d = Pref.uint( "MD4 D", 0x10325476, "D value for MD4 safety code calculation as hex string")
p_rasta.prefs.safety_key = Pref.uint( "Key", 0x123456, "Key for the safety code when MD4 is not used as hex string")
-- CRC parameters
p_rasta.prefs.crc_header = Pref.statictext("----- CRC -----", "Configuration option for the redundancy layer CRC checksum")
p_rasta.prefs.crc_algo = Pref.enum("CRC Type", CRC_NONE, "CRC algorithm parameters", crc_type, false)
local vals_message_type = {
[6200] = "Connection Request",
[6201] = "Connection Response",
[6212] = "Retransmission Request",
[6213] = "Retransmission Response",
[6216] = "Disconnection Request",
[6220] = "Heartbeat",
[6240] = "Data",
[6241] = "Retransmitted Data"
}
local vals_disconnect_reason = {
[0] = "user enquiry",
[1] = "not in use",
[2] = "received message type not expected for the current state",
[3] = "error in the sequence number verification during connection establishment",
[4] = "timeout for incoming messages",
[5] = "service not allowed in this state",
[6] = "error in the protocol version",
[7] = "retransmission failed, requested sequence number not available",
[8] = "error in the protocol sequence"
}
-- redundancy properties
local redundancy_message_length = ProtoField.uint16("rasta.redundancy.mlen", "Length")
local redundancy_reserve_bytes = ProtoField.uint16("rasta.redundancy.reserve", "Reserve")
local redundancy_sequence_number = ProtoField.uint16("rasta.redundancy.sn", "Sequence number")
local redundancy_check_code = ProtoField.new("Check code", "rasta.redundancy.check_code", ftypes.BYTES)
local redundancy_check_code_valid = ProtoField.new("Check code valid", "rasta.redundancy.check_code_valid", ftypes.BOOLEAN)
-- rasta properties
local safety_message_length = ProtoField.uint16("rasta.safety.mlen", "Message length")
local safety_message_type = ProtoField.uint16("rasta.safety.type", "Message type", base.DEC, vals_message_type)
local safety_dest_id = ProtoField.uint16("rasta.safety.dest_id", "Receiver identification")
local safety_src_id = ProtoField.uint16("rasta.safety.src_id", "Sender identification")
local safety_sequence_number = ProtoField.uint16("rasta.safety.sn", "Sequence number")
local safety_c_sequence_number = ProtoField.uint16("rasta.safety.cs", "Confirmed Sequence Number")
local safety_timestamp = ProtoField.uint16("rasta.safety.ts", "Time stamp")
local safety_c_timestamp = ProtoField.uint16("rasta.safety.cts", "Confirmed time stamp")
local safety_protocol_version = ProtoField.string("rasta.safety.protocol_version", "Protocol version")
local safety_n_sendmax = ProtoField.uint16("rasta.safety.n_sendmax", "N sendmax")
local safety_reserve = ProtoField.new("Reserve", "rasta.safety.reserve", ftypes.BYTES)
local safety_data = ProtoField.string("rasta.safety.data", "Payload data")
local safety_detailed = ProtoField.new("Detailed information", "rasta.safety.detailed", ftypes.BYTES)
local safety_reason = ProtoField.uint16("rasta.safety.reason", "Reason", base.DEC, vals_disconnect_reason)
local safety_safety_code = ProtoField.new("Safety code", "rasta.safety.safety_code", ftypes.BYTES)
local safety_safety_code_valid = ProtoField.new("Safety code valid", "rasta.safety.safety_code_valid", ftypes.BOOLEAN)
p_rasta.fields = {
-- rasta redundancy packet
redundancy_message_length,
redundancy_reserve_bytes,
redundancy_sequence_number,
redundancy_check_code,
redundancy_check_code_valid,
-- rasta packet
safety_message_length,
safety_message_type,
safety_dest_id,
safety_src_id,
safety_sequence_number,
safety_c_sequence_number,
safety_timestamp,
safety_c_timestamp,
safety_data,
safety_protocol_version,
safety_n_sendmax,
safety_reserve,
safety_detailed,
safety_reason,
safety_safety_code,
safety_safety_code_valid
}
-- redundancy dissector
function p_rasta.dissector(buf, pktinfo, root)
pktinfo.cols.protocol:set("RaSTA")
local pktlen = buf:reported_length_remaining()
local tree = root:add(p_rasta, buf:range(0, pktlen))
local data_length = buf:range(8,2):le_uint() - 28
-- print(pktlen)
-- redundancy layer
local redundancy = tree:add(p_rasta, buf(), "Redundancy Layer")
redundancy:add_le(redundancy_message_length, buf:range(0, 2))
redundancy:add_le(redundancy_reserve_bytes, buf:range(2, 2))
redundancy:add_le(redundancy_sequence_number, buf:range(4, 4))
local red_code_itm = redundancy:add_le(redundancy_check_code, buf:range(data_length + 28 + p_rasta.prefs.safety_code_len,
pktlen - data_length - 28 - p_rasta.prefs.safety_code_len ))
-- select crc options from preferences
if p_rasta.prefs.crc_algo == CRC_NONE then
CRC_OPTION = nil
CRC_LENGTH = 0
elseif p_rasta.prefs.crc_algo == CRC32_EE5B42FD then
CRC_OPTION = CRC.opt_b()
CRC_LENGTH = 4
elseif p_rasta.prefs.crc_algo == CRC32_1EDC6F41 then
CRC_OPTION = CRC.opt_c()
CRC_LENGTH = 4
elseif p_rasta.prefs.crc_algo == CRC16_1021 then
CRC_OPTION = CRC.opt_d()
CRC_LENGTH = 2
elseif p_rasta.prefs.crc_algo == CRC16_8005 then
CRC_OPTION = CRC.opt_e()
CRC_LENGTH = 2
end
if CRC_LENGTH > 0 then
print("ENTER")
-- check redundancy crc code for validity
local redundancy_packet = buf:raw(0, pktlen - CRC_OPTION.width/8)
local expected_crc = string.format("%0" .. CRC_OPTION.width/4 .."x", swap_endianness(CRC.calculate(CRC_OPTION, redundancy_packet)))
local actual_crc = Stream.toHex(Stream.fromString(buf:raw(data_length + 28 + p_rasta.prefs.safety_code_len, CRC_OPTION.width/8))):lower()
if ( expected_crc == actual_crc ) then
-- valid CRC
valid_item = redundancy:add(redundancy_check_code_valid, buf:range(data_length + 28 + p_rasta.prefs.safety_code_len, CRC_OPTION.width/8), true)
valid_item:set_generated()
print("VALID CRC")
else
-- invalid CRC
red_code_itm:add_expert_info(PI_CHECKSUM, PI_WARN, "Invalid Checksum, expected " .. expected_crc)
valid_item = redundancy:add(redundancy_check_code_valid, buf:range(data_length + 28 + p_rasta.prefs.safety_code_len, CRC_OPTION.width/8), false)
valid_item:set_generated()
end
end
-- safety and retransmission layer
local msg_type = buf:range(10,2)
pktinfo.cols.info:append(" " .. get_rasta_type_short(msg_type:le_uint()))
local safety = tree:add(p_rasta, buf:range(8, 28 + data_length), "Safety and Retransmission Layer")
safety:add_le(safety_message_length, buf:range(8, 2))
safety:add_le(safety_message_type, buf:range(10, 2))
safety:add_le(safety_dest_id, buf:range(12, 4))
safety:add_le(safety_src_id, buf:range(16, 4))
safety:add_le(safety_sequence_number, buf:range(20, 4))
safety:add_le(safety_c_sequence_number, buf:range(24, 4))
safety:add_le(safety_timestamp, buf:range(28, 4))
safety:add_le(safety_c_timestamp, buf:range(32, 4))
if (msg_type:le_uint() == 6200 or msg_type:le_uint() == 6201) then
-- connection request or connection response
safety:add(safety_protocol_version, buf:range(36, 4))
safety:add_le(safety_n_sendmax, buf:range(40, 2))
safety:add_le(safety_reserve, buf:range(42, 8))
elseif (msg_type:le_uint() == 6240 or msg_type:le_uint() == 6241) then
-- data and retransmitted data
safety:add_le(safety_data, buf:range(36, data_length - p_rasta.prefs.safety_code_len))
-- call sci-dissector if possible
if pcall(function () Dissector.get("sci") end) then
Dissector.get("sci"):call(buf:range(36, data_length - p_rasta.prefs.safety_code_len):tvb(), pktinfo, root)
end
elseif (msg_type:le_uint() == 6216) then
-- disconnect request message
safety:add_le(safety_detailed, buf:range(36, 2))
safety:add(safety_reason, buf:range(38, 2))
end
-- check safety code
if p_rasta.prefs.safety_code_algo == ALGO_MD4 then
local safety_packet = buf:raw(8, pktlen - 8 - CRC_LENGTH - p_rasta.prefs.safety_code_len)
local packet_md4 = MD4()
.init(p_rasta.prefs.md4_a, p_rasta.prefs.md4_b, p_rasta.prefs.md4_c, p_rasta.prefs.md4_d)
.update(Stream.fromString(safety_packet))
.finish()
.asHex()
local expected_md4 = packet_md4:sub(0, p_rasta.prefs.safety_code_len * 2):lower()
local actual_md4 = Stream.toHex(Stream.fromString(buf:raw(36 + data_length - 8, 8))):lower()
local treeItm = safety:add(safety_safety_code, buf:range(36 + data_length - 8, 8))
if ( expected_md4 == actual_md4 ) then
-- valid MD4
valid_item = safety:add(safety_safety_code_valid, buf:range(36 + data_length - 8, 8), true)
valid_item:set_generated()
else
-- invalid MD4
treeItm:add_expert_info(PI_CHECKSUM, PI_WARN, "Invalid Checksum, expected " .. expected_md4)
valid_item = safety:add(safety_safety_code_valid, buf:range(36 + data_length - 8, 8), false)
valid_item:set_generated()
end
else
-- blake2b and siphash-2-4 not supported
safety:add_expert_info(PI_CHECKSUM, PI_WARN, "Checksum algorithm not supported")
end
return pktlen
end
local function heuristic_checker(buffer, pinfo, tree)
-- guard for length
length = buffer:len()
if length < 36 then return false end
-- reserve in redundancy layer
local potential_proto_flag = buffer(2,2):uint()
if potential_proto_flag ~= 0x0000 then return false end
-- RaSTA SR message type
local potential_msg_type = buffer(10,2):le_uint()
if get_rasta_type_short(potential_msg_type) ~= "unknown type"
then
p_rasta.dissector(buffer, pinfo, tree)
return true
else return false end
end
p_rasta:register_heuristic("udp", heuristic_checker)
-- HELPER FUNCTION SECTION
function get_rasta_type_short(type)
if (type == 6200) then return "ConnReq"
elseif (type == 6201) then return "ConnResp"
elseif (type == 6212) then return "RetrReq"
elseif (type == 6213) then return "RetrResp"
elseif (type == 6216) then return "DiscReq"
elseif (type == 6220) then return "HB"
elseif (type == 6240) then return "Data"
elseif (type == 6241) then return "RetrData"
else return "unknown type"
end
end
function swap_endianness(num)
local b0 = bit32.lshift(bit32.band(num, 0x000000ff), 24)
local b1 = bit32.lshift(bit32.band(num, 0x0000ff00), 8)
local b2 = bit32.rshift(bit32.band(num, 0x00ff0000), 8)
local b3 = bit32.rshift(bit32.band(num, 0xff000000), 24)
return bit32.bor(b0, b1, b2, b3)
end
|
local ChangedTable={}
function IsChanged(val,id,meta)
if(meta==nil)then
meta = ChangedTable
end
if(meta.ChangedTable==nil)then
meta['ChangedTable']={}
end
if( meta.ChangedTable[id] == val )then return false end
meta.ChangedTable[id]=val
return true
end
|
-----------------------------------
--
-- Zone: West_Ronfaure (100)
--
-----------------------------------
local ID = require("scripts/zones/West_Ronfaure/IDs")
require("scripts/quests/i_can_hear_a_rainbow")
require("scripts/globals/chocobo_digging")
require("scripts/globals/conquest")
require("scripts/globals/missions")
-----------------------------------
function onChocoboDig(player, precheck)
return tpz.chocoboDig.start(player, precheck)
end
function onInitialize(zone)
tpz.conq.setRegionalConquestOverseers(zone:getRegionID())
end
function onZoneIn(player, prevZone)
local cs = -1
if player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0 then
player:setPos(-24.427, -53.107, 140, 127)
end
if quests.rainbow.onZoneIn(player) then
cs = 51
elseif player:getCurrentMission(WINDURST) == tpz.mission.id.windurst.VAIN and player:getCharVar("MissionStatus") == 1 then
cs = 53
end
return cs
end
function onConquestUpdate(zone, updatetype)
tpz.conq.onConquestUpdate(zone, updatetype)
end
function onRegionEnter(player, region)
end
function onEventUpdate(player, csid, option)
if csid == 51 then
quests.rainbow.onEventUpdate(player)
elseif csid == 53 then
player:updateEvent(0, 0, 0, 0, 0, 5)
end
end
function onEventFinish(player, csid, option)
end
|
TatooineDarklightersEstateScreenPlay = ScreenPlay:new {
numberOfActs = 1,
screenplayName = "TatooineDarklightersEstateScreenPlay"
}
registerScreenPlay("TatooineDarklightersEstateScreenPlay", true)
function TatooineDarklightersEstateScreenPlay:start()
if (isZoneEnabled("tatooine")) then
self:spawnMobiles()
end
end
function TatooineDarklightersEstateScreenPlay:spawnMobiles()
spawnMobile("tatooine", "informant_npc_lvl_2",0,-685,8,-6731,0,0)
spawnMobile("tatooine", "informant_npc_lvl_2",0,-703,8,-6734,0,0)
end
|
object_mobile_storyteller_loveday_mister_hate = object_mobile_shared_storyteller_loveday_mister_hate:new {
}
ObjectTemplates:addTemplate(object_mobile_storyteller_loveday_mister_hate, "object/mobile/storyteller_loveday_mister_hate.iff")
|
-- universal table to store forward declarations relating to screen dimensions
local screenSize = {}
return screenSize
|
local maxuploaded_maps = 3
-------------
-- newMap --
-------------
local uploadedfolder = "[maps]\\[uploadedmaps]"
function newMap(map, forumid, mta_name)
local mapname = tostring(map) .. '_newupload'
outputDebugString('newMap ' .. mapname)
refreshResources()
setTimer(refreshResources, 2000, 1)
local mapres = getResourceFromName(map)
if mapres then
if getResourceInfo(mapres, "forumid") then
if getResourceInfo(mapres, "forumid") ~= tostring(forumid) then
return 'This mapname is already in use on the server, only ' .. getResourceInfo(mapres, "mta_name") .. ' can update ' .. map, ''
end
-- else
-- outputDebugString('new map already exists ' .. map)
-- outputConsole('new map already exists ' .. map)
-- return 'This map is already on the server (' .. map .. '), contact a mapmanager if you want to update it', ''
end
else
local mapsInQ = 0
for k, r in ipairs(getResources()) do
if getResourceInfo(r, "forumid") == tostring(forumid) and getResourceInfo(r, "newupload") == "true" then
mapsInQ = mapsInQ + 1
end
end
if mapsInQ >= maxuploaded_maps then
return 'You already have the max amount of maps (' .. maxuploaded_maps .. ') uploaded, wait untill a mapmanager tests your maps before uploading another one', ''
end
end
local res = getResourceFromName(mapname)
if not res then
outputDebugString('loading failed ' .. mapname)
outputConsole('loading failed ' .. mapname)
return 'Could not load ' .. tostring(map), ''
end
local s = getResourceLoadFailureReason(res)
setResourceInfo(res, "newupload", "true")
setResourceInfo(res, "forumid", tostring(forumid))
setResourceInfo(res, "mta_name", mta_name)
setResourceInfo(res, "uploadtick", tostring(getRealTime().timestamp))
if s ~= '' then
if getResourceState(res) == "running" then
stopResource(res)
end
deleteResource(mapname)
outputDebugString(s..': deleting ' .. mapname)
outputConsole(s..': deleting ' .. mapname)
end
return tostring(s), mapres and getResourceInfo(mapres, "forumid") == tostring(forumid) and "Update" or "New"
end
function handlemap(p, c, resname, ...)
if not handlerConnect or not resname then return false end
local mapname = resname .. '_newupload'
local res = getResourceFromName(mapname)
if not res then
return outputChatBox(c..': could not find res ' .. resname, p)
elseif getResourceInfo(res, "newupload") ~= "true" then
return outputChatBox(c..': resource is not a new map ' .. resname, p)
end
if getResourceState(res) == "running" then
-- deleteRes = res
return outputChatBox(c..': can\'t use this while the map is running ' .. resname, p)
end
local mta_name = getResourceInfo(res, "mta_name")
local comment = table.concat({...}, ' ')
local manager = tostring(getAccountName(getPlayerAccount(p)))
local status = (c == "acceptmap" and "Accepted" or "Declined")
if c == "acceptmap" then
if getResourceFromName(resname) then
deleteResource(getResourceFromName(resname))
end
local newRes = copyResource(res, resname, uploadedfolder)
setResourceInfo(newRes, "newupload", "false")
end
deleteResource(mapname)
local query = "INSERT INTO uploaded_maps (resname, uploadername, comment, manager, status) VALUES (?,?,?,?,?)"
local theExec = dbExec ( handlerConnect, query, resname, mta_name, comment, manager, status)
outputChatBox(c..': done ' .. resname, p)
fetchMaps(p)
end
addCommandHandler('acceptmap', handlemap, true)
addCommandHandler('declinemap', handlemap, true)
function checkDeleteMap()
if deleteRes and deleteRes ~= exports.mapmanager:getRunningGamemodeMap() then
deleteResource(getResourceName(deleteRes))
deleteRes = nil
end
end
addEventHandler('onMapStarting', root, checkDeleteMap)
--facilitating map deletion--
deletedMapsPath = "[maps]\\[deletedmaps]"
addEvent('onMapStarting', true)
function connectToDB()
if handlerConnect then return true end
handlerConnect = dbConnect( 'mysql', 'host=' .. get"*gcshop.host" .. ';dbname=' .. get"*gcshop.dbname", get("*gcshop.user"), get("*gcshop.pass"))
if not handlerConnect then
return outputDebugString('maptools: could not connect to the mysql db')
end
moveMapDeletionCache() -- Map deletion entries are stored locally if the mysql database does not work, if it works again move them to mysql
end
addEventHandler('onResourceStart', resourceRoot, connectToDB)
function onNewMapStart()
local map = g_Map
if map == exports.mapmanager:getRunningGamemodeMap() then --if map that was deleted gets replayed before deletion, halt deletion for the next map.
return
end
local name = getResourceInfo(map, "name")
local authr = getResourceInfo(map,"author")
if not authr then authr = "N/A" end
-- First copy resource to "[deletedmaps]" folder, then deleteResource(), because the trash folder is unreliable
local resname = getResourceName(map)
-- set
setResourceInfo(map,"gamemodes","race_deleted")
setResourceInfo(map,"deleted","true")
setResourceInfo(map,"deleteReason",g_Reason)
setResourceInfo(map,"deletedBy",g_AccName)
setResourceInfo(map,"deleteTimeStamp",tostring(getRealTime().timestamp))
-- Check if copied deleted resource exists, if so then delete first.
if getResourceFromName( resname.."_deleted" ) then
deleteResource( resname.."_deleted" )
end
copyResource(map,resname.."_deleted",deletedMapsPath)
local delete = deleteResource(resname)
if not delete then
if isElement(g_P) then outputChatBox("Error: Map cannot be deleted.", g_P) end
canUseCommand = true
g_Map = nil
g_P = nil
g_Reason = nil
g_AccName = nil
removeEventHandler('onMapStarting', root, onNewMapStart)
return
end
if isElement(g_P) then
outputChatBox("Map deleted: "..name, g_P)
end
addMapDeletionRecord(name,authr,g_Reason,g_AccName,resname)
refreshResources()
canUseCommand = true
g_Map = nil
g_P = nil
g_Reason = nil
g_AccName = nil
removeEventHandler('onMapStarting', root, onNewMapStart)
-- fetchMaps()
end
canUseCommand = true
g_Map = nil
g_P = nil
g_Reason = nil
g_AccName = nil
addCommandHandler('deletemap',
function(p,_,...)
if not (hasObjectPermissionTo(p, "function.banPlayer", false)) then return end
if not arg then outputChatBox("Error: Give a reason for map deletion. ( /deletemap full reason )", p) return end
local fullReason = table.concat(arg," ")
if not fullReason or #fullReason < 1 then outputChatBox("Error: Give a reason for map deletion. ( /deletemap full reason )", p) return end
--get current map running, copy it over as a backup and delete it from map list via refresh.
if not canUseCommand then outputChatBox("Error: Can't use command. An admin has already deleted this map.", p) return end
local map = exports.mapmanager:getRunningGamemodeMap()
if not map then outputChatBox("Error: No map.", p) return end
local adminAccName = getAccountName(getPlayerAccount(p))
if not adminAccName then outputChatBox("Error: Unable to retrieve account name, contact a developer if this keeps happening.", p) return end
outputChatBox("Deleting current map at the start of the next map! (reason: "..fullReason..") by "..getPlayerName(p), root, 255, 0, 0)
g_Map = map
g_P = p
g_Reason = fullReason
g_AccName = adminAccName
addEventHandler('onMapStarting', root, onNewMapStart)
canUseCommand = false
end
)
function addMapDeletionRecord(mapname,author,reason,adminName,resname)
connectToDB() -- Retry db connection
if handlerConnect then -- if there is db connection, else save in local db file
moveMapDeletionCache()
local query = "INSERT INTO uploaded_maps (mapname, uploadername, comment, manager, resname, status) VALUES (?,?,?,?,?,'Deleted')"
dbExec ( handlerConnect, query,tostring(mapname),tostring(author),tostring(reason),tostring(adminName),tostring(resname) )
else -- save to local db
local theXML = xmlLoadFile("mapdeletioncache.xml")
if not theXML then
theXML = xmlCreateFile("mapdeletioncache.xml","entries")
end
if not theXML then return false end
local child = xmlCreateChild(theXML,"map")
xmlNodeSetAttribute(child,"name",tostring(mapname))
xmlNodeSetAttribute(child,"author",tostring(author))
xmlNodeSetAttribute(child,"reason",tostring(reason))
xmlNodeSetAttribute(child,"admin_name",tostring(adminName))
xmlNodeSetAttribute(child,"resname",tostring(resname))
xmlSaveFile(theXML)
xmlUnloadFile(theXML)
end
end
function moveMapDeletionCache() -- Moves from cache xml to mysql db
if not handlerConnect then return false end
local theXML = xmlLoadFile("mapdeletioncache.xml")
if not theXML then return end
local children = xmlNodeGetChildren(theXML)
if not children or (#children < 1 )then xmlUnloadFile(theXML) return false end
for i,child in ipairs(children) do
local mapname = xmlNodeGetAttribute(child,"name")
local author = xmlNodeGetAttribute(child,"author")
local reason = xmlNodeGetAttribute(child,"reason")
local adminName = xmlNodeGetAttribute(child,"admin_name")
local resname = xmlNodeGetAttribute(child,"resname")
local query = "INSERT INTO uploaded_maps (mapname, uploadername, comment, manager, resname, status) VALUES (?,?,?,?,?,'Deleted')"
local theExec = dbExec ( handlerConnect, query,tostring(mapname),tostring(author),tostring(reason),tostring(adminName),tostring(resname) )
if theExec then
xmlDestroyNode(child)
end
xmlSaveFile(theXML)
xmlUnloadFile(theXML)
end
end
--Get Maplist and deletedMap list for client gui
function fetchMaps(player)
refreshResources()
local mapList = {}
local deletedMapList = {}
local uploadedMapList = {}
-- Get race and uploaded maps
local raceMps = exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName("race"))
local mapRatings = exports.mapratings:getTableOfRatedMaps()
if not raceMps or not mapRatings then return false end
for _,map in ipairs(raceMps) do
local name = getResourceInfo(map,"name")
local author = getResourceInfo(map,"author")
local resname = getResourceName(map)
if not name then name = resname end
if not author then author = "N/A" end
local t = {name = name, author = author, resname = resname, likes = "-", dislikes = "-"}
local rating = mapRatings[resname]
if rating then
t.likes = rating.likes
t.dislikes = rating.dislikes
end
table.insert(mapList,t)
end
-- Deleted and uploaded maps
local allRes = getResources()
if not allRes then return false end
for _,map in ipairs(allRes) do
if getResourceInfo(map,"gamemodes") == "race_deleted" then
local name = getResourceInfo(map,"name")
local author = getResourceInfo(map,"author")
local deletedBy = getResourceInfo(map,"deletedBy")
local deleteTimeStamp = getResourceInfo(map,"deleteTimeStamp")
local deleteReason = getResourceInfo(map,"deleteReason")
local resname = getResourceName(map)
local t = {name = name, author = author, resname = resname, deletedBy = deletedBy, deleteTimeStamp = deleteTimeStamp, deleteReason = deleteReason}
table.insert(deletedMapList,t)
elseif getResourceInfo(map,"newupload") == "true" then
local name = getResourceInfo(map,"name")
local author = getResourceInfo(map,"author")
local uploadtick = tonumber(getResourceInfo(map,"uploadtick"))
local resname = getResourceName(map)
local new = getResourceFromName(string.gsub(resname, "_newupload", "")) and "Update" or "New"
local t = {name = name, author = author, resname = resname, uploadtick = uploadtick, new = new}
table.insert(uploadedMapList,t)
end
end
table.sort(uploadedMapList,function(a,b) return tostring(a.uploadtick) > tostring(b.uploadtick) end)
table.sort(deletedMapList,function(a,b) return tostring(a.deleteTimeStamp) > tostring(b.deleteTimeStamp) end)
table.sort(mapList,function(a,b) return tostring(a.name) < tostring(b.name) end)
triggerClientEvent(player,"mm_receiveMapLists",resourceRoot,uploadedMapList,deletedMapList,mapList,hasObjectPermissionTo(player,"command.deletemap",false))
end
addCommandHandler("managemaps",fetchMaps)
addCommandHandler("mm",fetchMaps)
addCommandHandler("deletedmaps",fetchMaps)
addCommandHandler("maps",fetchMaps)
-- Editing resources --
function editmap(player, cmd, mapname)
local map = mapname and getResourceFromName(mapname) or false
if not map then return outputChatBox("Map not found ", player) end
local accName = getAccountName ( getPlayerAccount ( player ) )
if not exports.mapmanager:isMap(map) and not isObjectInACLGroup ("user."..accName, aclGetGroup ( "ServerManager" )) then
outputChatBox("This resource does not exist or can not be edited", player)
return
end
local meta = xmlLoadFile(':' .. mapname .. '/meta.xml')
if not meta then return outputChatBox("Could not open meta " .. mapname, player) end
local files = {{file="meta.xml",type="meta"}}
for k, node in ipairs(xmlNodeGetChildren(meta)) do
if xmlNodeGetAttribute(node, "src") and (xmlNodeGetName(node) == "map" or xmlNodeGetName(node) == "script") then
table.insert(files, {file=xmlNodeGetAttribute(node, "src"), type=xmlNodeGetName(node)})
end
end
triggerClientEvent(player, "editMapFilesList", resourceRoot, mapname, files)
xmlUnloadFile(meta)
end
addCommandHandler("editmap", editmap, true)
function editfile(player, cmd, mapname, src)
local map = mapname and getResourceFromName(mapname) or false
if not map then return outputChatBox("Map not found ", player) end
local accName = getAccountName ( getPlayerAccount ( player ) )
if not exports.mapmanager:isMap(map) and not isObjectInACLGroup ("user."..accName, aclGetGroup ( "ServerManager" )) then
outputChatBox("This resource does not exist or can not be edited", player)
return
end
local file = fileOpen(':' .. mapname .. '/' .. src)
if not file then return outputChatBox("Could not open :" .. mapname .. '/' ..src, player) end
local text = fileRead(file, fileGetSize(file))
fileClose(file)
triggerClientEvent(player, "editFileText", resourceRoot, mapname, src, text)
end
addCommandHandler("editfile", editfile, true)
function savefile(mapname, src, text)
local player = client
local map = mapname and getResourceFromName(mapname) or false
if not map then return outputChatBox("Map not found ", player) end
local accName = getAccountName ( getPlayerAccount ( player ) )
if not (hasObjectPermissionTo(player, "command.editfile", false)) then
outputChatBox("You have no access to this", player)
return
elseif not exports.mapmanager:isMap(map) and not isObjectInACLGroup ("user."..accName, aclGetGroup ( "ServerManager" )) then
outputChatBox("This resource does not exist or can not be edited", player)
return
end
-- create a backup
local backup = fileCopy(':' .. mapname .. '/' .. src, ':' .. mapname .. '/' .. src .. '.' .. getRealTime().timestamp .. '.bak', true)
if not backup then return outputChatBox("Could not create backup. Changes aren't saved.", player) end
local deletefile = fileDelete(':' .. mapname .. '/' .. src)
if not deletefile then return outputChatBox("Could not overwrite:" .. mapname .. '/' ..src, player) end
local file = fileCreate(':' .. mapname .. '/' .. src)
if not file then return outputChatBox("Could not overwrite:" .. mapname .. '/' ..src, player) end
fileWrite(file, text)
fileClose(file)
outputChatBox("Saved file " .. ':' .. mapname .. '/' .. src .. " and made a backup", player)
end
addEvent("savefile", true)
addEventHandler("savefile", resourceRoot, savefile)
-- Clientside events for commands
addEvent("cmm_restoreMap",true)
function restoreMap(map)
if hasObjectPermissionTo(client,"command.deletemap",false) then
local theRes = getResourceFromName(map.resname)
if not theRes then outputChatBox("Error: map can not be restored (can't find map resource)",client,255,0,0) return end
local properName = string.gsub(map.resname,"_deleted","")
local raceMode = getResourceInfo(theRes,"racemode")
if not raceMode then raceMode = "[maps]/[dd]" else raceMode = "[maps]/["..raceMode.."]" end
local theCopy
local sn = string.lower(getServerName())
if string.find(sn,"mix") then -- looks if mix or race server
theCopy = copyResource(theRes,properName,raceMode)
else
theCopy = copyResource(theRes,properName,"[maps]")
end
if not theCopy then outputChatBox("Can't copy map, resource may already exist",client,255,0,0) return end
deleteResource(theRes)
setResourceInfo(theCopy,"gamemodes","race")
setResourceInfo(theCopy,"deleted","false")
if handlerConnect then -- if there is db connection, else save in local db file
local query = "INSERT INTO uploaded_maps (mapname, uploadername, manager, resname, status) VALUES (?,?,?,?,'Restored')"
dbExec ( handlerConnect, query,getResourceInfo(theCopy, "name") or properName,getResourceInfo(theCopy,"author") or "N/A",tostring(getAccountName(getPlayerAccount(client))),properName)
end
outputChatBox("Map '".. getResourceName(theCopy) .."' restored!",client)
refreshResources()
fetchMaps(client)
end
end
addEventHandler("cmm_restoreMap",root,restoreMap)
addEvent("cmm_deleteMap",true)
function deleteMapFromGUI(map,reason) -- Admin deleted map via the gui
if hasObjectPermissionTo(client,"command.deletemap",false) then
if map == exports.mapmanager:getRunningGamemodeMap() then
outputChatBox("The map you are trying to delete is currently playing, use /deletemap instead!",client,255,0,0)
return
end
local theRes = getResourceFromName(map.resname)
if not theRes then
outputChatBox("error: Can't find map resource!",client,255,0,0)
end
local adminAccName = getAccountName(getPlayerAccount(client))
if not adminAccName then outputChatBox("Error: Unable to retrieve account name, contact a developer if this keeps happening.", client,255,0,0) return end
setResourceInfo(theRes,"gamemodes","race_deleted")
setResourceInfo(theRes,"deleted","true")
setResourceInfo(theRes,"deleteReason",reason)
setResourceInfo(theRes,"deletedBy",adminAccName)
setResourceInfo(theRes,"deleteTimeStamp",tostring(getRealTime().timestamp))
-- Check if copied deleted resource exists, if so then delete first.
if getResourceFromName( map.resname.."_deleted" ) then
deleteResource( map.resname.."_deleted" )
end
copyResource(theRes,map.resname.."_deleted",deletedMapsPath)
local delete = deleteResource(map.resname)
if not delete and isElement(client) then
outputChatBox("Error: Map cannot be deleted.",client,255,0,0)
return
end
if isElement(client) then
outputChatBox("Map deleted: "..tostring(map.name),client)
end
addMapDeletionRecord(map.name,map.author,reason,adminAccName,map.resname)
refreshResources()
fetchMaps(client)
end
end
addEventHandler("cmm_deleteMap",root,deleteMapFromGUI)
addEvent("nextmap",true)
function nextMapFromGUI(map) -- Admin next upload map via the gui
if hasObjectPermissionTo(client,"command.nextmap",false) then
executeCommandHandler("nextmap", client, map.."_newupload")
end
end
addEventHandler("nextmap",root,nextMapFromGUI)
addEvent("acceptmap",true)
function acceptMapFromGUI(map, comment) -- Admin accept upload map via the gui
if hasObjectPermissionTo(client,"command.acceptmap",false) then
executeCommandHandler("acceptmap", client, map .. ' ' .. (comment or ''))
end
end
addEventHandler("acceptmap",root,acceptMapFromGUI)
addEvent("declinemap",true)
function declineMapFromGUI(map, comment) -- Admin decline upload map via the gui
if hasObjectPermissionTo(client,"command.declinemap",false) then
executeCommandHandler("declinemap", client, map .. ' ' .. (comment or ''))
end
end
addEventHandler("declinemap",root,declineMapFromGUI)
addEvent("editmap",true)
function editMapFromGUI(map) -- Admin editing map via the gui
if hasObjectPermissionTo(client,"command.editmap",false) then
executeCommandHandler("editmap", client, map)
end
end
addEventHandler("editmap",root,editMapFromGUI)
addEvent("editfile",true)
function editFileFromGUI(map,src) -- Admin editing file via the gui
if hasObjectPermissionTo(client,"command.editfile",false) then
executeCommandHandler("editfile", client, map..' '..src)
end
end
addEventHandler("editfile",root,editFileFromGUI)
|
mapFeatures = {
alienplant1 = {120,14,130,0,-3,-5,0,1,0}, -- feature model name, without extension or path
alienplant2 = {130,14,100,0,-3,0,0,1,0},
}
return mapFeatures
|
scion_proto = Proto("scion", "SCION Protocol")
local pathTypes = {
[0] = "Empty",
[1] = "SCION",
[2] = "OneHop",
[3] = "EPIC",
[4] = "COLIBRI",
}
-- This is a combination of address type and length
local addrTypes = {
[0x0] = "IPv4", -- 0000
[0x4] = "SVC", -- 0100
[0x3] = "IPv6", -- 0011
}
local hdrTypes = {
[17] = "UDP",
[200] = "HOP_BY_HOP",
[201] = "END_TO_END",
[202] = "SCMP",
[203] = "BFD",
}
local svcTypes = {
[0x0001] = "DS",
[0x0002] = "CS",
[0x0003] = "SB",
[0x0004] = "SIG",
[0x0005] = "HPS",
}
local flagType = {
[0] = "Not Set",
[1] = "Set",
}
local LINE_LEN = 4
-- Maximum SCION Hop Field TTL - one day in seconds
local HOP_MAX_TTL = 24 * 60 * 60
-- Expired time unit ~5m38s
local HOP_EXP_UNIT = HOP_MAX_TTL / 256
--local scion_raw = ProtoField.bytes("scion.raw", "Raw packet")
local scion_version = ProtoField.uint32("scion.version", "Version", base.DEC, nil, 0xf0000000)
local scion_qos = ProtoField.uint32("scion.qos", "QoS", base.HEX, nil, 0x0ff00000)
local scion_flow_id = ProtoField.uint32("scion.flow_id", "FlowID", base.HEX, nil, 0x000fffff)
local scion_next_hdr = ProtoField.uint8("scion.next_hdr", "Next Header", base.DEC, hdrTypes)
local scion_hdr_len = ProtoField.uint8("scion.hdr_len", "Header Length", base.DEC)
local scion_hdr_len_bytes = ProtoField.uint16("scion.hdr_len_bytes", "Heaer Length Bytes",
base.UNIT_STRING, {" bytes"})
local scion_payload_len = ProtoField.uint16("scion.payload_len", "Payload Length",
base.UNIT_STRING, {" bytes"})
local scion_path_type = ProtoField.uint8("scion.path_type", "Path Type", base.DEC, pathTypes)
--local scion_dtdlstsl = ProtoField.uint8("scion.dtdlstsl", "DT_DL_ST_SL", base.HEX)
local scion_dst_type_len = ProtoField.uint8("scion.dst_type_len", "Destination Type",
base.HEX, addrTypes, 0xf0)
local scion_src_type_len = ProtoField.uint8("scion.src_type_len", "Source Type",
base.HEX, addrTypes, 0x0f)
local scion_rsv = ProtoField.uint16("scion.rsv", "Reserved", base.HEX)
local scion_dst_isd = ProtoField.uint16("scion.dst_isd", "Destination ISD", base.DEC)
--local scion_dst_as_raw = ProtoField.bytes("scion.dst_as_raw", "Raw Destination AS", base.SPACE)
local scion_dst_as = ProtoField.string("scion.dst_as", "Destination AS")
local scion_src_isd = ProtoField.uint16("scion.src_isd", "Source ISD", base.DEC)
--local scion_src_as_raw = ProtoField.bytes("scion.src_as_raw", "Raw Source AS", base.SPACE)
local scion_src_as = ProtoField.string("scion.src_as", "Source AS")
local scion_dst_host = ProtoField.string("scion.dst_host", "Destination Host")
local scion_src_host = ProtoField.string("scion.src_host", "Source Host")
local scion_dst_host_raw = ProtoField.bytes("scion.dst_host", "Raw Destination Host", base.SPACE)
local scion_src_host_raw = ProtoField.bytes("scion.src_host", "Raw Source Host", base.SPACE)
local scion_dst = ProtoField.string("scion.dst", "Destination")
local scion_src = ProtoField.string("scion.src", "Source")
scion_proto.fields = {
scion_raw,
scion_version,
scion_qos,
scion_flow_id,
scion_next_hdr,
scion_hdr_len,
scion_hdr_len_bytes,
scion_payload_len,
scion_path_type,
--scion_dtdlstsl,
scion_dst_type_len,
scion_src_type_len,
scion_rsv,
scion_dst_isd,
--scion_dst_as_raw,
scion_dst_as,
scion_src_isd,
--scion_src_as_raw,
scion_src_as,
scion_dst_host,
scion_src_host,
scion_dst_host_raw,
scion_src_host_raw,
scion_dst,
scion_src,
}
-- XXX(sgmonroy) are these expert worth it? AFAICS the parser would emit a Lua error,
-- plus its own expert in case of failing to parse, ie. throwing index out of bounds
-- when the packet is too short/truncated.
-- Maybe just do expert for some important errors worth of spotting quickly
local e_nosup_ver = ProtoExpert.new("scion.nosup_ver.expert",
"Unsupported version", expert.group.UNDECODED, expert.severity.ERROR)
local e_too_short = ProtoExpert.new("scion.too_short.expert",
"Packet too short", expert.group.MALFORMED, expert.severity.ERROR)
local e_bad_len = ProtoExpert.new("scion.bad_len.expert",
"Bad packet length", expert.group.MALFORMED, expert.severity.ERROR)
local e_bad_src_addr_expert = ProtoExpert.new("scion.bad_src_addr.expert",
"Unknown address type", expert.group.PROTOCOL, expert.severity.ERROR)
local e_nosup_proto = ProtoExpert.new("scion.nosup_proto.expert",
"Unsupported protocol", expert.group.UNDECODED, expert.severity.ERROR)
scion_proto.experts = {
e_nosup_ver,
e_too_short,
e_bad_len,
e_bad_src_addr_expert,
e_nosup_proto,
}
function scion_proto.dissector(tvbuf, pktinfo, root)
local tree = root:add(scion_proto, tvbuf())
local header_str = tree
local scion = {}
-- Minimum length for SCION header without path and without payload is 36 bytes:
-- 12 (common ) + 16 (src/dst ISD-AS) + 8 (src/dst addr 4B each)
if tvbuf:len() < 36 then
tree:add_proto_expert_info(e_too_short)
return
end
local version = bit.rshift(tvbuf(0,1):uint(), 4)
if version ~= 0 then
tree:add_tvb_expert_info(e_nosup_ver, tvbuf(0,1))
return
end
tree:add(scion_version, tvbuf(0, 4))
tree:add(scion_qos, tvbuf(0, 4))
tree:add(scion_flow_id, tvbuf(0, 4))
scion["next_hdr"] = tvbuf(4, 1)
tree:add(scion_next_hdr, scion.next_hdr)
-- TODO Is there a better way to show:
-- Header Length: 72 bytes (18)
scion["hdr_len"] = tvbuf(5, 1)
local hdr_len = scion.hdr_len:uint()
scion["len_bytes"] = hdr_len * LINE_LEN
local str = string.format("Header Length: %d bytes (%d)", scion.len_bytes, hdr_len)
tree:add(scion_hdr_len, tvbuf(5, 1)):set_text(str)
scion["payload_len"] = tvbuf(6, 2)
tree:add(scion_payload_len, scion.payload_len)
scion["path_type"] = pathTypes[tvbuf(8, 1):uint()]
tree:add(scion_path_type, tvbuf(8, 1))
scion["dst_type_len"] = tvbuf(9, 1):bitfield(0, 4)
tree:add(scion_dst_type_len, tvbuf(9, 1))
scion["src_type_len"] = tvbuf(9, 1):bitfield(4, 4)
tree:add(scion_src_type_len, tvbuf(9, 1))
tree:add(scion_rsv, tvbuf(10, 2))
-- Destination address: ISD, AS
scion["dst_isd"] = tvbuf(12, 2)
tree:add(scion_dst_isd, scion.dst_isd)
scion["dst_as"] = tvbuf(14, 6)
tree:add(scion_dst_as, as_str(scion.dst_as))
-- Source address: ISD, AS
scion["src_isd"] = tvbuf(20, 2)
tree:add(scion_src_isd, scion.src_isd)
scion["src_as"] = tvbuf(22, 6)
tree:add(scion_src_as, as_str(scion.src_as))
local path_offset = 28 + addr_len(scion.dst_type_len) + addr_len(scion.src_type_len)
if tvbuf:len() < path_offset then
tree:add_proto_expert_info(e_too_short)
return
end
-- Destination host
local addrBuf = tvbuf(28, addr_len(scion.dst_type_len))
--tree:add(scion_dst_host_raw, addrBuf)
local dst_host_str = addr_str(addrBuf, scion.dst_type_len, true)
tree:add(scion_dst_host, addrBuf, dst_host_str)
-- Source host
addrBuf = tvbuf(28 + addr_len(scion.dst_type_len), addr_len(scion.src_type_len))
--tree:add(scion_src_host_raw, addrBuf)
local src_host_str = addr_str(addrBuf, scion.src_type_len, false)
tree:add(scion_src_host, addrBuf, src_host_str)
scion["dst"] = scion_addr_str(scion.dst_isd, scion.dst_as, dst_host_str)
scion["src"] = scion_addr_str(scion.src_isd, scion.src_as, src_host_str)
header_str:append_text(string.format(", Src: %s, Dst: %s", scion.src, scion.dst))
if tvbuf:len() ~= scion.len_bytes + scion.payload_len:uint() then
tree:add_tvb_expert_info(e_bad_len, tvbuf(5, 3))
end
if tvbuf:len() < scion.len_bytes then
tree:add_tvb_expert_info(e_too_short, scion.hdr_len)
scion["len_bytes"] = tvbuf:len()
end
if scion.path_type == "SCION" then
--scion_path_dissect(tvbuf(path_offset), pktinfo, tree)
ok = scion_path_dissect(tvbuf(path_offset), pktinfo, tree)
if not ok then
return
end
end
if scion.path_type == "EPIC" then
ok = epic_path_dissect(tvbuf(path_offset), pktinfo, tree)
if not ok then
return
end
end
if scion.path_type == "OneHop" then
scion_ohp_dissect(tvbuf(path_offset), pktinfo, tree)
end
local next_proto = hdrTypes[scion.next_hdr:uint()]
local rest = tvbuf(scion.len_bytes)
if next_proto == "HOP_BY_HOP" then
next_proto, rest = scion_extn_dissect(rest, pktinfo, root, next_proto)
end
if next_proto == "END_TO_END" then
next_proto, rest = scion_extn_dissect(rest, pktinfo, root, next_proto)
end
--pktinfo.cols.protocol:set("SCION")
pktinfo.cols.info:append(string.format(" SCION %s -> %s %s", scion.src, scion.dst, next_proto))
if next_proto == "UDP" then
scion_udp_proto_dissect(rest(0, 8), pktinfo, root)
elseif next_proto == "SCMP" then
scmp_proto_dissect(rest, pktinfo, root)
elseif next_proto == "BFD" then
Dissector.get("bfd"):call(rest:tvb(), pktinfo, root)
end
end
function as_str(as)
local asDec = as:uint64():tonumber()
if asDec <= 0xffffffff then
return string.format("%d", asDec)
end
return string.format("%x:%x:%x", as(0, 2):uint(), as(2, 2):uint(), as(4, 2):uint())
end
function isd_as_str(isd, as)
return string.format("%d-%s", isd:uint(), as_str(as))
end
function scion_addr_str(isd, as, host)
return string.format("%d-%s,[%s]", isd:uint(), as_str(as), host)
end
function addr_str(buf, addrTypeLen, with_svc)
local addrType = addrTypes[addrTypeLen]
if addrType == "IPv4" then
return string.format("%s", buf:ipv4())
elseif addrType == "IPv6" then
return string.format("%s", buf:ipv6())
elseif with_svc and addrType == "SVC" then
local svcVal = buf(0, 2):uint()
local svc = svcTypes[svcVal]
if svc == nil then
return string.format("Unknown (%d)", svcVal)
end
return string.format("%s (%d)", svc, svcVal)
-- TODO check that buf(2, 2) is zeroed
end
return string.format("%s", buf)
end
function addr_len(addr)
return (bit.band(addr, 0x3) + 1) * LINE_LEN
end
-- One Hop Path
scion_ohp = Proto("scion_ohp", "One Hop Path")
function scion_ohp_dissect(tvbuf, pktinfo, root)
local seg_hops = scion_path_seg_lens(tvbuf(0, 4), 0)
local ts = scion_path_info_dissect(tvbuf(0, 8), pktinfo, root, 0)
scion_path_hop_dissect(tvbuf(8, 12), pktinfo, root, 0, ts)
scion_path_hop_dissect(tvbuf(20, 12), pktinfo, root, 1, ts)
end
-- SCION Path
scion_path = Proto("scion_path", "SCION Path")
-- SCION Path Meta fields
local spath_curr_info = ProtoField.uint32("scion_path.curr_info", "Current Info Field",
base.DEC, nil, 0xc0000000)
local spath_curr_hop = ProtoField.uint32("scion_path.curr_hop", "Current Hop Field",
base.DEC, nil, 0x3f000000)
local spath_rsv = ProtoField.uint32("scion_path.rsv", "Reserved",
base.DEC, nil, 0x00fc0000)
local spath_seg0_len = ProtoField.uint32("scion_path.seg0_len", "Segment 0 Length",
base.DEC, nil, 0x0003f000)
local spath_seg1_len = ProtoField.uint32("scion_path.seg1_len", "Segment 1 Length",
base.DEC, nil, 0x00000fc0)
local spath_seg2_len = ProtoField.uint32("scion_path.seg2_len", "Segment 2 Length",
base.DEC, nil, 0x0000003f)
-- SCION Path Info fields
local spath_info_flags = ProtoField.uint8("scion_path.info.flags", "Flags", base.HEX)
local spath_info_flag_consdir = ProtoField.uint8("scion_path.info.flag_consdir", "ConsDir",
base.HEX, flagType, 0x1)
local spath_info_flag_peer = ProtoField.uint8("scion_path.info.flag_peer", "Peer",
base.HEX, flagType, 0x2)
local spath_info_rsv = ProtoField.uint8("scion_path.info.rsv", "Reserved", base.HEX)
local spath_info_seg_id = ProtoField.uint16("scion_path.info.seg_id", "Segment ID", base.HEX)
local spath_info_ts = ProtoField.absolute_time("scion_path.info.ts", "Timestamp", base.UTC)
-- SCION Path Hop fields
local spath_hop_flags = ProtoField.uint8("scion_path.hop.flags", "Flags", base.HEX)
local spath_hop_flag_in_alert = ProtoField.uint8("scion_path.hop.flag_in_alert",
"ConsIngress Router Alert", base.HEX, flagType, 0x2)
local spath_hop_flag_eg_alert = ProtoField.uint8("scion_path.hop.flag_eg_alert",
"ConsEgress Router Alert", base.HEX, flagType, 0x1)
local spath_hop_exp = ProtoField.uint8("scion_path.hop.expiry", "Expiry", base.DEC)
local spath_hop_exp_rel = ProtoField.relative_time("scion_path.hop.expiry_rel",
"Expiry (Relative)", base.UTC)
local spath_hop_exp_abs = ProtoField.absolute_time("scion_path.hop.expiry_abs",
"Expiry (Absolute)", base.UTC)
local spath_hop_cons_ingress = ProtoField.uint16("scion_path.hop.cons_ingress",
"ConsIngress IFID", base.DEC)
local spath_hop_cons_egress = ProtoField.uint16("scion_path.hop.cons_egress",
"ConsEgress IFID", base.DEC)
local spath_hop_mac = ProtoField.bytes("scion_path.hop.mac", "MAC")
scion_path.fields = {
spath_curr_info,
spath_curr_hop,
spath_rsv,
spath_seg0_len,
spath_seg1_len,
spath_seg2_len,
spath_info_flags,
spath_info_flag_consdir,
spath_info_flag_peer,
spath_info_rsv,
spath_info_seg_id,
spath_info_ts,
spath_hop_flags,
spath_hop_flag_in_alert,
spath_hop_flag_eg_alert,
spath_hop_exp,
spath_hop_exp_rel,
spath_hop_exp_abs,
spath_hop_cons_ingress,
spath_hop_cons_egress,
spath_hop_mac,
}
function scion_path_dissect(tvbuf, pktinfo, root)
--local tree = root:add(scion_path, tvbuf())
local tree = root:add(scion_path, tvbuf(0, 4)):set_text("Path Meta")
tree:add(spath_curr_info, tvbuf(0, 4))
tree:add(spath_curr_hop, tvbuf(0, 4))
tree:add(spath_rsv, tvbuf(0, 4))
tree:add(spath_seg0_len, tvbuf(0, 4))
tree:add(spath_seg1_len, tvbuf(0, 4))
tree:add(spath_seg2_len, tvbuf(0, 4))
local seg0_hops = scion_path_seg_lens(tvbuf(0, 4), 0)
local seg1_hops = scion_path_seg_lens(tvbuf(0, 4), 1)
local seg2_hops = scion_path_seg_lens(tvbuf(0, 4), 2)
local seg0_ts = scion_path_info_dissect(tvbuf(4, 8), pktinfo, root, 0)
local seg1_ts
local seg2_ts
local offset = 12
if seg1_hops > 0 then
seg1_ts = scion_path_info_dissect(tvbuf(offset, 8), pktinfo, root, 1)
offset = offset + 8
end
if seg2_hops > 0 then
seg2_ts = scion_path_info_dissect(tvbuf(offset, 8), pktinfo, root, 2)
offset = offset + 8
end
local n_hops = seg0_hops + seg1_hops + seg2_hops
local ts
for i=0,n_hops-1 do
if i < seg0_hops then
ts = seg0_ts
elseif i < seg0_hops + seg1_hops then
ts = seg1_ts
else
ts = seg2_ts
end
scion_path_hop_dissect(tvbuf(offset, 12), pktinfo, root, i, ts)
offset = offset + 12
end
return true
end
function scion_path_info_dissect(tvbuf, pktinfo, root, index)
local tree = root:add(tvbuf, "Info Field", index)
tree:add(spath_info_flags, tvbuf(0, 1))
tree:add(spath_info_flag_consdir, tvbuf(0, 1))
tree:add(spath_info_flag_peer, tvbuf(0, 1))
tree:add(spath_info_rsv, tvbuf(1, 1))
tree:add(spath_info_seg_id, tvbuf(2, 2))
tree:add(spath_info_ts, tvbuf(4, 4))
return tvbuf(4, 4)
end
function scion_path_hop_dissect(tvbuf, pktinfo, root, index, ts)
local tree = root:add(tvbuf, "Hop Field", index)
tree:add(spath_hop_flags, tvbuf(0, 1))
tree:add(spath_hop_flag_in_alert, tvbuf(0, 1))
tree:add(spath_hop_flag_eg_alert, tvbuf(0, 1))
tree:add(spath_hop_exp, tvbuf(1, 1))
local raw_exp_time = (tvbuf(1, 1):uint() + 1) * HOP_EXP_UNIT
tree:add(spath_hop_exp_rel, tvbuf(1, 1), NSTime.new(raw_exp_time))
tree:add(spath_hop_exp_abs, tvbuf(1, 1), NSTime.new((raw_exp_time) + ts:uint()))
tree:add(spath_hop_cons_ingress, tvbuf(2, 2))
tree:add(spath_hop_cons_egress, tvbuf(4, 2))
tree:add(spath_hop_mac, tvbuf(6, 6))
end
function scion_path_seg_lens(tvbuf, index)
return bit.band(bit.rshift(tvbuf:uint(), (12 - (6 * index))), 0x3f)
end
-- SCION Extension Headers
scion_extn = Proto("scion_extn", "SCION Extension Header")
local scion_extn_next_hdr = ProtoField.uint8("scion_e2e.next_hdr", "Next Header", base.DEC, hdrTypes)
local scion_extn_hdr_len = ProtoField.uint8("scion_e2e.hdr_len", "Header Length", base.DEC)
scion_extn.fields = {
scion_extn_next_hdr,
scion_extn_hdr_len,
}
local scion_extn_type_pretty = {
["HOP_BY_HOP"] = "Hop-by-Hop",
["END_TO_END"] = "End-to-End",
}
function scion_extn_dissect(tvbuf, pktinfo, root, extn_type)
local extn = {}
if tvbuf:len() < 2 then
tree:add_proto_expert_info(e_too_short)
return
end
local str = string.format("SCION %s Extension Header", scion_extn_type_pretty[extn_type])
extn["next_hdr"] = tvbuf(0, 1)
extn["hdr_len"] = tvbuf(1, 1)
local hdr_len = extn.hdr_len:uint()
extn["hdr_len_bytes"] = (hdr_len + 1) * LINE_LEN
local len_str = string.format("Header Length: %d bytes (%d)", extn.hdr_len_bytes, hdr_len)
local tree = root:add(scion_extn, tvbuf(0, extn.hdr_len_bytes)):set_text(str)
tree:add(scion_extn_next_hdr, extn.next_hdr)
tree:add(scion_extn_hdr_len, extn.hdr_len):set_text(len_str)
scion_extn_tlv_options_dissect(tvbuf(2, extn.hdr_len_bytes-2), pktinfo, tree)
local next_proto = hdrTypes[extn.next_hdr:uint()]
return next_proto, tvbuf(extn.hdr_len_bytes)
end
-- SCION Extension Header Options
-- TODO: dissect individual options, use different type tables for HBH and E2E
scion_extn_tlv_option = Proto("scion_extn_tlv_option", "TLV Option")
local scion_extn_tlv_option_types = {
[0] = "Pad1",
[1] = "PadN",
[2] = "Authenticator",
}
local scion_extn_tlv_option_type = ProtoField.uint8("scion_extn_tlv_option.type", "Type", base.DEC, scion_extn_tlv_option_types)
local scion_extn_tlv_option_len = ProtoField.uint8("scion_extn_tlv_option.len", "Length", base.DEC)
local scion_extn_tlv_option_value = ProtoField.bytes("scion_extn_tlv_option.value", "Value")
scion_extn_tlv_option.fields = {
scion_extn_tlv_option_type,
scion_extn_tlv_option_len,
scion_extn_tlv_option_value,
}
function scion_extn_tlv_options_dissect(tvbuf, pktinfo, root)
local offset = 0
while offset < tvbuf:len()
do
local len = scion_extn_tlv_option_dissect(tvbuf(offset, tvbuf:len()-offset), pktinfo, root)
if len <= 0 then -- shouldn't happen, just to ensure this won't loop forever
return
end
offset = offset + len
end
end
function scion_extn_tlv_option_dissect(tvbuf, pktinfo, root)
local tlv = {}
tlv["type"] = tvbuf(0, 1)
local len = 1
if tlv.type:uint() == 0 then
len = 1
else
tlv["data_len"] = tvbuf(1, 1)
data_len = tlv.data_len:uint()
if data_len > 0 then
tlv["data"] = tvbuf(2, data_len)
end
len = data_len + 2
end
local tree = root:add(scion_extn_tlv_option, tvbuf(0, len))
tree:add(scion_extn_tlv_option_type, tlv.type)
if tlv.data_len ~= nil then
tree:add(scion_extn_tlv_option_len, tlv.data_len)
end
if tlv.data then
tree:add(scion_extn_tlv_option_value, tlv.data)
end
local type_str = scion_extn_tlv_option_types[tlv.type:uint()]
if type_str ~= nil then
tree:set_text(type_str)
else
tree:append_text(", Unknown Type")
end
return len
end
-- EPIC Path
epic_path = Proto("epic_path", "EPIC Path")
local epath_ts = ProtoField.uint32("epic_path.ts", "EPIC timestamp", base.DEC)
local epath_ts_rel = ProtoField.relative_time("epic_path.ts.rel",
"EPIC timestamp (Relative)", base.UTC)
local epath_ts_abs = ProtoField.absolute_time("epic_path.ts.abs",
"EPIC timestamp (Absolute)", base.UTC)
local epath_counter = ProtoField.uint32("epic_path.counter", "EPIC counter", base.DEC)
local epath_phvf = ProtoField.bytes("epic_path.phvf", "PHVF")
local epath_lhvf = ProtoField.bytes("epic_path.lhvf", "LHVF")
epic_path.fields = {
epath_ts,
epath_ts_rel,
epath_ts_abs,
epath_counter,
epath_phvf,
epath_lhvf,
}
function epic_path_dissect(tvbuf, pktinfo, root)
local tree = root:add(epic_path, tvbuf()):set_text("EPIC")
-- The EPIC fields have a total size of 16 bytes
if tvbuf:len() < 16 then
tree:add_proto_expert_info(e_too_short)
return
end
-- Parse EPIC fields
local packetIdTree = tree:add(tvbuf, "Packet ID")
local packetTsTree = packetIdTree:add(tvbuf, "Timestamp")
local epicTs = tvbuf(0, 4):uint()
local epicTsRelNs = (epicTs+1) * 21 * 1000
local epicTsRelSec = epicTsRelNs/10^9
epicTsRelNs = epicTsRelNs % 10^9
packetTsTree:add(epath_ts, tvbuf(0, 4), epicTs)
packetTsTree:add(epath_ts_rel, tvbuf(0, 4), NSTime.new(epicTsRelSec, epicTsRelNs))
packetIdTree:add(epath_counter, tvbuf(4, 4))
tree:add(epath_phvf, tvbuf(8, 4))
tree:add(epath_lhvf, tvbuf(12, 4))
-- Parse the SCION path type fields
ok = scion_path_dissect(tvbuf(16), pktinfo, root)
if not ok then
return
end
-- Get the timestamp of the first InfoField
-- (No checks needed, as SCION path type parsing was successful)
local tsInfo = tvbuf(24, 4):uint()
-- Calculate and add the EPIC timestamp (absolute)
-- (depends on the timestamp of the first InfoField)
packetTsTree:add(epath_ts_abs, tvbuf(0, 4), NSTime.new(tsInfo+epicTsRelSec, epicTsRelNs))
return true
end
-- SCION UDP
-- We re-implement UDP here because the checksum calculation with SCION is different.
scion_udp_proto = Proto("scion_udp", "SCION User Datagram Protocol")
local udp_src_port = ProtoField.uint16("scion_udp.src_port", "Source Port", base.DEC)
local udp_dst_port = ProtoField.uint16("scion_udp.dst_port", "Destination Port", base.DEC)
local udp_length = ProtoField.uint16("scion_udp.length", "Length", base.DEC)
local udp_cksum = ProtoField.uint16("scion_udp.cksum", "Checksum", base.HEX)
scion_udp_proto.fields = {
udp_src_port,
udp_dst_port,
udp_length,
udp_cksum,
}
function scion_udp_proto_dissect(tvbuf, pktinfo, root)
local tree = root:add(scion_udp_proto, tvbuf())
local udp = {}
udp["src_port"] = tvbuf(0, 2)
udp["dst_port"] = tvbuf(2, 2)
udp["length"] = tvbuf(4, 2)
udp["cksum"] = tvbuf(6, 2)
tree:append_text(string.format(", Src Port: %s, Dst Port: %s", udp.src_port:uint(),
udp.dst_port:uint()))
pktinfo.cols.info:append(string.format(" %d -> %d %d", udp.src_port:uint(),
udp.dst_port:uint(), udp.length:uint()))
tree:add(udp_src_port, udp.src_port)
tree:add(udp_dst_port, udp.dst_port)
tree:add(udp_length, udp.length)
-- TODO SCION/UDP checksum validation
tree:add(udp_cksum, udp.cksum):append_text(" [unverified]")
end
-- SCMP
scmp_proto = Proto("scmp", "SCION Control Message Protocol")
local scmpDstUnreachCodes = {
[0] = "No route to destination",
[1] = "Communication administratively denied",
[2] = "Beyond scope of source address",
[3] = "Address unreachable",
[4] = "Port unreachable",
[5] = "Source address failed ingress/egress policy",
[6] = "Reject route to destination",
}
local scmpPktTooBigCodes = {
[0] = "Packet too big",
}
local scmpParamProblemCodes = {
[0] = "Erroneous header field",
[1] = "Unknown next-hdr type",
[2] = "unassigned",
[16] = "Invalid common header",
[17] = "Unknown SCION version",
[18] = "Flow ID required",
[19] = "Invalid packet size",
[20] = "Unknown path type",
[21] = "Unknown address format",
[32] = "Invalid address header",
[33] = "Invalid source address",
[34] = "Invalid destination address",
[35] = "Non-local delivery",
[48] = "Invalid path",
[49] = "Unknown hop field cons ingress interface",
[50] = "Unknown hop field cons egress interface",
[51] = "Invalid hop field MAC",
[52] = "Path expired",
[53] = "Invalid segment change",
[64] = "Invalid extension header",
[65] = "Unknown hop-by-hop option",
[66] = "Unknown end-to-end option",
}
local scmpInterfaceDownCodes = {
[0] = "External interface Down",
}
local scmpConnDownCodes = {
[0] = "Internal connectivity down",
}
local scmpErrorPriv1Codes = {
[0] = "Error Private1",
}
local scmpErrorPriv2Codes = {
[0] = "Error Private2",
}
local scmpErrorRsvCodes = {
[0] = "Error Reserved",
}
local scmpEchoReqCodes = {
[0] = "Echo request",
}
local scmpEchoReplyCodes = {
[0] = "Echo reply",
}
local scmpTracerouteReqCodes = {
[0] = "Traceroute request",
}
local scmpTracerouteReplyCodes = {
[0] = "Traceroute reply",
}
local scmpInfoPriv1Codes = {
[0] = "Info Private1",
}
local scmpInfoPriv2Codes = {
[0] = "Info Private2",
}
local scmpInfoRsvCodes = {
[0] = "Info Reserved",
}
local scmpTypes = {
[1] = scmpDstUnreachCodes,
[2] = scmpPktTooBigCodes,
[4] = scmpParamProblemCodes,
[5] = scmpInterfaceDownCodes,
[6] = scmpConnDownCodes,
[100] = scmpErrorPriv1Codes,
[101] = scmpErrorPriv2Codes,
[127] = scmpErrorRsvCodes,
[128] = scmpEchoReqCodes,
[129] = scmpEchoReplyCodes,
[130] = scmpTracerouteReqCodes,
[131] = scmpTracerouteReplyCodes,
[200] = scmpInfoPriv1Codes,
[201] = scmpInfoPriv2Codes,
[255] = scmpInfoRsvCodes,
}
local scmp_type = ProtoField.uint8("scmp.type", "Type", base.DEC)
local scmp_code = ProtoField.uint8("scmp.code", "Code", base.DEC)
local scmp_cksum = ProtoField.uint16("scmp.cksum", "Checksum", base.HEX)
local scmp_mtu = ProtoField.uint16("scmp.mtu", "MTU", base.DEC)
local scmp_pointer = ProtoField.uint16("scmp.pointer", "Pointer", base.DEC)
local scmp_isd = ProtoField.uint16("scmp.isd", "ISD", base.DEC)
local scmp_as = ProtoField.string("scmp.as", "AS")
local scmp_ifid = ProtoField.uint64("scmp.ifid", "IFID", base.DEC)
local scmp_ifid_in = ProtoField.uint64("scmp.ifid_in", "Ingress IFID", base.DEC)
local scmp_ifid_eg = ProtoField.uint64("scmp.ifid_eg", "Egress IFID", base.DEC)
local scmp_id = ProtoField.uint16("scmp.id", "Identifier", base.DEC)
local scmp_seq = ProtoField.uint16("scmp.seq", "Sequence Number", base.DEC)
local scmp_raw = ProtoField.bytes("scmp.raw", "Raw SCMP")
scmp_proto.fields = {
scmp_type,
scmp_code,
scmp_cksum,
scmp_mtu,
scmp_pointer,
scmp_isd,
scmp_as,
scmp_ifid,
scmp_ifid_in,
scmp_ifid_eg,
scmp_id,
scmp_seq,
scmp_raw,
}
function scmp_proto_dissect(tvbuf, pktinfo, root)
local tree = root:add(scmp_proto, tvbuf())
local scmp = {}
scmp["type"] = tvbuf(0, 1)
scmp["code"] = tvbuf(1, 1)
tree:add(scmp_type, scmp.type)
tree:add(scmp_code, scmp.code)
tree:add(scmp_cksum, tvbuf(2, 2)):append_text(" [unverified]")
local codes = scmpTypes[scmp.type:uint()]
if codes == nil then
tree:append_text(", Unknown Type")
return
end
local data_offset = 8
if codes == scmpPktTooBigCodes then
tree:add(scmp_mtu, tvbuf(6, 2))
end
if codes == scmpParamProblemCodes then
tree:add(scmp_pointer, tvbuf(6, 2))
end
if codes == scmpInterfaceDownCodes then
tree:add(scmp_isd, tvbuf(4, 2))
tree:add(scmp_as, as_str(tvbuf(6, 6)))
tree:add(scmp_ifid, tvbuf(12, 8))
scmp["append_str"] = string.format("ISD-AS: %s, IFID: %d",
isd_as_str(tvbuf(4, 2), tvbuf(6, 6)), tvbuf(12, 8):uint64():tonumber())
data_offset = 20
end
if codes == scmpConnDownCodes then
tree:add(scmp_isd, tvbuf(4, 2))
tree:add(scmp_as, as_str(tvbuf(6, 6)))
tree:add(scmp_ifid_in, tvbuf(12, 8))
tree:add(scmp_ifid_eg, tvbuf(20, 8))
scmp["append_str"] = string.format("ISD-AS: %s, IFIDs: %d | %d",
isd_as_str(tvbuf(4, 2), tvbuf(6, 6)),
tvbuf(12, 8):uint():tonumber(), tvbuf(20, 8):uint64():tonumber())
data_offset = 28
end
if codes == scmpEchoReqCodes or codes == scmpEchoReplyCodes then
tree:add(scmp_id, tvbuf(4, 2))
tree:add(scmp_seq, tvbuf(6, 2))
end
if codes == scmpTracerouteReqCodes then
tree:add(scmp_id, tvbuf(4, 2))
tree:add(scmp_seq, tvbuf(6, 2))
end
if codes == scmpTracerouteReplyCodes then
tree:add(scmp_id, tvbuf(4, 2))
tree:add(scmp_seq, tvbuf(6, 2))
tree:add(scmp_isd, tvbuf(8, 2))
tree:add(scmp_as, as_str(tvbuf(10, 6)))
tree:add(scmp_ifid, tvbuf(16, 8))
scmp["append_str"] = string.format("ISD-AS: %s, IFID: %d",
isd_as_str(tvbuf(8, 2), tvbuf(10, 6)), tvbuf(16, 8):uint64():tonumber())
end
local code = codes[scmp.code:uint()]
if code == nil then
tree:append_text(", Unknown Code")
return
end
tree:append_text(string.format(", %s", code))
if scmp.append_str ~= nil then
tree:append_text(string.format(", %s", scmp.append_str))
end
if scmp.type:uint() < 128 then
-- try to parse quoted packet
scion_proto.dissector(tvbuf(data_offset):tvb(), pktinfo, tree)
end
end
-- Below we configure Wireshark to identify SCION as the next protocol when using
-- the specified range of ports.
--
-- SCION packet on UDP/IP overlay.
table_udp = DissectorTable.get("udp.port")
-- intra-AS traffic
for i = 30000, 32000, 1 do
table_udp:add(i, scion_proto)
end
-- inter-AS BR traffic
for i = 40000, 40050, 1 do
table_udp:add(i, scion_proto)
end
-- FIXME remove once acceptance tests are updated to use ports above
-- acceptance tests
for i = 50000, 50050, 1 do
table_udp:add(i, scion_proto)
end
|
EditorOverrideInstigator = EditorOverrideInstigator or class(MissionScriptEditor)
function EditorOverrideInstigator:create_element()
self.super.create_element(self)
self._element.class = "ElementOverrideInstigator"
end
function EditorOverrideInstigator:_build_panel()
self:_create_panel()
self:BuildUnitsManage("unit_id", nil, nil, {text = "Instigator", single_select = true, not_table = true})
end
|
permissions = {
["ban"] = false,
["kick"] = false,
["spectate"] = false,
["unban"] = false,
["teleport.player"] = false,
["manageserver"] = false,
["slap"] = false,
["freeze"] = false,
["screenshot"] = false,
["immune"] = false,
["anon"] = false,
["mute"] = false,
["teleport.everyone"] = false,
["warn"] = false,
}
function PrintDebugMessage(msg,level)
loglevel = (GetConvarInt("ea_logLevel", 1))
if not level or not tonumber(level) then level = 3 end
if level == 1 and loglevel >= level then -- ERROR Loglevel
Citizen.Trace("^1"..GetCurrentResourceName().."^7: "..msg.."^7\n")
elseif level == 2 and loglevel >= level then -- WARN Loglevel
Citizen.Trace("^3"..GetCurrentResourceName().."^7: "..msg.."^7\n")
elseif level == 3 and loglevel >= level then -- INFO Loglevel
Citizen.Trace("^0"..GetCurrentResourceName().."^7: "..msg.."^7\n")
elseif level == 4 and loglevel >= level then -- DEV Loglevel
Citizen.Trace("^7"..GetCurrentResourceName().."^7: "..msg.."^7\n")
elseif level > 4 and loglevel >= level then -- anything above 4 shouldn't exist, but kept just in case
Citizen.Trace("^5"..GetCurrentResourceName().."^7: "..msg.."^7\n")
end
end
if GetConvar("ea_enableDebugging", "false") ~= "false" or GetConvarInt("ea_logLevel", 1) ~= 1 then
SetConvar("ea_enableDebugging", "false")
if GetConvarInt("ea_logLevel", 1) == 1 then
SetConvar("ea_logLevel", 3)
end
if GetConvarInt("ea_logLevel", 1) > 1 then
PrintDebugMessage("Debug Messages Enabled, Verbosity is ^2"..GetConvarInt("ea_logLevel", 1).."^7.", 2)
end
else
enableDebugging = false
end
function GetLocalisedText(string)
if not strings then return "Strings not Loaded yet!" end
if not string then return "No String!" end
if strings[string] then
return strings[string]
else
return "String "..string.." not found in "..strings.language
end
end
function formatDateString(string)
local dateFormat = GetConvar("ea_dateFormat", '%d/%m/%Y %H:%M:%S')
return os.date(dateFormat, string)
end
function math.round(num, numDecimalPlaces)
if numDecimalPlaces and numDecimalPlaces>0 then
local mult = 10^numDecimalPlaces
return math.floor(num * mult + 0.5) / mult
end
return math.floor(num + 0.5)
end
function string.split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
function string.reverse(s)
local r = ""
for p,c in utf8.codes(s) do
r = utf8.char(c)..r
end
return r
end
--- http://www.lua.org/pil/11.5.html
function Set (list)
local set = {}
for _, l in ipairs(list) do set[l] = true end
return set
end
-- Convert a lua table into a lua syntactically correct string
function table_to_string(tbl)
local result = "{"
for k, v in pairs(tbl) do
-- Check the key type (ignore any numerical keys - assume its an array)
if type(k) == "string" then
result = result.."[\""..k.."\"]".."="
end
-- Check the value type
if type(v) == "table" then
result = result..table_to_string(v)
elseif type(v) == "boolean" then
result = result..tostring(v)
else
result = result.."\""..v.."\""
end
result = result..","
end
-- Remove leading commas from the result
if result ~= "" then
result = result:sub(1, result:len()-1)
end
return result.."}"
end
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:25' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
function ZO_SelectHomeCampaign_GetCost()
local endCampaignNowCost = 0
local endCampaignAfterEndCost = 0
if GetNumFreeAnytimeCampaignReassigns() == 0 then
endCampaignNowCost = GetCampaignReassignCost(CAMPAIGN_REASSIGN_TYPE_IMMEDIATE)
end
if GetNumFreeEndCampaignReassigns() == 0 then
endCampaignAfterEndCost = GetCampaignReassignCost(CAMPAIGN_REASSIGN_TYPE_ON_END)
end
return endCampaignNowCost, endCampaignAfterEndCost
end
function ZO_AbandonHomeCampaign_GetCost()
local alliancePointCost = 0
local goldCost = 0
if GetNumFreeAnytimeCampaignUnassigns() == 0 then
alliancePointCost = GetCampaignUnassignCost(CAMPAIGN_UNASSIGN_TYPE_HOME_USE_ALLIANCE_POINTS)
goldCost = GetCampaignUnassignCost(CAMPAIGN_UNASSIGN_TYPE_HOME_USE_GOLD)
end
return alliancePointCost, goldCost
end
|
local movespeed = 0.02
local slowmovespeed = 0.004
local fastmovespeed = 0.08
local rotatespeed = 1
local slowrotatespeed = 0.2
local fastrotatespeed = 3
local controller = {
slow = false, fast = false,
left = false, right = false, forwards = false, backwards = false, -- controller movement works independently of 'real' keys
up = 0, down = 0,
rx_0 = 0, rx_1 = 0, ry_0 = 0, ry_1 = 0, rz_0 = 0, rz_1 = 0, rz_2 = 0, rz_3 = 0,
deselect = false, reset = false, next = false, prev = false }
local frame = 0
local _getAnalogControlState = getAnalogControlState
function getAnalogControlState( key )
return controller[key] and 1 or _getAnalogControlState(key)
end
-- mapped keys -> controls
local keys = {}
local function map(target, what, ...)
for k, v in ipairs({...}) do
keys[v] = {target, what}
end
end
map(true, 'forwards', 'w')
map(true, 'backwards', 's')
map(true, 'left', 'a')
map(true, 'right', 'd')
map(true, 'fast', 'joy6', 'lshift')
map(true, 'slow', 'joy5', 'lalt')
map(true, 'reset', 'joy7', 'joy9')
map(true, 'deselect', 'joy8', 'joy10')
map(true, 'next', 'axis_9')
map(true, 'prev', 'axis_10')
map(1, 'up', 'joy4', 'axis_12', 'arrow_u')
map(1, 'down', 'joy1', 'axis_6', 'arrow_d')
map(1, 'rz_1', 'joy3', 'arrow_l')
map(1, 'rz_0', 'joy2', 'arrow_r')
map(1, 'rz_2', 'mouse_wheel_up')
map(1, 'rz_3', 'mouse_wheel_down')
function resetController( )
for k, v in pairs(controller) do
controller[k] = type(v) == 'number' and 0 or false
end
end
function captureKeys( key, state )
local info = keys[key]
if info then
if key:sub(1,5) == 'mouse' and isMouseOverGUI( ) then
state = false
end
if type(info[1]) == 'number' then
state = state and 1 or 0
end
controller[info[2]] = state
end
end
--
function getCameraRotation( )
local cx, cy, _, tx, ty = getCameraMatrix ( )
return math.deg( math.atan2( tx - cx, ty - cy ) )
end
function updateKeys( object )
local next, prev = false, false
if frame == 0 then
next, prev = controller.next, controller.prev
frame = 10
else
frame = frame - 1
end
if object then
local x, y, z = getElementPosition( object )
local rx, ry, rz = getElementRotation( object )
local rot = getCameraRotation( )
local speed = movespeed
-- moving the object somewhere
local function move( n, dist )
if math.abs(dist) < 0.03 then
return
end
x, y = getInFrontOf( x, y, -(rot + 90*n), dist * speed )
end
if controller.slow ~= controller.fast then
speed = controller.fast and fastmovespeed or slowmovespeed
end
move( 0, getAnalogControlState( 'forwards' ) - getAnalogControlState( 'backwards' ) )
move( 1, getAnalogControlState( 'right' ) - getAnalogControlState( 'left' ) )
z = z + ( controller.up - controller.down ) * speed * 1/3
-- let's rotate this, maybe
local speed = rotatespeed
if controller.slow ~= controller.fast then
speed = controller.fast and fastrotatespeed or slowrotatespeed
end
rx = rx + ( controller.rx_0 - controller.rx_1 ) * speed
ry = ry + ( controller.ry_0 - controller.ry_1 ) * speed
rz = rz + ( controller.rz_0 - controller.rz_1 + ( controller.rz_2 - controller.rz_3 ) * 5 ) * speed
local deselect, reset = controller.deselect, controller.reset
for k, v in pairs({deselect = false, reset = false, rz_2 = 0, rz_3 = 0}) do
controller[k] = v
end
return x, y, z, rx, ry, rz, deselect, reset, next, prev
end
return nil, nil, nil, nil, nil, nil, false, false, next, prev
end
|
-- get Kabal
local Kabal = require "kabal"
-- initialize Kabal, use "/" as cursor
local kabal = Kabal("/")
-- lets add some commands
kabal:cmd("hi", function()
print("Hi there!")
end)
kabal:cmd("flip", function()
print("(╯°□°)╯︵ ┻━┻")
end)
-- args table returns user defined arguments
kabal:cmd("multiply", function(args)
local result = args[1] * args[2]
print(result)
end)
-- lets count from 1 to x number!
-- params and args are same thing, you can also use your custom naming
kabal:cmd("count", function(params)
local i = 1
while i <= tonumber(params[1]) do
print(i)
i = i + 1
end
end)
-- too basic example of player opping
local player_op = 0
kabal:cmd("op", function(args)
player_op = tonumber(args[1])
print("Player OP status: " .. player_op)
end)
-- with table.concat we can return all parameters
-- given by user as a string
kabal:cmd("say", function(args)
print("Player said: " .. table.concat(args, " "))
end)
-- let user call lua stuff? O.o
kabal:cmd("call", function(args)
local line = table.concat(args, " ")
local foo = loadstring(line)
if type(foo) == "function" then
foo()
else
print("error")
end
end)
-- lets get user input and test
print("Kabal waiting for user input:")
repeat
local get = kabal:cinput()
kabal:call(get)
until get == "quit"
|
GameplayHelper_Lang = {
LocalizationExample = {
["Welcome to {Tamriel:Yellow}, {1}!"] = "Willkommen bei {Tamriel:Yellow}, {1}!",
NiceDay = "Einen schönen Tag noch!"
}
}
|
-- Copyright (c) 2017-present, Facebook, Inc.
-- All rights reserved.
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
local ProFi = require 'ProFi'
ProFi:start()
print("loading")
local speech = require 'speech'
print("begin")
local fun = speech.Mfcc{fs = 16000,
tw = 25,
ts = 1,
M = 20,
N = 13,
L = 22,
R1 = 0,
R2 = 8000,
dev = 9}
print("continue")
for i = 1, 10 do
print(i)
local input = torch.rand(100000, 1)
input = input:squeeze()
input = fun(input, input)
end
ProFi:stop()
ProFi:writeReport( 'MyProfilingReport.txt' )
|
-- Distance formula
function distance(x1, y1, x2, y2)
return math.sqrt((y2 - y1)^2 + (x2 - x1)^2)
end
-- Speed given X and Y velocity values
function speedFromVelocity(vx, vy)
return math.sqrt(vx * vx + vy * vy)
end
-- Returns a normalized HUMP vector towards the player from (mx, my)
-- If no parameters are given, it's assumed to be the mouse's position
function toPlayerVector(mx, my)
local px, py = player.physics:getPosition()
local reverse = true
if mx == nil and my == nil then
mx, my = cam:mousePosition()
mx = mx
my = my
reverse = false
end
if reverse then
return vector.new(px-mx, py-my):normalized()
else
return vector.new(mx-px, my-py):normalized()
end
end
function toMouseVector(px, py)
local mx, my = cam:mousePosition()
return vector.new(mx-px, my-py):normalized()
end
-- Gets radians needed to rotate towards the player
function toPlayerRotate(mx, my)
local dir = toPlayerVector(mx, my)
local vx, vy = dir:normalized():unpack()
return math.atan2(vy, vx)
end
-- Update timer variables
function updateTimer(v, dt)
if v > 0 then
v = v - dt
elseif v < 0 then
v = 0
end
return v
end
-- Distance between object and player
function distToPlayer(mx, my)
local px, py = player.physics:getPosition()
return distance(px, py, mx, my)
end
|
--[[
Copyright 2018 The Nakama Authors
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 nk = require("nakama")
--[[
Test run_once function calls at server startup.
--]]
nk.run_once(function(context)
assert(context.execution_mode, "run_once")
-- nk.match_create("match", {debug = true})
end)
nk.run_once(function(context)
error("Should not be executed.")
end)
local function rpc_signal(context, payload)
local matches = nk.match_list(1, true)
if #matches < 1 then
error("no matches")
end
return nk.match_signal(matches[1].match_id, payload)
end
nk.register_rpc(rpc_signal, "rpc_signal")
|
template="tool"
name="music"
|
return {
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.15
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.166
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.182
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.2
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.216
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.232
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.25
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.266
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.282
}
}
}
},
{
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.3
}
}
}
},
time = 0,
name = "冲突禁止",
init_effect = "jinengchufablue",
picture = "",
desc = "降低我方受到碰撞伤害",
stack = 1,
id = 4130,
icon = 4130,
last_effect = "",
blink = {
1,
0,
0,
0.3,
0.3
},
effect_list = {
{
type = "BattleBuffAddAttr",
trigger = {
"onAttach"
},
arg_list = {
attr = "hammerDamagePrevent",
number = 0.3
}
}
}
}
|
local BTW = {}
BTW.Identity = "zuus_combos"
BTW.Locale = {
["name"] = {
["english"] = "Born to win",
["russian"] = "Рождённый побеждать"
},
["desc"] = {
["english"] = "Zuus helper",
["russian"] = "Помощник"
},
["farm"] = {
["english"] = "Farm key",
["russian"] = "Клавиша для фарма"
},
["spam"] = {
["english"] = "Spam arc key",
["russian"] = "Клавиша для спама первым скилом"
},
["steal"] = {
["english"] = "Auto steal by arc and bolt",
["russian"] = "Стил героев первыми двумя способностями"
},
["stealcloud"] = {
["english"] = "Auto steal by Nimbus",
["russian"] = "Стил героев облачком"
},
["order"] = {
["english"] = "Combo order",
["russian"] = "Порядок каста комбо"
},
["combo"] = {
["english"] = "Combo key",
["russian"] = "Клавиша комбо"
},
["orbwalker"] = {
["english"] = "Attack when combo",
["russian"] = "Атаковать при комбо"
},
["slider"] = {
["english"] = "Closest to mouse range",
["russian"] = "Радиус поиска ближнего"
}
}
BTW.Hero = nil
BTW.Enabled = false
BTW.MP = 0
BTW.CastTypes = {
["item_blink"] = 3,
["item_veil_of_discord"] = 3,
["item_soul_ring"] = 1,
["item_shivas_guard"] = 1,
["item_orchid"] = 2,
["item_bloodthorn"] = 2,
["item_rod_of_atos"] = 2,
["item_cyclone"] = 2,
["zuus_arc_lightning"] = 2,
["zuus_lightning_bolt"] = 2,
["zuus_static_field"] = 0,
["special_bonus_unique_zeus"] = 0,
["zuus_cloud"] = 3,
["zuus_thundergods_wrath"] = 1,
["item_dagon"] = 2,
["item_sheepstick"] = 2,
["item_ethereal_blade"] = 2,
["item_refresher"] = 1,
["item_arcane_boots"] = 1
}
BTW.Items = {
["item_blink"] = "resource/flash3/images/items/",
["item_veil_of_discord"] = "resource/flash3/images/items/",
["item_soul_ring"] = "resource/flash3/images/items/",
["item_shivas_guard"] = "resource/flash3/images/items/",
["item_rod_of_atos"] = "resource/flash3/images/items/",
["item_orchid"] = "resource/flash3/images/items/",
["item_bloodthorn"] = "resource/flash3/images/items/",
["zuus_arc_lightning"] = "resource/flash3/images/spellicons/",
["zuus_lightning_bolt"] = "resource/flash3/images/spellicons/",
["zuus_cloud"] = "resource/flash3/images/spellicons/",
["zuus_thundergods_wrath"] = "resource/flash3/images/spellicons/",
["item_dagon"] = "resource/flash3/images/items/",
["item_sheepstick"] = "resource/flash3/images/items/",
["item_ethereal_blade"] = "resource/flash3/images/items/",
["item_refresher"] = "resource/flash3/images/items/",
["item_arcane_boots"] = "resource/flash3/images/items/"
}
BTW.Abilitys = {}
function BTW.OnDraw()
if GUI == nil then return end
if not GUI.Exist(BTW.Identity) then
GUI.Initialize(BTW.Identity, GUI.Category.Heroes, BTW.Locale["name"], BTW.Locale["desc"], "paroxysm", "npc_dota_hero_zuus")
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "farm", BTW.Locale["farm"], GUI.MenuType.Key, "F", BTW.Farm, 0)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "spam", BTW.Locale["spam"], GUI.MenuType.Key, "T", BTW.Spam, 0)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "steal", BTW.Locale["steal"], GUI.MenuType.CheckBox, 0)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "stealcloud", BTW.Locale["stealcloud"], GUI.MenuType.CheckBox, 0)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "ordercombo", BTW.Locale["order"],
GUI.MenuType.OrderBox, BTW.Items, "", "item_", 36, 36)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "combo", BTW.Locale["combo"], GUI.MenuType.Key, "K", BTW.Combo, 0)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "orbwalker", BTW.Locale["orbwalker"], GUI.MenuType.CheckBox, 0)
GUI.AddMenuItem(BTW.Identity, BTW.Identity .. "closest", BTW.Locale["slider"], GUI.MenuType.Slider, 100, 1500, 200)
end
BTW.Initialize()
if BTW.Enabled
then
if GUI.IsEnabled(BTW.Identity .. "steal") then BTW.Steal() end
if GUI.IsEnabled(BTW.Identity .. "stealcloud") then BTW.StealCloud() end
end
end
function BTW.Combo()
if not BTW.Enabled then return end
local enemy = Input.GetNearestHeroToCursor(Entity.GetTeamNum(BTW.Hero), Enum.TeamType.TEAM_ENEMY)
if not enemy or not NPC.IsPositionInRange(enemy, Input.GetWorldCursorPos(), GUI.Get(BTW.Identity .. "closest"), 0) then return end
local ordercast = GUI.Get(BTW.Identity .. "ordercombo", 1)
if ordercast == nil then return end
local position = Entity.GetAbsOrigin(enemy)
local manapoint = NPC.GetMana(BTW.Hero)
local prevcast = nil
for i = 1, Length(ordercast) do
BTW.Cast(ordercast[i], BTW.Hero, enemy, NPC.GetAbsOrigin(enemy), BTW.MP)
end
if not NPC.HasModifier(enemy, "modifier_item_ethereal_blade_slow") and GUI.IsEnabled(BTW.Identity .. "orbwalker") then
Player.PrepareUnitOrders(Players.GetLocal(), 4, enemy, Vector(0,0,0), enemy, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, BTW.Hero)
end
end
function BTW.Steal()
if not BTW.Enabled then return end
local staticdmg = 0
if Ability.GetLevel(BTW.Abilitys['zuus_static_field']) > 0 then
staticdmg = 2 + (2 * Ability.GetLevel(BTW.Abilitys['zuus_static_field']))
if Ability.GetLevel(BTW.Abilitys['special_bonus_unique_zeus']) == 1 then
staticdmg = staticdmg + 1.5
end
end
for n, npc in pairs(NPC.GetHeroesInRadius(BTW.Hero, Ability.GetCastRange(BTW.Abilitys['zuus_lightning_bolt']), Enum.TeamType.TEAM_ENEMY)) do
if Entity.IsHero(npc) and not NPC.IsIllusion(npc) and not Entity.IsDormant(npc) and not NPC.HasState(npc, Enum.ModifierState.MODIFIER_STATE_MAGIC_IMMUNE) then
local boltdmg = Ability.GetDamage(BTW.Abilitys['zuus_lightning_bolt'])
local lightdmg = Ability.GetDamage(BTW.Abilitys['zuus_arc_lightning'])
if Ability.GetLevel(BTW.Abilitys['zuus_static_field']) > 0 then
boltdmg = boltdmg + (Entity.GetHealth(npc) * (staticdmg / 100) )
lightdmg = lightdmg + (Entity.GetHealth(npc) * (staticdmg / 100) )
end
boltdmg = NPC.GetMagicalArmorDamageMultiplier(npc) * boltdmg
lightdmg = NPC.GetMagicalArmorDamageMultiplier(npc) * lightdmg
if Entity.GetHealth(npc) < lightdmg
then
BTW.Cast('zuus_arc_lightning', BTW.Hero, npc, nil, BTW.MP)
elseif Entity.GetHealth(npc) < boltdmg
then
BTW.Cast('zuus_lightning_bolt', BTW.Hero, npc, nil, BTW.MP)
return end
end
end
end
function BTW.StealCloud()
if not BTW.Enabled then return end
local staticdmg = 0
if Ability.GetLevel(BTW.Abilitys['zuus_static_field']) > 0 then
staticdmg = 2 + (2 * Ability.GetLevel(BTW.Abilitys['zuus_static_field']))
if Ability.GetLevel(BTW.Abilitys['special_bonus_unique_zeus']) == 1 then
staticdmg = staticdmg + 1.5
end
end
for n, npc in pairs(Heroes.GetAll()) do
if not Entity.IsDormant(npc) and Entity.IsAlive(npc) and not NPC.IsIllusion(npc) and not Entity.IsSameTeam(BTW.Hero, npc) and not NPC.HasState(npc, Enum.ModifierState.MODIFIER_STATE_MAGIC_IMMUNE) then
local boltdmg = Ability.GetDamage(BTW.Abilitys['zuus_lightning_bolt'])
if Ability.GetLevel(BTW.Abilitys['zuus_static_field']) > 0 then
boltdmg = boltdmg + (Entity.GetHealth(npc) * (staticdmg / 100) )
end
boltdmg = NPC.GetMagicalArmorDamageMultiplier(npc) * boltdmg
if Entity.GetHealth(npc) < boltdmg
then
BTW.Cast('zuus_cloud', BTW.Hero, npc, NPC.GetAbsOrigin(npc), BTW.MP)
return end
end
end
end
function BTW.InitAbility(name)
if not BTW.Enabled then return end
if BTW.Abilitys[name] ~= nil then return end
BTW.Abilitys[name] = NPC.GetItem(BTW.Hero, name, true) or NPC.GetAbility(BTW.Hero, name)
-- kostyli
if name == "item_dagon" then
BTW.Abilitys[name] = NPC.GetItem(BTW.Hero, "item_dagon", true)
for i = 0, 5 do
if not BTW.Abilitys[name] then BTW.Abilitys[name] = NPC.GetItem(BTW.Hero, "item_dagon_" .. i, true) end
end
end
end
function BTW.Initialize()
BTW.Enabled = false
if not GUI.IsEnabled(BTW.Identity) then return end
BTW.Hero = Heroes.GetLocal()
if BTW.Hero == nil then return end
if NPC.GetUnitName(BTW.Hero) ~= "npc_dota_hero_zuus" then return end
if not Entity.IsAlive(BTW.Hero) then return end
BTW.MP = NPC.GetMana(BTW.Hero)
BTW.Enabled = true
for k, v in pairs(BTW.CastTypes) do
BTW.InitAbility(k)
end
end
function BTW.Farm()
if not BTW.Enabled then return end
for n, npc in pairs(NPC.GetUnitsInRadius(BTW.Hero, Ability.GetCastRange(BTW.Abilitys['zuus_arc_lightning']), Enum.TeamType.TEAM_ENEMY)) do
if not NPC.HasState(npc, Enum.ModifierState.MODIFIER_STATE_MAGIC_IMMUNE)
and (Entity.GetHealth(npc) < (Ability.GetDamage(BTW.Abilitys['zuus_arc_lightning']) * NPC.GetMagicalArmorDamageMultiplier(npc)))
then
BTW.Cast('zuus_arc_lightning', BTW.Hero, npc, nil, BTW.MP)
end
end
end
function BTW.Spam()
if not BTW.Enabled then return end
for n, npc in pairs(NPC.GetUnitsInRadius(BTW.Hero, Ability.GetCastRange(BTW.Abilitys['zuus_arc_lightning']), Enum.TeamType.TEAM_ENEMY)) do
if not NPC.HasState(npc, Enum.ModifierState.MODIFIER_STATE_MAGIC_IMMUNE)
then
BTW.Cast('zuus_arc_lightning', BTW.Hero, npc, nil, BTW.MP)
return end
end
end
function BTW.Cast(name, self, npc, position, manapoint)
local ability = NPC.GetItem(self, name, true) or NPC.GetAbility(self, name)
if not GUI.SleepReady(BTW.Identity .. "casted" ) then return end
if name == "item_dagon" then
ability = NPC.GetItem(self, "item_dagon", true)
for i = 0, 5 do
if not ability then ability = NPC.GetItem(self, "item_dagon_" .. i, true) end
end
end
local casttype = BTW.CastTypes[name]
if ability == nil then return end
if ability
and Ability.IsCastable(ability, manapoint)
and Ability.IsReady(ability)
then
if casttype == 1 then Ability.CastNoTarget(ability)
elseif casttype == 2 then Ability.CastTarget(ability, npc)
else Ability.CastPosition(ability, position)
end
GUI.Sleep(BTW.Identity .. "casted", Ability.GetCastPoint(ability) + NetChannel.GetAvgLatency(Enum.Flow.FLOW_OUTGOING))
end
end
return BTW
|
local loveframes = require "loveframes"
local menus = require "menus"
local devices = require "devices"
require "devices.YololChip"
require "lfeditor"
local YololChipEditor = {
---@type YololChip
yololChip=nil,
viewOnly=false,
font=love.graphics.newFont("fonts/Inconsolata-Regular.ttf", 24),
lineColorPrimary={0.09, 0.13, 0.25, 1},
lineColorSecondary={0.08, 0.12, 0.2, 1},
lineColorExecute={0.83, 0.29, 0, 1},
lineColorPause={0.78, 0, 0, 1},
}
menus.YololChipEditor = YololChipEditor
local base = loveframes.Create("frame")
YololChipEditor.base = base
base:SetName("Yolol Chip Editor")
base:SetResizable(false)
base:SetDraggable(true)
base:SetVisible(false)
---@type lfeditor
local editor = loveframes.Create("editor", base)
function editor:linesChanged(...)
if YololChipEditor.yololChip ~= nil then
YololChipEditor.yololChip:linesChanged(...)
end
end
local rightPanel = loveframes.Create("panel", base)
local pauseButton = loveframes.Create("button", rightPanel)
pauseButton:SetText("")
function pauseButton:DrawOver()
local img = GetImage("imgs/chip_play.png")
local chip = YololChipEditor.yololChip
if chip ~= nil and chip:isPaused() then
img = GetImage("imgs/chip_pause.png")
end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(img, self.x, self.y, GetScale(img:getWidth(), img:getHeight(), 0, self.width, self.height))
end
function pauseButton:OnClick()
local chip = YololChipEditor.yololChip
if chip ~= nil then
if chip:isPaused() then
chip:setFieldValue("ChipWait", 0)
else
chip:setFieldValue("ChipWait", -1)
end
end
end
function base:OnClose()
base:SetVisible(false)
self.yololChip = nil
return false
end
function YololChipEditor:update()
local font = self.font
local baseYOff = 24
local lineLength = self.yololChip and self.yololChip.maxLineLength or devices.registered.YololChip.maxLineLength
local lineCount = self.yololChip and self.yololChip.lineCount or devices.registered.YololChip.lineCount
local lines = self.yololChip and self.yololChip.lines or nil
if lines == nil then
lines = {}
for i=1, lineCount do
lines[i] = ""
end
end
editor.font = font
editor.maxLineLength = lineLength
editor.lines = lines
editor.lineColors = {self.lineColorPrimary, self.lineColorSecondary} -- Temp until vmUpdate()
-- editor:SetSize(lineLength * font:getWidth("A"), lineCount * font:getHeight())
editor:update(0)
editor:SetPos(0, baseYOff)
rightPanel:SetPos(editor.width+1, baseYOff)
rightPanel:SetSize(85, editor.height)
pauseButton:SetSize(rightPanel.width-4, rightPanel.width-4)
pauseButton:SetPos(2, rightPanel.height-pauseButton.height-2)
base:SetSize(editor.width + rightPanel.width, editor.height + baseYOff)
if not base.visible then
base:SetPos((love.graphics.getWidth()-base.width)/2, (love.graphics.getHeight()-base.height)/2)
end
end
function YololChipEditor:vmUpdate()
if self.yololChip == nil or self.yololChip.vm == nil then
return
end
local chip = self.yololChip
local vm = chip.vm
local diagnostics = {}
editor.diagnostics = diagnostics
for i, line in ipairs(vm.lines) do
if i == vm.prevLine then
if chip:isPaused() then
editor.lineColors[i] = self.lineColorPause
else
editor.lineColors[i] = self.lineColorExecute
end
elseif i % 2 == 0 then
editor.lineColors[i] = self.lineColorPrimary
else
editor.lineColors[i] = self.lineColorSecondary
end
for _, diagnostic in pairs(line.metadata.errors) do
table.insert(diagnostics, {
line=i,
type="error",
msg=diagnostic.msg,
start=diagnostic.pos,
finish=diagnostic.pos+1
})
end
end
for line, lineErrors in pairs(vm.errors) do
for _, diagnostic in pairs(lineErrors) do
table.insert(diagnostics, {
line=line,
type=diagnostic.level,
msg=diagnostic.msg,
start=1,
finish=#editor.lines[line]+1
})
end
end
end
---@param yololChip YololChip
function YololChipEditor:OpenChip(yololChip)
self.yololChip = yololChip
editor.focus = true
base:MakeTop()
self:update()
self:vmUpdate()
base:SetVisible(true)
end
|
function fib(n)
if n == 0 then
return 0
elseif n == 1 then
return 1
else
return fib(n-1) + fib(n-2)
end
end
return fib(N)
|
----------Stats_ShipsCreated(g_playerID, GetShipId("Hgn_MS_Production_Fighter"))>=1--------------
-------------------------------------------------------------------------------
-- Writes ending stats to a file. Call this before you call the "setGameOver()"
-- function. Any newlines and/or double quotation marks contained in strings
-- that were retrieved from elsewhere (such as game rule settings) will break
-- this script.
--
-- Things that this function can't report on:
-- Map Name
-- Player Name
--
-- Can't write the player name because that is a wide character string. Can't
-- write the map name because the game rule has no idea what map is loaded.
--
-- Some values are not exactly the same as what is reported by the Stats
-- screen. Probably because the game takes an extra few milliseconds to
-- actually end after this script is run.
function WriteStats()
local game_time = Universe_GameTime()
local game_h = floor(game_time/3600)
local game_m = floor(game_time/60 - game_h * 60)
local game_s = game_time - game_m * 60 - game_h * 3600
local game_str = format("%02d:%02d:%02d", game_h, game_m, game_s)
local ftime = date("%H:%M:%S")
local fdate = date("%Y/%m/%d")
local fstamp = date("%m-%d-%Y_%H_%M_%S")
if (strsub(fstamp, 1, 1) == "0") then
fstamp = strsub(fstamp, 2)
end
-- These variables must match those listed in "data\ui\newui\stats.lua".
-- Combat total = (ShipbuiltRU) + (ShipsCapturedRU) + (ShipsDestroyedRU) - (ShipslostRU)
local smShipBuiltRU = 1.0
local smShipsCapturedRU = 1.0
local smShipsDestroyedRU = 1.0
local smShipsLostRU = 1.0
-- Resource total = (ResourcesHarvested) + (ResourcesSpent) + (CollectorsBuiltRU) + (RefineriesRU)
local smResourcesHarvestedRU = 0.5
local smResourcesSpentRU = 0.5
local smCollectorsBuiltRU = 1.0
local smRefineriesRU = 1.0
-- Building & Research total = (Total build shipsRU) + (NumSubsystemsRU) + (ResearchRU)
local smBuildShipsRU = 1.0
local smSubsystemsRU = 1.5
local smResearchRU = 1.0
-- Diplomacy total = (Tribute donated) - (Tribute received) + deathTime * 3
local smTributeDonatedRU = 1.0
local smTributeReceivedRU = 0.25
local smDeathTimeLoserSec = 2.245 -- just to make the numbers not so obvious
local smDeathTimeWinnerSec = 4.879
writeto("HWCE_EndGame_" .. fstamp .. ".stats")
write("\n INFO = {")
write("\n TotalTime = \"" .. game_str .. "\",")
write("\n LocalTime = \"" .. ftime .. "\",")
write("\n LocalDate = \"" .. fdate .. "\",")
write("\n RulesName = \"" .. GameRulesName .. "\",")
--write("\n MapName = \"unknown\",")
write("\n },")
write("\n RULES = {")
for i = 1, getn(GameSetupOptions) do
local thisRule = GameSetupOptions[i]
local thisRuleID = thisRule.name
local thisRuleName = thisRule.locName
local thisRuleChoices = thisRule.choices
local thisRuleSetting = GetGameSettingAsString(thisRuleID)
local thisRuleSettingLabel = ""
for j = 2, getn(thisRuleChoices), 2 do
local choiceLabel = thisRuleChoices[j - 1]
local choiceValue = tostring(thisRuleChoices[j])
if (thisRuleSetting == choiceValue) then
thisRuleSettingLabel = choiceLabel
break
end
end
write("\n {Rule = \"" .. thisRuleName .. "\", Setting = \"" .. thisRuleSettingLabel .. "\"},")
end
write("\n },")
for playerIndex = 0, Player_Count do
local sRace = Player_Races[playerIndex + 1]
WST_trace("Player " .. playerIndex .. " is race " .. sRace .. ".")
write("\n Player" .. playerIndex .. " = {")
-- Building & Research total = (Total build shipsRU) + (NumSubsystemsRU) + (ResearchRU)
local BuildingTotal = floor(Stats_BuildShipsBuiltInRUs(playerIndex) * smBuildShipsRU + Stats_SubsystemsBuiltInRUs(playerIndex) * smSubsystemsRU + Stats_ResearchRUValue(playerIndex) * smResearchRU)
local BuildCapableShips = Stats_BuildShipsBuilt(playerIndex)
local ResearchCost = Stats_ResearchRUValue(playerIndex)
local ResearchPercent = floor(100 * Stats_ResearchCount(playerIndex)/Stats_ResearchTotal(playerIndex))
local TotalSubsystems = Stats_SubsystemsBuilt(playerIndex)
write("\n BUILDING = {")
write("\n BuildingTotal = " .. BuildingTotal .. ",")
write("\n BuildCapableShips = " .. BuildCapableShips .. ",")
write("\n ResearchCost = " .. ResearchCost .. ",")
write("\n ResearchPercent = " .. ResearchPercent .. ",")
write("\n TotalSubsystems = " .. TotalSubsystems .. ",")
write("\n },")
-- Combat total = (ShipbuiltRU) + (ShipsCapturedRU) + (ShipsDestroyedRU) - (ShipslostRU)
local CombatTotal = floor(Stats_TotalShipsBuiltInRUs(playerIndex) * smShipBuiltRU + Stats_EnemyShipsCapturedInRUs(playerIndex) * smShipsCapturedRU + Stats_TotalKillsInRUs(playerIndex) * smShipsDestroyedRU - Stats_TotalLossesInRUs(playerIndex) * smShipsLostRU)
local TotalShipsBuilt = Stats_TotalShipsBuilt(playerIndex)
local TotalShipsCaptured = Stats_EnemyShipsCaptured(playerIndex)
local TotalShipsDestroyed = Stats_TotalKills(playerIndex)
local TotalShipsLost = Stats_TotalLosses(playerIndex)
write("\n COMBAT = {")
write("\n CombatTotal = " .. CombatTotal .. ",") -- seems okay
write("\n TotalShipsBuilt = " .. TotalShipsBuilt .. ",") -- seems okay
write("\n TotalShipsCaptured = " .. TotalShipsCaptured .. ",") -- seems okay
write("\n TotalShipsDestroyed = " .. TotalShipsDestroyed .. ",") -- seems okay
write("\n TotalShipsLost = " .. TotalShipsLost .. ",") -- seems okay
write("\n },")
local TimeOfDeathValue = Stats_TimeKilled(playerIndex)
local TimeOfDeathText = TimeOfDeathValue
local TimeOfDeathMulti = smDeathTimeLoserSec
if (TimeOfDeathValue == 0) then
TimeOfDeathValue = Stats_TotalDuration()
TimeOfDeathText = "\"--\""
TimeOfDeathMulti = smDeathTimeWinnerSec
end
local TributeDonated = Stats_TributeDonated(playerIndex)
local TributeReceived = Stats_TributeReceived(playerIndex)
-- Diplomacy total = (Tribute donated) - (Tribute received) + deathTime * 3
local DiplomacyTotal = floor(TributeDonated * smTributeDonatedRU - TributeReceived * smTributeReceivedRU + TimeOfDeathValue * TimeOfDeathMulti)
write("\n DIPLOMACY = {")
write("\n DiplomacyTotal = " .. DiplomacyTotal .. ",")
write("\n TimeOfDeath = " .. TimeOfDeathText .. ",")
write("\n TributeDonated = " .. TributeDonated .. ",")
write("\n TributeReceived = " .. TributeReceived .. ",")
write("\n },")
local RefineryShipCount = 0
local RefineryRUsCount = 0
local thisList = ResourceControllersList[sRace] -- stored in "objectlist_misc.lua"
for i = 1, getn(thisList) do
local thisShip = thisList[i]
RefineryShipCount = RefineryShipCount + Stats_ShipsCreated(playerIndex, GetShipId(thisShip))
RefineryRUsCount = RefineryRUsCount + Stats_ShipsCreatedInRUs(playerIndex, GetShipId(thisShip))
end
local ResourceCollectors = Stats_HarvestersBuilt(playerIndex)
local TotalRUHarvested = Stats_GatheredRUs(playerIndex)
local TotalRUSpent = Stats_SpentRUs(playerIndex)
-- Resource total = (ResourcesHarvested) + (ResourcesSpent) + (CollectorsBuiltRU) + (RefineriesRU)
local ResourceTotal = floor(TotalRUHarvested * smResourcesHarvestedRU + TotalRUSpent * smResourcesSpentRU + Stats_HarvestersBuiltInRUs(playerIndex) * smCollectorsBuiltRU + RefineryRUsCount * smRefineriesRU)
write("\n RESOURCE = {")
write("\n MobileRefineries = " .. RefineryShipCount .. ",")
write("\n ResourceCollectors = " .. ResourceCollectors .. ",")
write("\n ResourceTotal = " .. ResourceTotal .. ",")
write("\n TotalRUHarvested = " .. TotalRUHarvested .. ",")
write("\n TotalRUSpent = " .. TotalRUSpent .. ",")
write("\n },")
local OverviewTotal = BuildingTotal + CombatTotal + DiplomacyTotal + ResourceTotal
write("\n OVERVIEW = {")
write("\n BuildingTotal = " .. BuildingTotal .. ",")
write("\n CombatTotal = " .. CombatTotal .. ",")
write("\n DiplomacyTotal = " .. DiplomacyTotal .. ",")
write("\n ResourceTotal = " .. ResourceTotal .. ",")
write("\n OverviewTotal = " .. OverviewTotal .. ",")
write("\n },")
write("\n SHIPS = {")
dofilepath("data:scripts/races/" .. sRace .. "/scripts/def_build.lua")
for i, iCount in build do
local bldName = iCount.ThingToBuild
local bldType = iCount.Type
if (bldType == 0) then
local bldAmount = Stats_ShipsCreated(playerIndex, GetShipId(bldName))
write("\n {Type = " .. bldType .. ", ThingToBuild = \"" .. bldName .. "\", Number = " .. bldAmount .. ",},")
WST_trace("Player = " .. playerIndex .. ", Type = " .. bldType .. ", ThingToBuild = \"" .. bldName .. "\", Number = " .. bldAmount)
end
end
write("\n },")
write("\n SUBSYSTEMS = {")
for i, iCount in build do
local bldName = iCount.ThingToBuild
local bldType = iCount.Type
if (bldType == 1) then
local bldAmount = Stats_ShipsCreated(playerIndex, GetShipId(bldName))
write("\n {Type = " .. bldType .. ", ThingToBuild = \"" .. bldName .. "\", Number = " .. bldAmount .. ",},")
WST_trace("Player = " .. playerIndex .. ", Type = " .. bldType .. ", ThingToBuild = \"" .. bldName .. "\", Number = " .. bldAmount)
end
end
write("\n },")
write("\n RESEARCH = {")
dofilepath("data:scripts/races/" .. sRace .. "/scripts/def_research.lua")
local resCount = 0
for i, iCount in research do
local resName = iCount.Name
local resComplete = Player_HasResearch(playerIndex, resName)
resCount = resCount + resComplete
write("\n {Name = \"" .. resName .. "\", Completed = " .. resComplete .. ",},")
WST_trace("Player = " .. playerIndex .. ", Name = \"" .. resName .. "\", Completed = " .. resComplete)
end
write("\n },")
local RaceString = RacesListCorrectCase[sRace]
local PlayerTeam = Player_Team(playerIndex)
local PlayerIsAlive = Player_IsAlive(playerIndex)
local PlayerIsLocal = 0
if (playerIndex == FE_GetCurrentPlayerIndex()) then
PlayerIsLocal = 1
end
write("\n GENERAL = {")
write("\n Name = \"unkown\",")
write("\n Race = \"" .. RaceString .. "\",")
write("\n Team = " .. PlayerTeam .. ",")
write("\n Alive = " .. PlayerIsAlive .. ",")
write("\n Local = " .. PlayerIsLocal .. ",")
write("\n },")
write("\n },")
end
write("\n")
writeto()
print("GPE: ADVANCED STATS written to profile folder.")
-- Subtitle_Message("GPE: Additional end-of-game stats have been written to each player's profile directory.", 10)
Rule_Remove("WriteStats") -- should this function be a rule or not?
end
--------------------------------------------------------------------------------
-- Writes advanced stats to the local player's profile folder before killing him.
-- Partially disabled because maybe it's best only to write the stats at the end of the game, so that they are identical for all players (if they stick it out).
--
function WriteStatsThenKillPlayer(playerIndex)
-- if (playerIndex == FE_GetCurrentPlayerIndex()) then
-- WriteStats()
-- end
Player_Kill(playerIndex)
if (playerIndex ~= Universe_CurrentPlayer()) then
local playerNameW = Player_GetName(playerIndex)
--UI_SetScreenEnabled("PlayerDestroyedScreen", 1)
--UI_SetScreenVisible("PlayerDestroyedScreen", 1)
--UI_SetTextLabelTextWF1("PlayerDestroyedScreen", "lblDescription1", "$1231", playerNameW)
Sound_SpeechPlay("data:sound\\speech\\missions\\m_15\\47100")
Player_AddLocalChatMessage("$1231", playerNameW)
end
end
|
local Import = require"Toolbox.Import"
local Object = Import.Module.Relative"Compiler.Object"
return Object(
"Nested.PEG.Atleast", {
Construct = function(self, Amount, InnerPattern)
self.Amount = Amount
self.InnerPattern = InnerPattern
end;
Decompose = function(self, Canonical)
return self.InnerPattern(Canonical)^self.Amount
end;
Copy = function(self)
return self.Amount, -self.InnerPattern
end;
ToString = function(self)
return tostring(self.InnerPattern) .."^".. self.Amount
end;
}
)
|
Citizen.CreateThread( function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(0, 0x8CC9CD42) then -- x
local playerPed = PlayerPedId()
if not IsEntityDead(playerPed) and not Citizen.InvokeNative(0x9682F850056C9ADE, playerPed) then
local animDict = "script_proc@robberies@homestead@lonnies_shack@deception"
if not IsEntityPlayingAnim(playerPed, animDict, "hands_up_loop", 3) then
if not HasAnimDictLoaded(animDict) then
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(0)
end
end
TaskPlayAnim(playerPed, animDict, "hands_up_loop", 2.0, -2.0, -1, 67109393, 0.0, false, 1245184, false, "UpperbodyFixup_filter", false)
RequestAnimDict(animDict)
else
ClearPedSecondaryTask(playerPed)
end
end
end
end
end)
|
local socket = require'socket'
local tools = require'websocket.tools'
local frame = require'websocket.frame'
local handshake = require'websocket.handshake'
local debug = require'debug'
local tconcat = table.concat
local tinsert = table.insert
local ev = function(ws)
ws = ws or {}
local ev = require'ev'
local sock
local loop = ws.loop or ev.Loop.default
local fd
local message_io
local handshake_io
local async_send
local self = {}
self.state = 'CLOSED'
local close_timer
local user_on_message
local user_on_close
local user_on_open
local user_on_error
local on_error = function(s,err) print('Websocket client unhandled error',s,err) end
local on_close = function(was_clean,code,reason)
if close_timer then
close_timer:stop(loop)
close_timer = nil
end
if message_io then
message_io:stop(loop)
end
self.state = 'CLOSED'
if user_on_close then
user_on_close(self,was_clean,code,reason or '')
end
sock:shutdown()
sock:close()
end
local on_open = function()
self.state = 'OPEN'
if user_on_open then
user_on_open(self)
end
end
local handle_socket_err = function(err)
if err == 'closed' then
if self.state ~= 'CLOSED' then
on_close(false,1006,'')
end
else
on_error(err)
end
end
local on_message = function(message,opcode)
if opcode == frame.TEXT or opcode == frame.BINARY then
if user_on_message then
user_on_message(self,message,opcode)
end
elseif opcode == frame.CLOSE then
if self.state ~= 'CLOSING' then
self.state = 'CLOSING'
local code,reason = frame.decode_close(message)
local encoded = frame.encode_close(code)
encoded = frame.encode(encoded,frame.CLOSE,true)
async_send(encoded,
function()
on_close(true,code or 1005,reason)
end,handle_socket_err)
else
on_close(true,code or 1005,reason)
end
end
end
self.send = function(_,message,opcode)
local encoded = frame.encode(message,opcode or frame.TEXT,true)
async_send(encoded, nil, handle_socket_error)
end
local connect = function(_,params)
if self.state ~= 'CLOSED' then
error('wrong state')
end
self.state = 'CONNECTING'
local protocol,host,port,uri = tools.parse_url(params.url)
if protocol ~= 'ws' then
error('Protocol not supported:'..protocol)
end
assert(not sock)
sock = socket.tcp()
fd = sock:getfd()
assert(fd > -1)
-- set non blocking
sock:settimeout(0)
sock:setoption('tcp-nodelay',true)
async_send = require'websocket.ev_common'.async_send(sock,loop)
user_on_open = params.on_open or user_on_open
ev.IO.new(
function(loop,connect_io)
connect_io:stop(loop)
local key = tools.generate_key()
local req = handshake.upgrade_request
{
key = key,
host = host,
port = port,
protocols = {params.protocol or ''},
origin = ws.origin,
uri = uri
}
async_send(
req,
function()
local resp = {}
local last
assert(sock:getfd() > -1)
handshake_io = ev.IO.new(
function(loop,read_io)
repeat
local line,err,part = sock:receive('*l')
if line then
if last then
line = last..line
last = nil
end
resp[#resp+1] = line
elseif err ~= 'timeout' then
read_io:stop(loop)
handle_socket_err(err)
return
else
last = part
return
end
until line == ''
read_io:stop(loop)
handshake_io = nil
local response = table.concat(resp,'\r\n')
local headers = handshake.http_headers(response)
local expected_accept = handshake.sec_websocket_accept(key)
if headers['sec-websocket-accept'] ~= expected_accept then
local msg = 'Websocket Handshake failed: Invalid Sec-Websocket-Accept (expected %s got %s)'
msg = msg:format(expected_accept,headers['sec-websocket-accept'] or 'nil')
on_error(self,msg)
return
end
message_io = require'websocket.ev_common'.message_io(
sock,loop,
on_message,
handle_socket_err)
on_open(self)
end,fd,ev.READ)
handshake_io:start(loop)-- handshake
end,
handle_socket_err)
end,fd,ev.WRITE):start(loop)-- connect
local _,err = sock:connect(host,port)
assert(_ == nil)
if err ~= 'timeout' then
error('Websocket could not connect to '..ws.url)
end
end
self.on_close = function(_,on_close_arg)
user_on_close = on_close_arg
end
self.on_error = function(_,on_error_arg)
user_on_error = on_error_arg
end
self.on_open = function(_,on_open_arg)
user_on_open = on_open_arg
end
self.on_message = function(_,on_message_arg)
user_on_message = on_message_arg
end
self.close = function(_,code,reason,timeout)
if self.state == 'CONNECTING' then
self.state = 'CLOSING'
assert(handshake_io)
assert(not message_io)
handshake_io:stop(loop)
handshake_io = nil
on_close(false,1006,'not open')
return
elseif self.state == 'OPEN' then
assert(not handshake_io)
assert(message_io)
self.state = 'CLOSING'
timeout = timeout or 3
local encoded = frame.encode_close(code or 1000,reason)
encoded = frame.encode(encoded,frame.CLOSE,true)
-- this should let the other peer confirm the CLOSE message
-- by 'echoing' the message.
async_send(encoded)
close_timer = ev.Timer.new(function()
close_timer = nil
on_close(false,1006,'timeout')
end,timeout)
close_timer:start(loop)
end
end
self.connect = connect
return self
end
return ev
|
-- keep all key, mouse, etc events here
function love.keyreleased(key)
if key == "escape" then
game.pause = not game.pause
end
if key == 'tab' then
game.debug = not game.debug
end
end
function love.resize(w, h)
game.dims.x = w
game.dims.y = h
end
|
-- Credits: Marmota#2533
ui_page "ui.html"
files {
"ui.html",
"ui.css",
"ui.js",
"heartbeat-solid.svg",
"shield-alt-solid.svg"
}
client_scripts{
"@vrp/lib/utils.lua",
"client.lua"
}
server_scripts {
"@vrp/lib/utils.lua",
"server.lua"
}
|
local max_v = 10000
function f(x,y)
return math.ceil(y) * 100000 + math.ceil(x)
end
local n = 100
local list = {
{n,n},
{-n + 100,n},
{-n,-n + 400},
{n,-n},
}
for i,v in ipairs(list) do
print(f(v[1],v[2]))
end
|
---‘userdata’类型的,包含了颜色的二进制数据
---@class ColorFeature
---@field toString fun():string
---‘userdata’类型的,包含了一个或多个颜色与坐标数据的二进制数据
---@class CoordColorFeature
---@field toString fun():string
local M = {
---找图找色函数超出屏幕范围时,抛出的错误消息
COORDINATES_OVERFLOW = "The coordinates are off screen",
---找图找色时使用的查找方向
FIND_ORDER = {
UP_DOWN_LEFT_RIGHT=0,
UP_DOWN_RIGHT_LEFT=1,
DOWN_UP_LEFT_RIGHT=2,
DOWN_UP_RIGHT_LEFT=3,
LEFT_RIGHT_UP_DOWN=4,
LEFT_RIGHT_DOWN_UP=5,
RIGHT_LEFT_UP_DOWN=6,
RIGHT_LEFT_DOWN_UP=7,
}
}
---位图‘userdata’类型的,包含了二进制图色数据
---@class Bitmap
---‘userdata’类型的点阵数据
---@class DotMatrix
---@field toTable fun():table
---@field height fun():integer
---@field width fun():integer
---@field findMatrix fun(matrix:DotMatrix,sim:number):integer,integer
---将table类型的点阵数据转化为userdata类型的以便于使用
---@param t table ‘table’类型的点阵数据
---@return DotMatrix ‘userdata’类型的点阵数据
function M.newDotMatrix(t)
end
---范围内查找符合点阵特征的点的坐标,返回第一个找到的点坐标,没找到则返回-1,-1
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColor integer 偏移颜色
---@param dotMatrix DotMatrix|nil 将点阵数据填充到其中
---@return DotMatrix 点阵
function M.getDotMatrixByShiftColor(bitmap,x,y,x1,y1,color,shiftColor,dotMatrix)
end
---范围内查找符合点阵特征的点的坐标,返回第一个找到的点坐标,没找到则返回-1,-1
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColorSum integer 屏幕颜色与特征颜色计算的差和小于等于此参数则符合,大于则不符合
---@param dotMatrix DotMatrix|nil 将点阵数据填充到其中
---@return DotMatrix 点阵
function M.getDotMatrixByShiftColorSum(bitmap,x,y,x1,y1,color,shiftColorSum,dotMatrix)
end
---获取范围内符合颜色特征的坐标与颜色
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColor integer 偏移颜色
---@return table 坐标与颜色的数据
function M.getColorCoordMatrixByShiftColor(bitmap,x,y,x1,y1,color,shiftColor)
end
---获取范围内符合颜色特征的坐标与颜色
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColorSum integer 屏幕颜色与指定颜色计算的差和小于等于此参数则符合,大于则不符合
---@return table 坐标与颜色的数据
function M.getColorCoordMatrixByShiftColorSum(bitmap,x,y,x1,y1,color,shiftColorSum)
end
---获取屏幕指定坐标的颜色
---@param bitmap Bitmap 位图
---@param x integer 横坐标
---@param y integer 纵坐标
---@return integer 坐标颜色,格式BGR
function M.getColor(bitmap,x,y)
end
---用屏幕指定坐标的颜色与多个颜色进行对比,返回第一个符合的索引,没有则返回0
---@param bitmap Bitmap 位图
---@param x integer 横坐标
---@param y integer 纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColor integer 偏移颜色
---@return integer 第一个符合屏幕颜色的颜色特征的索引,没有符合的返回0
function M.whichColorByShiftColor(bitmap,x,y,color,shiftColor)
end
---用屏幕指定坐标的颜色与多个颜色进行对比,返回第一个符合的索引,没有则返回0
---@param bitmap Bitmap 位图
---@param x integer 横坐标
---@param y integer 纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColorSum integer 屏幕颜色与指定颜色计算的差和小于等于此参数则符合,大于则不符合
---@return integer 第一个符合屏幕颜色的颜色特征的索引,没有符合的返回0
function M.whichColorByShiftColorSum(bitmap,x,y,color,shiftColorSum)
end
---获取范围内符合颜色特征的点的计数
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColor integer 偏移颜色
---@return integer 符合颜色特征的总数
function M.getColorCountByShiftColor(bitmap,x,y,x1,y1,color,shiftColor)
end
---获取范围内符合颜色特征的点的计数
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColorSum integer 屏幕颜色与指定颜色计算的差和小于等于此参数则符合,大于则不符合
---@return integer 符合颜色特征的总数
function M.getColorCountByShiftColorSum(bitmap,x,y,x1,y1,color,shiftColorSum)
end
---范围内查找符合指定颜色特征的点,返回第一个找到的点坐标,没找到则返回-1,-1
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param findOrder integer 查找的方向
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColor integer 偏移颜色
---@return integer 找到的点的横坐标
---@return integer 找到的点的纵坐标
function M.findColorByShiftColor(bitmap,x,y,x1,y1,color,shiftColor,findOrder)
end
---范围内查找符合指定颜色特征的点,返回第一个找到的点坐标,没找到则返回-1,-1
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param findOrder integer 查找的方向
---@param color integer|string|ColorFeature 颜色特征
---@param shiftColorSum integer 屏幕颜色与指定颜色计算的差和小于等于此参数则符合,大于则不符合
---@return integer 找到的点的横坐标
---@return integer 找到的点的纵坐标
function M.findColorByShiftColorSum(bitmap,x,y,x1,y1,color,shiftColorSum,findOrder)
end
---范围内查找符合坐标颜色特征的点,返回第一个找到的点坐标,没找到则返回-1,-1
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param findOrder integer 查找的方向
---@param color integer|string|ColorFeature 颜色特征
---@param coordColor string|CoordColorFeature 偏移坐标颜色特征
---@param shiftColor integer 偏移颜色
---@param canErrorSum integer 允许错误的坐标颜色的总数,当对比坐标颜色时允许一定数量的点颜色不符
---@return integer 找到的点的横坐标
---@return integer 找到的点的纵坐标
function M.findFeatureByShiftColor(bitmap,x,y,x1,y1,color,coordColor,shiftColor,canErrorSum,findOrder)
end
---范围内查找符合坐标颜色特征的点,返回第一个找到的点坐标,没找到则返回-1,-1
---@param bitmap Bitmap 位图
---@param x integer 最小的横坐标
---@param y integer 最小的纵坐标
---@param x1 integer 最大的横坐标
---@param y1 integer 最大的纵坐标
---@param findOrder integer 查找的方向
---@param color integer|string|ColorFeature 颜色特征
---@param coordColor string|CoordColorFeature 偏移坐标颜色特征
---@param shiftColorSum integer 屏幕颜色与指定颜色计算的差和小于等于此参数则符合,大于则不符合
---@param canErrorSum integer 允许错误的坐标颜色的总数,当对比坐标颜色时允许一定数量的点颜色不符
---@return integer 找到的点的横坐标
---@return integer 找到的点的纵坐标
function M.findFeatureByShiftColorSum(bitmap,x,y,x1,y1,color,coordColor,shiftColorSum,canErrorSum,findOrder)
end
---对比坐标颜色的特征
---@param bitmap Bitmap 位图
---@param coordColor string|CoordColorFeature 坐标颜色特征
---@param shiftColor integer 偏移颜色
---@param canErrorSum integer 允许错误的坐标颜色的总数,当对比坐标颜色时允许一定数量的点颜色不符
---@return boolean 是否符合坐标颜色特征
function M.isFeatureByShiftColor(bitmap,coordColor,shiftColor,canErrorSum)
end
---对比坐标颜色的特征
---@param bitmap Bitmap 位图
---@param coordColor string|CoordColorFeature 坐标颜色特征
---@param shiftColorSum integer 屏幕颜色与指定颜色计算的差和小于等于此参数则符合,大于则不符合
---@param canErrorSum integer 允许错误的坐标颜色的总数,当对比坐标颜色时允许一定数量的点颜色不符
---@return boolean 是否符合坐标颜色特征
function M.isFeatureByShiftColorSum(bitmap,coordColor,shiftColorSum,canErrorSum)
end
return M
|
-- The function is used to create Particle System object for Particle File Data, You can use it in your project.
-- And you need to provide the parameter of texture and lifeTime.
return function (data, texture)
local ps = love.graphics.newParticleSystem (texture, data.bufferSize)
ps:setEmitterLifetime (data.emitterLifetime)
ps:setEmissionRate (data.emissionRate)
ps:setParticleLifetime (unpack (data.particleLifetime))
ps:setAreaSpread (data.areaSpread.distribution, unpack (data.areaSpread.distance))
ps:setInsertMode (data.insertMode)
ps:setOffset (unpack (data.offset))
ps:setDirection (data.direction)
ps:setSpread (data.spread)
ps:setSpeed (unpack (data.speed))
ps:setParticleLifetime (unpack (data.particleLifetime))
ps:setRadialAcceleration (unpack (data.radialAcceleration))
ps:setTangentialAcceleration (unpack (data.tangentialAcceleration))
ps:setLinearDamping (unpack (data.linearDamping))
ps:setLinearAcceleration (data.linearAcceleration.min [1], data.linearAcceleration.min [2], data.linearAcceleration.max [1], data.linearAcceleration.max [2])
ps:setSpin (unpack (data.spin.interval))
ps:setSpinVariation (data.spin.variation)
ps:setRotation (unpack (data.rotation.interval))
ps:setRelativeRotation (data.rotation.enable)
if (#data.colors > 0) then
ps:setColors (unpack (data.colors))
end
if (#data.sizes > 0) then
ps:setSizes (unpack (data.sizes))
end
if (data.quad) then
ps:setQuads (data.quad)
elseif (#data.quads > 0) then
local quads = {}
for n=1, #data.quads do
quads [n] = love.graphics.newQuad (unpack (data.quads [n]))
end
ps:setQuads (unpack (quads))
return ps, quads
end
return ps
end
|
type = SCENARIO
name = "null"
function initialize()
ps = player_ship()
ps:set_position(1.40673537711, 0.495382619358, 300e3)
ps:set_bearing(0)
ps:set_velocity(0, 0, 7730.811)
ns = spawn_ship("mumeifune")
ns:set_position(1.407, 0.49530, 297.5e3)
ns:set_bearing(0)
ns:set_velocity(0, 20, 7720)
ns = spawn_ship("mumeifune")
ns:set_position(1.407, 0.49535, 297.5e3)
ns:set_bearing(0)
ns:set_velocity(0, 20, 7720)
ns = spawn_ship("mumeifune")
ns:set_position(1.407, 0.49540, 297.5e3)
ns:set_bearing(0)
ns:set_velocity(0, 20, 7720)
enable_player_physics(true)
end
|
local utils=require "leda.utils"
autostart_stage=leda.stage{
handler=function(...)
print(...)
leda.quit()
end,
autostart={'Autostarted','param',10,math.pi}
}
local g=leda.graph{start=autostart_stage}
g:run()
|
local state = require("loaded_state")
local utils = require("utils")
local configs = require("configs")
local viewportHandler = require("viewport_handler")
local selectionUtils = require("selections")
local drawing = require("drawing")
local colors = require("colors")
local selectionItemUtils = require("selection_item_utils")
local keyboardHelper = require("keyboard_helper")
local toolUtils = require("tool_utils")
local history = require("history")
local snapshotUtils = require("snapshot_utils")
local hotkeyStruct = require("structs.hotkey")
local layerHandlers = require("layer_handlers")
local tool = {}
tool._type = "tool"
tool.name = "selection"
tool.group = "placement"
tool.image = nil
tool.layer = "entities"
tool.validLayers = {
"entities",
"triggers",
"decalsFg",
"decalsBg"
}
local selectionRectangle = nil
local selectionCompleted = false
local selectionStartX, selectionStartY = nil ,nil
local selectionPreviews = nil
local copyPreviews = nil
local selectionMovementKeys = {
{"itemMoveLeft", -1, 0},
{"itemMoveRight", 1, 0},
{"itemMoveUp", 0, -1},
{"itemMoveDown", 0, 1},
}
function tool.unselect()
selectionPreviews = nil
end
local function selectionStarted(x, y)
selectionRectangle = utils.rectangle(x, y, 0, 0)
selectionPreviews = nil
selectionCompleted = false
selectionStartX = x
selectionStartY = y
end
local function selectionChanged(x, y, width, height)
local room = state.getSelectedRoom()
-- Only update if needed
if x ~= selectionRectangle.x or y ~= selectionRectangle.y or width ~= selectionRectangle.width or height ~= selectionRectangle.height then
selectionRectangle = utils.rectangle(x, y, width, height)
selectionPreviews = selectionUtils.getSelectionsForRoomInRectangle(room, tool.layer, selectionRectangle)
end
end
local function selectionFinished()
selectionRectangle = false
selectionCompleted = true
end
local function drawSelectionArea(room)
if selectionRectangle then
-- Don't render if selection rectangle is too small, weird visuals
if selectionRectangle.width >= 1 and selectionRectangle.height >= 1 then
viewportHandler.drawRelativeTo(room.x, room.y, function()
drawing.callKeepOriginalColor(function()
local x, y = selectionRectangle.x, selectionRectangle.y
local width, height = selectionRectangle.width, selectionRectangle.height
local borderColor = colors.selectionBorderColor
local fillColor = colors.selectionFillColor
love.graphics.setColor(fillColor)
love.graphics.rectangle("fill", x, y, width, height)
love.graphics.setColor(borderColor)
love.graphics.rectangle("line", x, y, width, height)
end)
end)
end
end
end
local function drawSelectionPreviews(room)
if selectionPreviews then
local preview = not selectionCompleted
local borderColor = preview and colors.selectionPreviewBorderColor or colors.selectionCompleteBorderColor
local fillColor = preview and colors.selectionPreviewFillColor or colors.selectionCompleteFillColor
-- Draw all fills then borders
-- Greatly reduces amount of setColor calls
-- Potentially find a better solution?
viewportHandler.drawRelativeTo(room.x, room.y, function()
drawing.callKeepOriginalColor(function()
for _, rectangle in ipairs(selectionPreviews) do
local x, y = rectangle.x, rectangle.y
local width, height = rectangle.width, rectangle.height
love.graphics.setColor(fillColor)
love.graphics.rectangle("fill", x, y, width, height)
end
end)
drawing.callKeepOriginalColor(function()
for _, rectangle in ipairs(selectionPreviews) do
local x, y = rectangle.x, rectangle.y
local width, height = rectangle.width, rectangle.height
love.graphics.setColor(borderColor)
love.graphics.rectangle("line", x, y, width, height)
end
end)
end)
end
end
local function moveItems(room, layer, previews, offsetX, offsetY)
local snapshot, redraw, selectionsBefore = snapshotUtils.roomLayerSnapshot(function()
local redraw = false
local selectionsBefore = utils.deepcopy(selectionPreviews)
for _, item in ipairs(previews) do
local moved = selectionItemUtils.moveSelection(room, layer, item, offsetX, offsetY)
if moved then
redraw = true
end
end
return redraw, selectionsBefore
end, room, layer, "Selection Moved")
return snapshot, redraw
end
local function deleteItems(room, layer, previews)
local snapshot, redraw, selectionsBefore = snapshotUtils.roomLayerSnapshot(function()
local redraw = false
local selectionsBefore = utils.deepcopy(selectionPreviews)
for i = #previews, 1, -1 do
local item = previews[i]
local deleted = selectionItemUtils.deleteSelection(room, layer, item)
if deleted then
redraw = true
table.remove(selectionPreviews, i)
end
end
return redraw, selectionsBefore
end, room, layer, "Selection Deleted")
return snapshot, redraw
end
local function getPreviewsCorners(previews)
local tlx, tly = math.huge, math.huge
local brx, bry = -math.huge, -math.huge
for _, preview in ipairs(previews or selectionPreviews) do
tlx = math.min(tlx, preview.x)
tly = math.min(tly, preview.y)
brx = math.max(brx, preview.x + preview.width)
bry = math.max(bry, preview.y + preview.height)
end
return tlx, tly, brx, bry
end
-- TODO - Improve decal logic, currently can't copy paste between bg <-> fg
local function pasteItems(room, layer, previews)
local pasteCentered = configs.editor.pasteCentered
local snapshot, usedLayers = snapshotUtils.roomLayerSnapshot(function()
local layerItems = {}
local cursorX, cursorY = toolUtils.getCursorPositionInRoom(viewportHandler.getMousePosition())
local tlx, tly, brx, bry = getPreviewsCorners(previews)
local width, height = brx - tlx, bry - tly
local widthOffset = pasteCentered and width / 2 or 0
local heightOffset = pasteCentered and height / 2 or 0
for _, preview in ipairs(previews) do
-- TODO - Assign id if needed
local item = preview.item
local targetLayer = preview.layer
item.x = cursorX + item.x - tlx - widthOffset
item.y = cursorY + item.y - tly - heightOffset
preview.x = cursorX + preview.x - tlx - widthOffset
preview.y = cursorY + preview.y - tly - heightOffset
local targetItems = layerItems[targetLayer]
if not targetItems then
local handler = layerHandlers.getHandler(targetLayer)
if handler and handler.getRoomItems then
targetItems = handler.getRoomItems(room, targetLayer)
layerItems[targetLayer] = targetItems
end
end
if targetItems then
table.insert(targetItems, item)
end
end
selectionPreviews = previews
return table.keys(layerItems)
end, room, layer, "Selection Pasted")
return snapshot, usedLayers
end
local function handleItemMovementKeys(room, key, scancode, isrepeat)
if not selectionPreviews then
return
end
for _, movementData in ipairs(selectionMovementKeys) do
local configKey, offsetX, offsetY = movementData[1], movementData[2], movementData[3]
local targetKey = configs.editor[configKey]
if not keyboardHelper.modifierHeld(configs.editor.precisionModifier) then
offsetX *= 8
offsetY *= 8
end
if targetKey == key then
local snapshot, redraw = moveItems(room, tool.layer, selectionPreviews, offsetX, offsetY)
if redraw then
history.addSnapshot(snapshot)
toolUtils.redrawTargetLayer(room, tool.layer)
end
return true
end
end
return false
end
local function handleItemDeletionKey(room, key, scancode, isrepeat)
if not selectionPreviews then
return
end
local targetKey = configs.editor.itemDelete
if targetKey == key then
local snapshot, redraw = deleteItems(room, tool.layer, selectionPreviews)
if redraw then
history.addSnapshot(snapshot)
toolUtils.redrawTargetLayer(room, tool.layer)
end
return true
end
return false
end
local function copyCommon(cut)
local room = state.getSelectedRoom()
local useClipboard = configs.editor.copyUsesClipboard
if not room or #selectionPreviews == 0 then
return false
end
copyPreviews = utils.deepcopy(selectionPreviews)
if cut then
local snapshot, redraw = deleteItems(room, tool.layer, selectionPreviews)
if redraw then
history.addSnapshot(snapshot)
toolUtils.redrawTargetLayer(room, tool.layer)
end
end
if useClipboard then
local success, text = utils.serialize(copyPreviews)
if success then
love.system.setClipboardText(text)
end
end
return true
end
-- Attempt to prevent arbitrary code execution
local function validateClipboard(text)
if not text or text:sub(1, 1) ~= "{" or text:sub(-1, -1) ~= "}" then
return false
end
return true
end
local function copyItemsHotkey()
copyCommon(false)
end
local function cutItemsHotkey()
copyCommon(true)
end
local function pasteItemsHotkey()
local useClipboard = configs.editor.copyUsesClipboard
local newPreviews = utils.deepcopy(copyPreviews)
if useClipboard then
local clipboard = love.system.getClipboardText()
if validateClipboard(clipboard) then
local success, fromClipboard = utils.unserialize(clipboard)
if success then
newPreviews = fromClipboard
end
end
end
if newPreviews and #newPreviews > 0 then
local room = state.getSelectedRoom()
local snapshot, usedLayers = pasteItems(room, tool.layer, newPreviews)
history.addSnapshot(snapshot)
toolUtils.redrawTargetLayer(room, tool.layer)
for _, layer in ipairs(usedLayers) do
toolUtils.redrawTargetLayer(room, layer)
end
end
end
local toolHotkeys = {
hotkeyStruct.createHotkey(configs.hotkeys.itemsCopy, copyItemsHotkey),
hotkeyStruct.createHotkey(configs.hotkeys.itemsPaste, pasteItemsHotkey),
hotkeyStruct.createHotkey(configs.hotkeys.itemsCut, cutItemsHotkey)
}
function tool.mousepressed(x, y, button, istouch, presses)
local actionButton = configs.editor.toolActionButton
if button == actionButton then
local cursorX, cursorY = toolUtils.getCursorPositionInRoom(x, y)
if cursorX and cursorY then
selectionStarted(cursorX, cursorY)
end
end
end
function tool.mousemoved(x, y, dx, dy, istouch)
local actionButton = configs.editor.toolActionButton
if not selectionCompleted and love.mouse.isDown(actionButton) then
local cursorX, cursorY = toolUtils.getCursorPositionInRoom(x, y)
if cursorX and cursorY and selectionStartX and selectionStartY then
local width, height = cursorX - selectionStartX, cursorY - selectionStartY
selectionChanged(selectionStartX, selectionStartY, width, height)
end
end
end
function tool.mousereleased(x, y, button, istouch, presses)
local actionButton = configs.editor.toolActionButton
if button == actionButton then
selectionFinished()
end
end
-- Special case
function tool.mouseclicked(x, y, button, istouch, presses)
local actionButton = configs.editor.toolActionButton
if button == actionButton then
local cursorX, cursorY = toolUtils.getCursorPositionInRoom(x, y)
if cursorX and cursorY then
selectionChanged(cursorX - 1, cursorY - 1, 3, 3)
selectionFinished()
end
end
end
function tool.keypressed(key, scancode, isrepeat)
local room = state.getSelectedRoom()
if not isrepeat then
hotkeyStruct.callbackFirstActive(toolHotkeys)
end
handleItemMovementKeys(room, key, scancode, isrepeat)
handleItemDeletionKey(room, key, scancode, isrepeat)
end
function tool.draw()
local room = state.getSelectedRoom()
if room then
drawSelectionArea(room)
drawSelectionPreviews(room)
end
end
return tool
|
--
-- Created by IntelliJ IDEA.
-- User: nander
-- Date: 10/02/2018
-- Time: 14:54
-- To change this template use File | Settings | File Templates.
--
local turretFunc = function(entity)
local player = GETPLAYER()
local o = (entity.orientation - 1) % 4 + 1
local orr = { x = 0, y = 0 }
if o == 1 then
orr.x = 1
elseif o == 2 then
orr.y = 1
elseif o == 3 then
orr.x = -1
elseif o == 4 then
orr.y = -1
end
if not entity.laserOn then
return
end
for i = 1, 10 do
local loc = { x = entity.position.x + orr.x * i, y = entity.position.y + orr.y * i }
if not scripts.systems.collision.mapCollision(loc) then
return
end
if player.position.x == loc.x and player.position.y == loc.y then
print("YOU HAVE DIED")
scripts.actions.startActions.death(player)
end
end
end
local checkTrapDoors = function(entity)
local p = GETPLAYER()
if entity.position.x == p.position.x and entity.position.y == p.position.y and not entity.open then
scripts.actions.startActions.death(p)
end
end
return function()
core.run("turret", turretFunc, {})
core.run("trapdoor", checkTrapDoors, {})
end
|
local o = require"luci.dispatcher"
local e = require("luci.model.ipkg")
local s = require"nixio.fs"
local e = luci.model.uci.cursor()
local i = "frp"
local a,t,e
local n = {}
a = Map("frp")
a.title = translate("Frp Setting")
a:section(SimpleSection).template="frp/frp_status"
t = a:section(NamedSection, "common","frp")
t.anonymous = true
t.addremove = false
t:tab("base", translate("Basic Settings"))
t:tab("other", translate("Other Settings"))
t:tab("log", translate("Client Log"))
e = t:taboption("base", Flag, "enabled", translate("Enabled"))
e.rmempty = false
e = t:taboption("base", Value, "server_addr", translate("Server"))
e.optional = false
e.rmempty = false
e = t:taboption("base", Value, "server_port", translate("Port"))
e.datatype = "port"
e.optional = false
e.rmempty = false
e = t:taboption("base", Value, "token", translate("Token"))
e.optional = false
e.password = true
e.rmempty = false
e = t:taboption("base", Value, "user", translate("User"))
e.optional = true
e.default = ""
e.rmempty = false
e = t:taboption("base", Value, "vhost_http_port", translate("Vhost HTTP Port"))
e.datatype = "port"
e.rmempty = false
e = t:taboption("base", Value, "vhost_https_port", translate("Vhost HTTPS Port"))
e.datatype = "port"
e.rmempty = false
e = t:taboption("base", Value, "time", translate("Service registration interval"))
e.datatype = "range(0,59)"
e.default = 30
e.rmempty = false
e = t:taboption("other", Flag, "login_fail_exit", translate("Exit program when first login failed"))
e.default = "1"
e.rmempty = false
e = t:taboption("other", Flag, "tcp_mux", translate("TCP Stream Multiplexing"))
e.default = "1"
e.rmempty = false
e = t:taboption("other", Flag, "tls_enable", translate("Use TLS Connection"))
e.default = "0"
e.rmempty = false
e = t:taboption("other", ListValue, "protocol", translate("Protocol Type"))
e.default = "tcp"
e:value("tcp", translate("TCP Protocol"))
e:value("kcp", translate("KCP Protocol"))
e = t:taboption("other", Flag, "enable_http_proxy", translate("Connect frps by HTTP PROXY"))
e.default = "0"
e.rmempty = false
e:depends("protocol","tcp")
e = t:taboption("other", Value, "http_proxy", translate("HTTP PROXY"))
e.placeholder = "http://user:pwd@192.168.1.128:8080"
e:depends("enable_http_proxy",1)
e.optional = false
e = t:taboption("other", Flag, "enable_cpool", translate("Enable Connection Pool"))
e.rmempty = false
e = t:taboption("other", Value, "pool_count", translate("Connection Pool"))
e.datatype = "uinteger"
e.default = "1"
e:depends("enable_cpool",1)
e.optional=false
e = t:taboption("other", ListValue, "log_level", translate("Log Level"))
e.default = "warn"
e:value("trace", translate("Trace"))
e:value("debug", translate("Debug"))
e:value("info", translate("Info"))
e:value("warn", translate("Warning"))
e:value("error", translate("Error"))
e = t:taboption("other", Value, "log_max_days", translate("Log Keepd Max Days"))
e.datatype = "uinteger"
e.default = "1"
e.rmempty = false
e.optional = false
e = t:taboption("other", Flag, "admin_enable", translate("Enable Web API"))
e.default = "0"
e.rmempty=false
e = t:taboption("other", Value, "admin_port", translate("Admin Web Port"))
e.datatype = "port"
e.default = 7400
e:depends("admin_enable",1)
e = t:taboption("other", Value, "admin_user", translate("Admin Web UserName"))
e.optional = false
e.default = "dingyi"
e:depends("admin_enable",1)
e = t:taboption("other", Value, "admin_pwd", translate("Admin Web PassWord"))
e.optional = false
e.default = "21212121"
e.password = true
e:depends("admin_enable",1)
e = t:taboption("log", TextValue,"log")
e.rows = 26
e.wrap = "off"
e.readonly = true
e.cfgvalue = function(t,t)
return s.readfile("/var/etc/frp/frpc.log")or""
end
e.write = function(e,e,e)
end
t = a:section(TypedSection, "proxy", translate("Services List"))
t.anonymous = true
t.addremove = true
t.template = "cbi/tblsection"
t.extedit = o.build_url("admin","services","frp","config","%s")
function t.create(e,t)
new = TypedSection.create(e,t)
luci.http.redirect(e.extedit:format(new))
end
function t.remove(e,t)
e.map.proceed = true
e.map:del(t)
luci.http.redirect(o.build_url("admin","services","frp"))
end
local o = ""
e = t:option(DummyValue, "remark", translate("Service Remark Name"))
e.width="10%"
e = t:option(DummyValue, "type", translate("Frp Protocol Type"))
e.width="10%"
e = t:option(DummyValue, "custom_domains", translate("Domain/Subdomain"))
e.width="15%"
e.cfgvalue = function(t,n)
local t = a.uci:get(i,n,"domain_type")or""
local m = a.uci:get(i,n,"type")or""
if t=="custom_domains" then
local b = a.uci:get(i,n,"custom_domains")or"" return b end
if t=="subdomain" then
local b = a.uci:get(i,n,"subdomain")or"" return b end
if t=="both_dtype" then
local b = a.uci:get(i,n,"custom_domains")or""
local c = a.uci:get(i,n,"subdomain")or""
b="%s/%s"%{b,c} return b end
if m=="tcp" or m=="udp" then
local b=a.uci:get(i,"common","server_addr")or"" return b end
end
e = t:option(DummyValue,"remote_port",translate("Remote Port"))
e.width = "10%"
e.cfgvalue = function(t,b)
local t = a.uci:get(i,b,"type")or""
if t==""or b==""then return""end
if t=="http" then
local b = a.uci:get(i,"common","vhost_http_port")or"" return b end
if t=="https" then
local b = a.uci:get(i,"common","vhost_https_port")or"" return b end
if t=="tcp" or t=="udp" then
local b = a.uci:get(i,b,"remote_port")or"" return b end
end
e = t:option(DummyValue, "local_ip", translate("Local Host Address"))
e.width = "15%"
e = t:option(DummyValue, "local_port", translate("Local Host Port"))
e.width = "10%"
e = t:option(DummyValue, "use_encryption", translate("Use Encryption"))
e.width = "10%"
e.cfgvalue = function(t,n)
local t=a.uci:get(i,n,"use_encryption")or""
local b
if t==""or b==""then return""end
if t=="1" then b="ON"
else b="OFF" end
return b
end
e = t:option(DummyValue, "use_compression", translate("Use Compression"))
e.width = "10%"
e.cfgvalue = function(t,n)
local t = a.uci:get(i,n,"use_compression")or""
local b
if t==""or b==""then return""end
if t=="1" then b="ON"
else b="OFF" end
return b
end
e = t:option(Flag, "enable", translate("Enable State"))
e.width = "15%"
e.rmempty = false
return a
|
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Enabled = false
-- Gui to Lua
-- Version: 3.2
-- Instances:
local Altered = Instance.new("ScreenGui")
local MainM = Instance.new("ImageLabel")
local CSelection = Instance.new("TextButton")
local CUSSSelection = Instance.new("TextButton")
local Quit = Instance.new("TextButton")
local CustomSelection = Instance.new("ImageLabel")
local GTCR = Instance.new("TextButton")
local DTP1 = Instance.new("TextButton")
local DTP2 = Instance.new("TextButton")
local TitleCUS = Instance.new("TextButton")
local CharacterSelection = Instance.new("ImageLabel")
local GlitchtaleChara = Instance.new("TextButton")
local Asriel = Instance.new("TextButton")
local DeltaSans = Instance.new("TextButton")
local TitleCS = Instance.new("TextButton")
local UTFrisk = Instance.new("TextButton")
local GTFrisk = Instance.new("TextButton")
local UTSans = Instance.new("TextButton")
local XTale = Instance.new("TextButton")
local GTUndyne = Instance.new("TextButton")
local SSChara = Instance.new("TextButton")
local GTAsgore = Instance.new("TextButton")
local Betty = Instance.new("TextButton")
local Warning1 = Instance.new("ImageLabel")
local TextButton = Instance.new("TextButton")
local TextButton_2 = Instance.new("TextButton")
local TextButton_3 = Instance.new("TextButton")
local Title = Instance.new("ImageLabel")
local TextButton_4 = Instance.new("TextButton")
--Properties:
Altered.Name = "Altered"
Altered.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
MainM.Name = "MainM"
MainM.Parent = Altered
MainM.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
MainM.BackgroundTransparency = 1.000
MainM.BorderSizePixel = 0
MainM.Position = UDim2.new(0.832099438, 0, 0.0975543112, 0)
MainM.Size = UDim2.new(0, 276, 0, 879)
MainM.Image = "rbxassetid://3570695787"
MainM.ImageColor3 = Color3.fromRGB(0, 0, 0)
MainM.ScaleType = Enum.ScaleType.Slice
MainM.SliceCenter = Rect.new(100, 100, 100, 100)
MainM.SliceScale = 0.120
CSelection.Name = "CSelection"
CSelection.Parent = MainM
CSelection.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CSelection.BackgroundTransparency = 1.000
CSelection.BorderSizePixel = 0
CSelection.Position = UDim2.new(0.0471014529, 0, 0.257110327, 0)
CSelection.Size = UDim2.new(0, 250, 0, 20)
CSelection.Font = Enum.Font.Arcade
CSelection.Text = "Character Selection"
CSelection.TextColor3 = Color3.fromRGB(255, 255, 255)
CSelection.TextSize = 23.000
CSelection.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
CSelection.TextStrokeTransparency = 0.000
CUSSSelection.Name = "CUSSSelection"
CUSSSelection.Parent = MainM
CUSSSelection.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CUSSSelection.BackgroundTransparency = 1.000
CUSSSelection.BorderSizePixel = 0
CUSSSelection.Position = UDim2.new(0.119565219, 0, 0.369738311, 0)
CUSSSelection.Size = UDim2.new(0, 210, 0, 47)
CUSSSelection.Font = Enum.Font.Arcade
CUSSSelection.Text = "Custom Selection"
CUSSSelection.TextColor3 = Color3.fromRGB(255, 255, 255)
CUSSSelection.TextSize = 23.000
CUSSSelection.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
CUSSSelection.TextStrokeTransparency = 0.000
Quit.Name = "Quit"
Quit.Parent = MainM
Quit.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Quit.BackgroundTransparency = 1.000
Quit.BorderSizePixel = 0
Quit.Position = UDim2.new(0.119565219, 0, 0.855517626, 0)
Quit.Size = UDim2.new(0, 210, 0, 47)
Quit.Font = Enum.Font.Arcade
Quit.Text = "Exit Game"
Quit.TextColor3 = Color3.fromRGB(255, 255, 255)
Quit.TextSize = 23.000
Quit.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
Quit.TextStrokeTransparency = 0.000
CustomSelection.Name = "CustomSelection"
CustomSelection.Parent = Altered
CustomSelection.BackgroundColor3 = Color3.fromRGB(29, 29, 29)
CustomSelection.BackgroundTransparency = 1.000
CustomSelection.Position = UDim2.new(-0.5, 0, -0.0520000011, 0)
CustomSelection.Size = UDim2.new(0, 644, 0, 697)
CustomSelection.Image = "rbxassetid://3570695787"
CustomSelection.ImageColor3 = Color3.fromRGB(47, 47, 47)
CustomSelection.ScaleType = Enum.ScaleType.Slice
CustomSelection.SliceCenter = Rect.new(100, 100, 100, 100)
CustomSelection.SliceScale = 0.120
GTCR.Name = "GTCR"
GTCR.Parent = CustomSelection
GTCR.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GTCR.BackgroundTransparency = 1.000
GTCR.BorderSizePixel = 0
GTCR.Position = UDim2.new(0.118012421, 0, 0.197991386, 0)
GTCR.Size = UDim2.new(0, 200, 0, 50)
GTCR.Font = Enum.Font.Arcade
GTCR.Text = "GTCR"
GTCR.TextColor3 = Color3.fromRGB(0, 0, 0)
GTCR.TextSize = 30.000
DTP1.Name = "DTP1"
DTP1.Parent = CustomSelection
DTP1.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
DTP1.BackgroundTransparency = 1.000
DTP1.BorderSizePixel = 0
DTP1.Position = UDim2.new(0.551242232, 0, 0.197991386, 0)
DTP1.Size = UDim2.new(0, 200, 0, 50)
DTP1.Font = Enum.Font.Arcade
DTP1.Text = "Dusttrust Phase 1"
DTP1.TextColor3 = Color3.fromRGB(0, 0, 0)
DTP1.TextSize = 30.000
DTP2.Name = "DTP2"
DTP2.Parent = CustomSelection
DTP2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
DTP2.BackgroundTransparency = 1.000
DTP2.BorderSizePixel = 0
DTP2.Position = UDim2.new(0.29192549, 0, 0.351506472, 0)
DTP2.Size = UDim2.new(0, 200, 0, 50)
DTP2.Font = Enum.Font.Arcade
DTP2.Text = "Dusttrust Phase 2 (Demo)"
DTP2.TextColor3 = Color3.fromRGB(0, 0, 0)
DTP2.TextSize = 30.000
TitleCUS.Name = "TitleCUS"
TitleCUS.Parent = CustomSelection
TitleCUS.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TitleCUS.BackgroundTransparency = 1.000
TitleCUS.BorderSizePixel = 0
TitleCUS.Position = UDim2.new(0.29192546, 0, 0.0430416018, 0)
TitleCUS.Size = UDim2.new(0, 200, 0, 50)
TitleCUS.Font = Enum.Font.Arcade
TitleCUS.Text = "Custom Selection"
TitleCUS.TextColor3 = Color3.fromRGB(0, 0, 0)
TitleCUS.TextSize = 30.000
TitleCUS.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
TitleCUS.TextStrokeTransparency = 0.000
CharacterSelection.Name = "CharacterSelection"
CharacterSelection.Parent = Altered
CharacterSelection.BackgroundColor3 = Color3.fromRGB(29, 29, 29)
CharacterSelection.BackgroundTransparency = 1.000
CharacterSelection.Position = UDim2.new(-0.5, 0, -0.0520000011, 0)
CharacterSelection.Size = UDim2.new(0, 644, 0, 805)
CharacterSelection.Image = "rbxassetid://3570695787"
CharacterSelection.ImageColor3 = Color3.fromRGB(47, 47, 47)
CharacterSelection.ScaleType = Enum.ScaleType.Slice
CharacterSelection.SliceCenter = Rect.new(100, 100, 100, 100)
CharacterSelection.SliceScale = 0.120
GlitchtaleChara.Name = "GlitchtaleChara"
GlitchtaleChara.Parent = CharacterSelection
GlitchtaleChara.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GlitchtaleChara.BackgroundTransparency = 1.000
GlitchtaleChara.BorderSizePixel = 0
GlitchtaleChara.Position = UDim2.new(0.118012421, 0, 0.197991386, 0)
GlitchtaleChara.Size = UDim2.new(0, 200, 0, 50)
GlitchtaleChara.Font = Enum.Font.Arcade
GlitchtaleChara.Text = "Glitchtale Chara"
GlitchtaleChara.TextColor3 = Color3.fromRGB(0, 0, 0)
GlitchtaleChara.TextSize = 30.000
Asriel.Name = "Asriel"
Asriel.Parent = CharacterSelection
Asriel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Asriel.BackgroundTransparency = 1.000
Asriel.BorderSizePixel = 0
Asriel.Position = UDim2.new(0.571428597, 0, 0.197991386, 0)
Asriel.Size = UDim2.new(0, 200, 0, 50)
Asriel.Font = Enum.Font.Arcade
Asriel.Text = "Asriel"
Asriel.TextColor3 = Color3.fromRGB(0, 0, 0)
Asriel.TextSize = 30.000
DeltaSans.Name = "DeltaSans"
DeltaSans.Parent = CharacterSelection
DeltaSans.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
DeltaSans.BackgroundTransparency = 1.000
DeltaSans.BorderSizePixel = 0
DeltaSans.Position = UDim2.new(0.29192549, 0, 0.351506472, 0)
DeltaSans.Size = UDim2.new(0, 200, 0, 50)
DeltaSans.Font = Enum.Font.Arcade
DeltaSans.Text = "Delta!Sans"
DeltaSans.TextColor3 = Color3.fromRGB(0, 0, 0)
DeltaSans.TextSize = 30.000
TitleCS.Name = "TitleCS"
TitleCS.Parent = CharacterSelection
TitleCS.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TitleCS.BackgroundTransparency = 1.000
TitleCS.BorderSizePixel = 0
TitleCS.Position = UDim2.new(0.29192546, 0, 0.0430416018, 0)
TitleCS.Size = UDim2.new(0, 200, 0, 50)
TitleCS.Font = Enum.Font.Arcade
TitleCS.Text = "Character Selection"
TitleCS.TextColor3 = Color3.fromRGB(0, 0, 0)
TitleCS.TextSize = 30.000
UTFrisk.Name = "UTFrisk"
UTFrisk.Parent = CharacterSelection
UTFrisk.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
UTFrisk.BackgroundTransparency = 1.000
UTFrisk.BorderSizePixel = 0
UTFrisk.Position = UDim2.new(0.0885093138, 0, 0.463414609, 0)
UTFrisk.Size = UDim2.new(0, 200, 0, 50)
UTFrisk.Font = Enum.Font.Arcade
UTFrisk.Text = "UT!Frisk"
UTFrisk.TextColor3 = Color3.fromRGB(0, 0, 0)
UTFrisk.TextSize = 30.000
GTFrisk.Name = "GTFrisk"
GTFrisk.Parent = CharacterSelection
GTFrisk.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GTFrisk.BackgroundTransparency = 1.000
GTFrisk.BorderSizePixel = 0
GTFrisk.Position = UDim2.new(0.586956501, 0, 0.467985481, 0)
GTFrisk.Size = UDim2.new(0, 200, 0, 50)
GTFrisk.Font = Enum.Font.Arcade
GTFrisk.Text = "GT!Frisk"
GTFrisk.TextColor3 = Color3.fromRGB(0, 0, 0)
GTFrisk.TextSize = 30.000
UTSans.Name = "UTSans"
UTSans.Parent = CharacterSelection
UTSans.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
UTSans.BackgroundTransparency = 1.000
UTSans.BorderSizePixel = 0
UTSans.Position = UDim2.new(0.29192543, 0, 0.628407478, 0)
UTSans.Size = UDim2.new(0, 200, 0, 50)
UTSans.Font = Enum.Font.Arcade
UTSans.Text = "Undertale!Sans"
UTSans.TextColor3 = Color3.fromRGB(0, 0, 0)
UTSans.TextSize = 30.000
XTale.Name = "XTale"
XTale.Parent = CharacterSelection
XTale.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
XTale.BackgroundTransparency = 1.000
XTale.BorderSizePixel = 0
XTale.Position = UDim2.new(0.0885092765, 0, 0.754662871, 0)
XTale.Size = UDim2.new(0, 200, 0, 50)
XTale.Font = Enum.Font.Arcade
XTale.Text = "XTale Sans/Chara"
XTale.TextColor3 = Color3.fromRGB(0, 0, 0)
XTale.TextSize = 30.000
GTUndyne.Name = "GTUndyne"
GTUndyne.Parent = CharacterSelection
GTUndyne.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GTUndyne.BackgroundTransparency = 1.000
GTUndyne.BorderSizePixel = 0
GTUndyne.Position = UDim2.new(0.602484405, 0, 0.754662871, 0)
GTUndyne.Size = UDim2.new(0, 200, 0, 50)
GTUndyne.Font = Enum.Font.Arcade
GTUndyne.Text = "GT!Undyne"
GTUndyne.TextColor3 = Color3.fromRGB(0, 0, 0)
GTUndyne.TextSize = 30.000
SSChara.Name = "SSChara"
SSChara.Parent = CharacterSelection
SSChara.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
SSChara.BackgroundTransparency = 1.000
SSChara.BorderSizePixel = 0
SSChara.Position = UDim2.new(0.29192543, 0, 0.863701582, 0)
SSChara.Size = UDim2.new(0, 200, 0, 50)
SSChara.Font = Enum.Font.Arcade
SSChara.Text = "Storyshift Chara"
SSChara.TextColor3 = Color3.fromRGB(0, 0, 0)
SSChara.TextSize = 30.000
GTAsgore.Name = "GTAsgore"
GTAsgore.Parent = CharacterSelection
GTAsgore.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GTAsgore.BackgroundTransparency = 1.000
GTAsgore.BorderSizePixel = 0
GTAsgore.Position = UDim2.new(0.670807481, 0, 0.924699426, 0)
GTAsgore.Size = UDim2.new(0, 200, 0, 50)
GTAsgore.Font = Enum.Font.Arcade
GTAsgore.Text = "GT!Asgore"
GTAsgore.TextColor3 = Color3.fromRGB(0, 0, 0)
GTAsgore.TextSize = 30.000
Betty.Name = "Betty"
Betty.Parent = CharacterSelection
Betty.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Betty.BackgroundTransparency = 1.000
Betty.BorderSizePixel = 0
Betty.Position = UDim2.new(0.578999996, 0, 0.300000012, 0)
Betty.Size = UDim2.new(0, 200, 0, 50)
Betty.Font = Enum.Font.Arcade
Betty.Text = "Betty"
Betty.TextColor3 = Color3.fromRGB(0, 0, 0)
Betty.TextSize = 30.000
Warning1.Name = "Warning1"
Warning1.Parent = Altered
Warning1.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Warning1.BackgroundTransparency = 1.000
Warning1.Position = UDim2.new(-0.5, 0, -0.0520000011, 0)
Warning1.Size = UDim2.new(0, 376, 0, 107)
Warning1.Image = "rbxassetid://3570695787"
Warning1.ImageColor3 = Color3.fromRGB(74, 74, 74)
Warning1.ScaleType = Enum.ScaleType.Slice
Warning1.SliceCenter = Rect.new(100, 100, 100, 100)
Warning1.SliceScale = 0.120
TextButton.Parent = Warning1
TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextButton.BackgroundTransparency = 1.000
TextButton.BorderSizePixel = 0
TextButton.Position = UDim2.new(0.0611702129, 0, 0, 0)
TextButton.Size = UDim2.new(0, 330, 0, 50)
TextButton.Font = Enum.Font.Arcade
TextButton.Text = "Are you sure you want to quit?"
TextButton.TextColor3 = Color3.fromRGB(0, 0, 0)
TextButton.TextSize = 20.000
TextButton.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
TextButton.TextStrokeTransparency = 0.000
TextButton_2.Parent = Warning1
TextButton_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextButton_2.BackgroundTransparency = 1.000
TextButton_2.BorderSizePixel = 0
TextButton_2.Position = UDim2.new(0.0611702129, 0, 0.467289716, 0)
TextButton_2.Size = UDim2.new(0, 213, 0, 50)
TextButton_2.Font = Enum.Font.Arcade
TextButton_2.Text = "Yes"
TextButton_2.TextColor3 = Color3.fromRGB(26, 255, 1)
TextButton_2.TextSize = 40.000
TextButton_2.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
TextButton_2.TextStrokeTransparency = 0.000
TextButton_3.Parent = Warning1
TextButton_3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextButton_3.BackgroundTransparency = 1.000
TextButton_3.BorderSizePixel = 0
TextButton_3.Position = UDim2.new(0.486702144, 0, 0.467289716, 0)
TextButton_3.Size = UDim2.new(0, 213, 0, 50)
TextButton_3.Font = Enum.Font.Arcade
TextButton_3.Text = "No"
TextButton_3.TextColor3 = Color3.fromRGB(255, 0, 0)
TextButton_3.TextSize = 40.000
TextButton_3.TextStrokeColor3 = Color3.fromRGB(43, 33, 136)
TextButton_3.TextStrokeTransparency = 0.000
Title.Name = "Title"
Title.Parent = Altered
Title.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Title.BorderColor3 = Color3.fromRGB(255, 255, 255)
Title.BorderSizePixel = 10
Title.Position = UDim2.new(0.140246481, 0, 0.905544162, 0)
Title.Size = UDim2.new(0, 1138, 0, 81)
Title.Image = "rbxassetid://3570695787"
Title.ImageColor3 = Color3.fromRGB(0, 0, 0)
Title.ScaleType = Enum.ScaleType.Slice
Title.SliceCenter = Rect.new(100, 100, 100, 100)
Title.SliceScale = 0.120
TextButton_4.Parent = Title
TextButton_4.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextButton_4.BackgroundTransparency = 1.000
TextButton_4.BorderColor3 = Color3.fromRGB(255, 255, 255)
TextButton_4.Position = UDim2.new(0.00527240802, 0, -0.0529629588, 0)
TextButton_4.Size = UDim2.new(0, 1132, 0, 96)
TextButton_4.Font = Enum.Font.Arcade
TextButton_4.Text = "Soulshatters (but its not)"
TextButton_4.TextColor3 = Color3.fromRGB(255, 0, 0)
TextButton_4.TextSize = 50.000
TextButton_4.TextStrokeColor3 = Color3.fromRGB(45, 0, 0)
TextButton_4.TextStrokeTransparency = 0.000
-- Scripts:
local function SDCFBBB_fake_script() -- GTCR.LocalScript
local script = Instance.new('LocalScript', GTCR)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.GTCR
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://2595535704"
Sound.Name = "GTCR"
local btn = script.Parent
btn.MouseEnter:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.GTCR.GTCR.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.GTCR.GTCR.Playing = false
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.GTCR.GTCR.TimePosition = 0
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.Selected.Playing = true
end)
end
coroutine.wrap(SDCFBBB_fake_script)()
local function GANW_fake_script() -- DTP1.LocalScript
local script = Instance.new('LocalScript', DTP1)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://437475935"
Sound.Name = "DTP1Summon"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://437475935"
Sound.Name = "DTP1Summon2"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://6477653909"
Sound.Name = "DTP1"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("*block*")
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1.DTP1.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("*still block*")
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1.DTP1.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1.DTP1.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1.DTP1Summon.Playing = true
wait(0.1)
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1.DTP2Summon.Playing = true
print("It was Knife to meet ya ")
end)
end
coroutine.wrap(GANW_fake_script)()
local function WDEYM_fake_script() -- DTP2.LocalScript
local script = Instance.new('LocalScript', DTP2)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://437475935"
Sound.Name = "DTP2Summon"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://437475935"
Sound.Name = "DTP2Summon2"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://6477770041"
Sound.Name = "DTP2"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("*block*")
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2.DTP2.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("*still block*")
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2.DTP2.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2.DTP2.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2.DTP2Summon.Playing = true
wait(0.1)
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2.DTP2Summon2.Playing = true
print("It was Knife to meet ya ")
end)
end
coroutine.wrap(WDEYM_fake_script)()
local function SQWCMCK_fake_script() -- TitleCUS.LocalScript
local script = Instance.new('LocalScript', TitleCUS)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.TitleCUS
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://4700149603"
Sound.Name = "Seeeecreeet"
local btn = script.Parent
btn.MouseEnter:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.TitleCUS.Seeeecreeet.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
print("amy was here <3")
end)
btn.MouseLeave:Connect(function()
print("thanks fatal for letting me do the lil updates with sound and buttons")
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.TitleCUS.Seeeecreeet.Playing = false
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.TitleCUS.Seeeecreeet.TimePosition = 0
end)
end
coroutine.wrap(SQWCMCK_fake_script)()
local function OODWOC_fake_script() -- GlitchtaleChara.LocalScript
local script = Instance.new('LocalScript', GlitchtaleChara)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://7167345586"
Sound.Name = "GlitchtaleChara"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("This is all about that 5$ i didnt give you back?")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara.GlitchtaleChara.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Huh i guess not.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara.GlitchtaleChara.Playing = false
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara.GlitchtaleChara.TimePosition = 0
end)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://437475935"
Sound.Name = "GTChara"
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara.GTChara.Playing = true
end)
end
coroutine.wrap(OODWOC_fake_script)()
local function IXPCYUM_fake_script() -- Asriel.LocalScript
local script = Instance.new('LocalScript', Asriel)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://2836888600"
Sound.Name = "Summon"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://337231840"
Sound.Name = "Asriel"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("This is gonna get Asriel as it gets.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel.Asriel.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Didn't like my pun?")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel.Asriel.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel.Asriel.TimePosition = 2
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel.Summon.Playing = true
print("I know my puns are great.")
end)
end
coroutine.wrap(IXPCYUM_fake_script)()
local function ACHLN_fake_script() -- DeltaSans.LocalScript
local script = Instance.new('LocalScript', DeltaSans)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://6027340180"
Sound.Name = "DeltaSans"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("Time for an inf combo huh?")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans.DeltaSans.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Oh, you have honor?")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans.DeltaSans.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans.DeltaSans.TimePosition = 1
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://382366855"
Sound.Name = "Summon"
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans.Summon.Playing = true
print("I know my puns are great.")
end)
end
coroutine.wrap(ACHLN_fake_script)()
local function OLSDWEC_fake_script() -- TitleCS.LocalScript
local script = Instance.new('LocalScript', TitleCS)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.TitleCS
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://2578754972"
Sound.Name = "DontForget"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("Secret.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.TitleCS.DontForget.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
print("amy was here <3")
end)
btn.MouseLeave:Connect(function()
print("this was fun-----Amy")
print("Don't Forget.")
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.TitleCS.DontForget.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.TitleCS.DontForget.TimePosition = 0
end)
end
coroutine.wrap(OLSDWEC_fake_script)()
local function WZWJNOG_fake_script() -- UTFrisk.LocalScript
local script = Instance.new('LocalScript', UTFrisk)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://6796468660"
Sound.Name = "UTFrisk"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("Genocide.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk.UTFrisk.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Mercy.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk.UTFrisk.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk.UTFrisk.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://1005386374"
Sound.Name = "Frisko"
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk.Frisko.Playing = true
end)
end
coroutine.wrap(WZWJNOG_fake_script)()
local function OGCHQRC_fake_script() -- GTFrisk.LocalScript
local script = Instance.new('LocalScript', GTFrisk)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTFrisk
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://5922804560"
Sound.Name = "GTFrisk"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("It doesn't matter...")
print("You won't remember any of it...")
print("Nobody will...")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTFrisk.GTFrisk.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("FrIsk Wait!")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTFrisk.GTFrisk.Playing = false
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTFrisk.GTFrisk.TimePosition = 0
end)
end
coroutine.wrap(OGCHQRC_fake_script)()
local function OUDLQ_fake_script() -- UTSans.LocalScript
local script = Instance.new('LocalScript', UTSans)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://6036718971"
Sound.Name = "UTSans"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("Dodge and run.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans.UTSans.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Or just run.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans.UTSans.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans.UTSans.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://340722848"
Sound.Name = "SansSummon"
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans.SansSummon.Playing = true
print("You choose me for the puns.")
end)
end
coroutine.wrap(OUDLQ_fake_script)()
local function CBHJZXN_fake_script() -- XTale.LocalScript
local script = Instance.new('LocalScript', XTale)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://7281550772"
Sound.Name = "XTaleSummon"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://3152767644"
Sound.Name = "XTale"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("Take their soul and make it yours.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale.XTale.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Other Way around then.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale.XTale.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale.XTale.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale.XTaleSummon.Playing = true
print("I know my puns are great.")
end)
end
coroutine.wrap(CBHJZXN_fake_script)()
local function PROLLG_fake_script() -- GTUndyne.LocalScript
local script = Instance.new('LocalScript', GTUndyne)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://3143843068"
Sound.Name = "GTUndyne"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://5624230354"
Sound.Name = "GTUndyneLaugh"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("I will never let you pass. Even if my tears run dry")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne.GTUndyne.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("What you think youre stronger?")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne.GTUndyne.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne.GTUndyne.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne.GTUndyneLaugh.Playing = true
print("no.. I don't think so. I know so.")
end)
end
coroutine.wrap(PROLLG_fake_script)()
local function LPUMPQ_fake_script() -- SSChara.LocalScript
local script = Instance.new('LocalScript', SSChara)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://400396923"
Sound.Name = "SSChara"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("You killed them YOU KILLED THEM ALL!!!")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara.SSChara.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("COME BACK HERE!")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara.SSChara.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara.SSChara.TimePosition = 0
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
end)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://539294959"
Sound.Name = "SSSChara"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara
Sound.Volume = 4
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://437475935"
Sound.Name = "SSSSChara"
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara.SSSChara.Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara.SSSSChara.Playing = true
end)
end
coroutine.wrap(LPUMPQ_fake_script)()
local function LGWQCFW_fake_script() -- GTAsgore.LocalScript
local script = Instance.new('LocalScript', GTAsgore)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://4642021912"
Sound.Name = "GTAsgore"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://4065225041 "
Sound.Name = "GTAsgore1"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("He killed them she said.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore.GTAsgore.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("She imprisoned them.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore.GTAsgore.Playing = false
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore.GTAsgore.TimePosition = 4
end)
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore.GTAsgore1.Playing = true
print("bro if you dont get the refrence ur poop")
end)
end
coroutine.wrap(LGWQCFW_fake_script)()
local function GABMX_fake_script() -- Betty.LocalScript
local script = Instance.new('LocalScript', Betty)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://155334395"
Sound.Name = "Betty"
local btn = script.Parent
btn.MouseEnter:Connect(function()
print("They will never survive.")
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty.Betty.Playing = true
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = false
end)
btn.MouseLeave:Connect(function()
print("Or will they?")
game.Players.LocalPlayer.MenuPlaylist["1Menu"].Playing = true
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty.Betty.Playing = false
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty.Betty.TimePosition = 2
end)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty
Sound.Volume = 1.5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://4538419034"
Sound.Name = "Summon"
btn.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty.Summon.Playing = true
end)
end
coroutine.wrap(GABMX_fake_script)()
local function SBBCZ_fake_script() -- Altered.Script
local script = Instance.new('LocalScript', Altered)
script.Parent:WaitForChild("MainM").CSelection.MouseEnter:Connect(function()
script.Parent.Hover.Playing = true
script.Parent.Hover.TimePosition = 0
script.Parent.MainM.CSelection.TextColor3 = Color3.new(1,1,0)
end)
script.Parent:WaitForChild("MainM").CSelection.MouseLeave:Connect(function()
script.Parent.MainM.CSelection.TextColor3 = Color3.new(1,1,1)
end)
script.Parent:WaitForChild("MainM").CUSSSelection.MouseEnter:Connect(function()
script.Parent.Hover.Playing = true
script.Parent.Hover.TimePosition = 0
script.Parent.MainM.CUSSSelection.TextColor3 = Color3.new(1,1,0)
end)
script.Parent:WaitForChild("MainM").CUSSSelection.MouseLeave:Connect(function()
script.Parent.MainM.CUSSSelection.TextColor3 = Color3.new(1,1,1)
end)
script.Parent:WaitForChild("MainM").Quit.MouseLeave:Connect(function()
script.Parent.MainM.Quit.TextColor3 = Color3.new(1,1,1)
end)
script.Parent:WaitForChild("MainM").Quit.MouseEnter:Connect(function()
script.Parent.Hover.Playing = true
script.Parent.Hover.TimePosition = 0
script.Parent.MainM.Quit.TextColor3 = Color3.new(1,1,0)
end)
script.Parent.MainM.CSelection.MouseButton1Click:Connect(function()
if script.Parent.CustomSelection.Position == UDim2.new(-0.5,0,-0.052,0) then
if script.Parent.CharacterSelection.Position ~= UDim2.new(-0.5,0,-0.052,0) and script.Parent.CharacterSelection.Position == UDim2.new(0, 0,-0.052, 0) then
script.Parent.Selected.Playing = true
script.Parent.CharacterSelection:TweenPosition(UDim2.new(-0.5, 0,-0.052, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.7)
elseif script.Parent.CharacterSelection.Position ~= UDim2.new(0,0,-0.052,0) and script.Parent.CharacterSelection.Position == UDim2.new(-0.5, 0,-0.052, 0) then
script.Parent.Selected.Playing = true
script.Parent.CharacterSelection:TweenPosition(UDim2.new(0, 0,-0.052, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.7)
end
end
end)
script.Parent.MainM.CUSSSelection.MouseButton1Click:Connect(function()
if script.Parent.CharacterSelection.Position == UDim2.new(-0.5,0,-0.052,0) then
if script.Parent.CustomSelection.Position ~= UDim2.new(-0.5,0,-0.052,0) and script.Parent.CustomSelection.Position == UDim2.new(0, 0,-0.052, 0) then
script.Parent.Selected.Playing = true
script.Parent.CustomSelection:TweenPosition(UDim2.new(-0.5, 0,-0.052, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.7)
elseif script.Parent.CustomSelection.Position ~= UDim2.new(0,0,-0.052,0) and script.Parent.CustomSelection.Position == UDim2.new(-0.5, 0,-0.052, 0) then
script.Parent.Selected.Playing = true
script.Parent.CustomSelection:TweenPosition(UDim2.new(0, 0,-0.052, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.7)
end
end
end)
script.Parent.MainM.Quit.MouseButton1Click:Connect(function()
if script.Parent.Warning1.Position == UDim2.new(-0.5,0,-0.052,0) then
if script.Parent.Warning1.Position ~= UDim2.new(-0.5,0,-0.052,0) and script.Parent.CharacterSelection.Position == UDim2.new(0, 0,-0.052, 0) then
script.Parent.Selected.Playing = true
script.Parent.Warning1:TweenPosition(UDim2.new(-0.5, 0,-0.052, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.7)
elseif script.Parent.Warning1.Position ~= UDim2.new(0,0,-0.052,0) and script.Parent.CharacterSelection.Position == UDim2.new(-0.5, 0,-0.052, 0) then
script.Parent.Selected.Playing = true
script.Parent.Warning1:TweenPosition(UDim2.new(0, 0,-0.052, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quart,0.7)
end
end
end)
end
coroutine.wrap(SBBCZ_fake_script)()
local function CQCL_fake_script() -- Altered.LocalScript
local script = Instance.new('LocalScript', Altered)
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered
Sound.Volume = 1.5
Sound.Playing = true
Sound.Looped = false
Sound.SoundId = "rbxassetid://5350464575"
Sound.Name = "Selected"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.PlayerGui.Altered
Sound.Volume = 1.5
Sound.Playing = true
Sound.Looped = false
Sound.SoundId = "rbxassetid://8211321592"
Sound.Name = "Hover"
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.MenuPlaylist
Sound.Volume = 1
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://5973079632"
Sound.Name = "1Menu"
game.Players.LocalPlayer:WaitForChild("MenuPlaylist")
game.Players.LocalPlayer.MenuPlaylist["1Menu"]:Destroy()
end
coroutine.wrap(CQCL_fake_script)()
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GlitchtaleChara.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.ReplicatedStorage.Remotes.Functions:InvokeServer({getrenv()._G.Pass,"ChangeSetting","MorphEnabled",true})
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Chara"
game.Players.LocalPlayer.PlayerGui.Altered.Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Asriel.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.ReplicatedStorage.Remotes.Functions:InvokeServer({getrenv()._G.Pass,"ChangeSetting","MorphEnabled",true})
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Asriel"
game.Players.LocalPlayer.PlayerGui.Altered:destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.SSChara.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.ReplicatedStorage.Remotes.Functions:InvokeServer({getrenv()._G.Pass,"ChangeSetting","MorphEnabled",true})
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "SFChara"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.DeltaSans.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "DeltaSans"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTFrisk.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "GTFrisk"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTUndyne.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Undyne"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.XTale.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "XSans"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTFrisk.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Frisk"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.UTSans.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Sans"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.GTCR.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.ReplicatedStorage.Remotes.Functions:InvokeServer({getrenv()._G.Pass,"ChangeSetting","MorphEnabled",true})
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Chara"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
wait(1)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.HP:Destroy()
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.HealthLabel:Destroy()
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName:Destroy()
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.StaminaBar:Destroy()
game.Players.LocalPlayer.Backpack:WaitForChild("Main").CharaMoves.Animations.Idle.AnimationId = "rbxassetid://7038816551"
game.Players.LocalPlayer.Backpack:WaitForChild("Main").CharaMoves.Animations.Walk.AnimationId = "rbxassetid://5658603994"
game.Players.LocalPlayer.Backpack:WaitForChild("Main").CharaMoves.Animations.Run.AnimationId = "rbxassetid://5658603994"
game.Players.LocalPlayer.Backpack:WaitForChild("Main").CharaMoves.Animations.Jump.AnimationId = "rbxassetid://3198665507"
game.Players.LocalPlayer.Backpack:WaitForChild("Main").CharaMoves.Animations.Fall.AnimationId = "rbxassetid://6136052357"
game.Players.LocalPlayer.Backpack:WaitForChild("Main").CharaMoves.Animations.Block.AnimationId = "rbxassetid://3203734026"
game.Players.LocalPlayer.Backpack.Main.WalkSpeed.Value = "60"
local plrs = game:GetService("Players")
local rep = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local runS = game:GetService("RunService")
local tweenS = game:GetService("TweenService")
local remotes = rep:WaitForChild("Remotes")
local damage = remotes:WaitForChild("Damage")
local functions = remotes:WaitForChild("Functions")
local events = remotes:WaitForChild("Events")
local charaMoves = remotes:WaitForChild("CharaMoves")
local pass = getrenv()._G.Pass
local mouse = game.Players.LocalPlayer:GetMouse()
game.StarterGui:SetCore("SendNotification", {
Title = "GTCR Loaded!";
Text = "Made By Fatal Error Sans#4931, Enjoy!";
Duration = 5;
})
char = game.Players.LocalPlayer.Character
local vel = Instance.new('BodyVelocity',char.HumanoidRootPart)
vel.Name = 'Client'
vel.MaxForce = Vector3.new(4000,4000,4000)*math.huge
vel.P = math.huge
vel.Velocity = (Vector3.new(0,8,0))*4
wait(0.5)
vel:Destroy()
char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0, 1, 0)
playerpos = char.HumanoidRootPart.Position + Vector3.new(0, 0, 0)
local part = Instance.new("Part")
part.Name = "Platform" -- Name the part... hehe
part.Anchored = true -- Anchor the part
part.Parent = game.Workspace -- Put the part into the Workspace
part.Shape = Enum.PartType.Block -- Give the part a ball shape
part.Transparency = 1
part.Size = Vector3.new(5, 1, 5)
part.Position = playerpos + Vector3.new(0, -5, 0)
stop = false
player = game.Players.LocalPlayer
char = player.Character
hum = char:FindFirstChildOfClass('Humanoid')
anim = Instance.new('Animation')
anim.AnimationId = 'rbxassetid://4562533193'-- put id here, with rbxasset thing and everything
k = hum:LoadAnimation(anim)
k:Play()
wait(0.2)
local player = game.Players.LocalPlayer
local char = player.Character
local selfpos = char.HumanoidRootPart.Position
stop = false
for yay = 1, 2 do
spawn(function()
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileYellow",
[3] = "Spawn",
[4] = Vector3.new(0, 1000, 0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
wait(0.5)
local A_1 = {
[1] = pass,
[2] = "Chatted",
[3] = "Lets See how you SURVIVE This power!",
[4] = Color3.new(1, 0, 0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end)
end
spawn(function()
wait(2)
part:Destroy()
wait(3)
stop = true
end)
while stop == false do
spawn(function()
for _,v in pairs(game.Players.LocalPlayer.Character.Attacks:GetChildren()) do
spawn(function()
v.Name = 'affected'
for _,e in pairs(v:GetChildren()) do
if e.Name == 'Particle' or e.Name == 'Hitted' or e.Name == 'HitBox' then
e:Destroy()
end
end
v:WaitForChild('BodyVelocity'):Destroy()
local move = Instance.new('BodyPosition',v)
move.Name = 'Client'
move.D = 1000
move.MaxForce = Vector3.new(1,1,1)*1000000
move.P = 25000
spawn(function()
for thing = 1, 100 do
selfpos = char.HumanoidRootPart.Position
move.Position = selfpos
wait(0.2)
end
end)
wait(1)
v:Destroy()
end)
end
end)
wait()
end
local mode = "DT"
spawn(function()
local userInputService = game:GetService("UserInputService")
on = true
posz = 0
posx = 0
local dt = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(255,0,0),
Transparency = 0
}
local justice = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(255,255,0),
Transparency = 0
}
local bravery = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(255, 110, 0),
Transparency = 0
}
local patience = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(5, 252, 236),
Transparency = 0
}
local integrity = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(0, 60, 255),
Transparency = 0
}
local kindness = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(0, 255, 13),
Transparency = 0
}
local perseverance = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(194, 3, 252),
Transparency = 0
}
local hate = {
Parent = game.workspace,
Name = 'ye',
Material = Enum.Material.Neon,
Color = Color3.fromRGB(0,0,0),
Transparency = 0
}
times = 0
_G.soulsmode = 1
_G.closed = false
local effects = game.Players.LocalPlayer.Character.Effects
local rs = game:GetService("RunService")
local player = game.Players.LocalPlayer
local Character = player.Character
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Spawn",
[4] = game.Players.LocalPlayer.Character.HumanoidRootPart.Position + game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector *10 + Vector3.new(math.random(0,35),math.random(0,30),math.random(0,33))
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
local projectiles = game.Players.LocalPlayer.Character.Attacks
for i,v in pairs(projectiles:GetChildren()) do
if v.Name == "KnifeSlashProjectileOrange" or "Removing" then
v:WaitForChild("BodyVelocity"):Destroy()
v:WaitForChild("ParticleEmitter"):Destroy()
coroutine.resume(coroutine.create(function()
while
wait(0.05)
do
if _G.closed then
break
end
times = times + 1
if
times == 6
then
times = 0
end
if times == 1 then
v.Position = Character.HumanoidRootPart.Position - Vector3.new(0,40,0)
elseif times == 2 then
v.Position = Character.HumanoidRootPart.Position - Vector3.new(10,40,0)
elseif times == 3 then
v.Position = Character.HumanoidRootPart.Position - Vector3.new(0,30,10)
elseif times == 4 then
v.Position = Character.HumanoidRootPart.Position - Vector3.new(0,30,-10)
elseif times == 5 then
v.Position = Character.HumanoidRootPart.Position - Vector3.new(-10,30,0)
end
-- Script generated by SimpleSpy - credits to exx#9394
local args1 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = dt
}
}
local args2 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = justice
}
}
local args3 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = bravery
}
}
local args4 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = patience
}
}
local args5 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = integrity
}
}
local args6 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = kindness
}
}
local args7 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = perseverance
}
}
local args8 = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileOrange",
[3] = "Hit",
[4] = v,
[5] = v.CFrame,
[6] = hate
}
}
if _G.soulsmode == 1 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args1))
elseif _G.soulsmode == 2 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args2))
elseif _G.soulsmode == 3 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args3))
elseif _G.soulsmode == 4 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args4))
elseif _G.soulsmode == 5 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args5))
elseif _G.soulsmode == 6 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args6))
elseif _G.soulsmode == 7 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args7))
elseif _G.soulsmode == 8 then
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args8))
end
end
end))
end
end
spawn(function()
while wait(0.01) do
if mode == "hate" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(0,0,0),
[5] = 0,
[6] = "SpecialHell"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Hate"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://6141390171"
Sound.Name = "1Megalo Strike Back"
while mode == "hate" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "DT" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(255,0,0),
[5] = 0,
[6] = "RedMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Determination"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
wait(0.5)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://2759823703"
Sound.Name = "1Megalo Strike Back"
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
while mode == "DT" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 0, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "justice" then
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Justice"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 255, 0)
wait(1)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://5670393738"
Sound.Name = "1Megalo Strike Back"
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(247, 234, 53) --[[Color3]],
[5] = 0.3,
[6] = "YellowMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
while mode == "justice" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 255, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 255, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 255, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(255, 255, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "perseverance" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(210, 39, 245) --[[Color3]],
[5] = 0.3,
[6] = "PurpleMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Karma"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(88, 0, 129)
wait(1.5)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://5294451688"
Sound.Name = "1Megalo Strike Back"
while mode == "perseverance" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(88, 0, 129),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(88, 0, 129),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.2)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(88, 0, 129),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(88, 0, 129),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "bluemode" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(6, 10, 248)--[[Color3]],
[5] = 0,
[6] = "BlueMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Integrity"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(0, 0, 255)
wait(1.5)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://6403520059"
Sound.Name = "1Megalo Strike Back"
while mode == "bluemode" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 255),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 255),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 255),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 0, 255),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "kindness" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(6, 248, 38)--[[Color3]],
[5] = 0,
[6] = "GreenMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Kindness"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
wait(1.5)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://3012888916"
Sound.Name = "1Megalo Strike Back"
while mode == "kindness" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 255, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 255, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 255, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 255, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "orangemode" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(255, 89, 0),
[5] = 0,
[6] = "OrangeMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Bravery"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 89, 0)
wait(2)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://7256486381"
Sound.Name = "1Megalo Strike Back"
while mode == "orangemode" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.fromRGB(255, 89, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.fromRGB(255, 89, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.fromRGB(255, 89, 0),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.fromRGB(255, 89, 0),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
elseif mode == "lightbluemode" then
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "ChangeColor",
[4] = Color3.fromRGB(6, 248, 228),
[5] = 0,
[6] = "LightBlueMode"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
game.Players.LocalPlayer.PlayerGui.UI.Ui.Info.Attack.Text = "Patience"
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(0, 180, 250)
wait(1.7)
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://935501955"
Sound.Name = "1Megalo Strike Back"
while mode == "lightbluemode" do
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 180, 250),
[5] = CFrame.new(0, 0, 0, 0.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 180, 250),
[5] = CFrame.new(0, 0, 0, 0.866025388, -5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 180, 250),
[5] = CFrame.new(0, 0, 0, 0.866025388, -3, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing1,
[4] = Color3.new(0, 180, 250),
[5] = CFrame.new(0, 0, 0, 1.866025388, -0.5, 0, 0.5, 0.866025388, 0, 0, 0, 1)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
end-- the end of if
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "e" then wait(0)
if mode == "hate" then
mode = "DT"
_G.soulsmode = 1
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "DT" then
mode = "justice"
_G.soulsmode = 2
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "justice" then
mode = "orangemode"
_G.soulsmode = 3
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "orangemode" then
mode = "lightbluemode"
_G.soulsmode = 4
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "lightbluemode" then
mode = "bluemode"
_G.soulsmode = 5
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "bluemode" then
mode = "kindness"
_G.soulsmode = 6
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "kindness" then
mode = "perseverance"
_G.soulsmode = 7
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "perseverance" then
mode = "hate"
_G.soulsmode = 8
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "q" then wait(0)
if mode == "hate" then
_G.soulsmode = 7
mode = "perseverance"
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "perseverance" then
mode = "kindness"
_G.soulsmode = 6
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "kindness" then
mode = "bluemode"
_G.soulsmode = 5
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "bluemode" then
mode = "lightbluemode"
_G.soulsmode = 4
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "lightbluemode" then
mode = "orangemode"
_G.soulsmode = 3
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "orangemode" then
mode = "justice"
_G.soulsmode = 2
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "justice" then
mode = "DT"
_G.soulsmode = 1
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
elseif mode == "DT" then
mode = "hate"
_G.soulsmode = 8
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "KnifeColor",
[3] = "Reverse"
}
}
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer(unpack(args))
wait(0.5)
Player = game.Players.LocalPlayer.Name
AnimationId = "7004737889"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
k:Play() --Play the animation
k:AdjustSpeed(1.5)
end
end
end)
end)
_G.infon = false
game.Players.LocalPlayer.Backpack:WaitForChild("Main"):WaitForChild("CharaMoves"):WaitForChild("ModuleScript"):WaitForChild("Animations").BladesCombat:ClearAllChildren()
local function lmb(damage,knockback,hittime,animinst,kbvalue,sound)
print("fired")
if game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value ~= nil then
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 =
{
["HitTime"] = hittime,
["Type"] = knockback,
["HitEffect"] = "KnifeHitEffect",
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Hurt3,
["Sound"] = sound, --KnifeHit
["Velocity"] = kbvalue,
["Damage"] = damage
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
local Anim = Instance.new("Animation")
Anim.AnimationId = animinst
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(3)
end
--lmb
local uis = game:GetService("UserInputService")
local walkspeed = game.Players.LocalPlayer.Backpack.Main.WalkSpeed.Value and game.Players.LocalPlayer.Character.Humanoid.WalkSpeed
local lmbmode = 0
local waittime = 0
local lmbon = true
uis.InputBegan:Connect(function(inputObject,gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
if lmbmode == 0 and lmbon == true then
lmbon = false
waittime = 0.8
walkspeed = 0
lmb(10,"Normal",0.5,"rbxassetid://4906092495",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0, 1),game:GetService("ReplicatedStorage").Sounds.KnifeHit)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing3,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.Angles(0,0,0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.05)
lmbmode = 1
walkspeed = 10
lmbon = true
elseif lmbmode == 1 and lmbon == true then
lmbon = false
waittime = 0.8
walkspeed = 0
lmb(2,"Normal",0.6,"rbxassetid://4800266314",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0, 1),game:GetService("ReplicatedStorage").Sounds.KnifeHit)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing3,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.Angles(0,0,math.rad(70))
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
lmbmode = 2
walkspeed = 10
lmbon = true
elseif lmbmode == 2 and lmbon == true then
lmbon = false
waittime = 0.8
walkspeed = 0
lmb(4,"Normal",0.4,"rbxassetid://4348301706",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0, 1),game:GetService("ReplicatedStorage").Sounds.KnifeHit)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing3,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.Angles(0,0,math.rad(20))
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.05)
lmbmode = 3
walkspeed = 10
lmbon = true
elseif lmbmode == 3 and lmbon == true then
lmbon = false
waittime = 0.8
walkspeed = 0
lmb(3,"Normal",0.5,"rbxassetid://4456901030",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0, 1),game:GetService("ReplicatedStorage").Sounds.KnifeHit)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "SlashEffect",
[3] = game:GetService("Players").LocalPlayer.Backpack.Main.CharaMoves.ModuleScript.Animations.Slash.Swing3,
[4] = Color3.new(0, 0, 0),
[5] = CFrame.Angles(0,0,math.rad(110))
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(0.1)
lmbmode = 4
walkspeed = 10
lmbon = true
elseif lmbmode == 4 and lmbon == true then
lmbon = false
waittime = 0.8
walkspeed = 0
lmb(5,"Normal",0.6,"rbxassetid://4300091335",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0, 1),game:GetService("ReplicatedStorage").Sounds.KnifeHit)
wait(0.1)
if _G.infon then
lmbmode = 0
else
lmbmode = 5
end
walkspeed = 10
lmbon = true
elseif lmbmode == 5 and lmbon == true then
lmbon = false
walkspeed = 0
lmb(5,"Knockback",0.6,"rbxassetid://4906108508",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector * 170 + Vector3.new(0, -40, 0),game:GetService("ReplicatedStorage").Sounds.KnifeHit)
wait(0.3)
walkspeed = 10
wait(2.7)
lmbmode = 0
lmbon = true
end
end
end
end)
coroutine.resume(coroutine.create(function()
while true do
wait(0.1)
if waittime ~= 0 then
waittime = waittime - 0.1
if waittime > 0 then
else
waittime = 0
end
end
if waittime == 0 then
lmbmode = 0
end
end
end))
uis.InputBegan:Connect(function(input,gameProcessedEvent)
local keyPressed = input.KeyCode
print("keypress")
if not gameProcessedEvent then
print("processed")
if keyPressed == Enum.KeyCode.P then
if _G.infon == false then
_G.infon = true
local A_1 = {
[1] = pass,
[2] = "Chatted",
[3] = "INF COMBO = TRUE",
[4] = Color3.new(1, 0, 0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
else
_G.infon = false
local A_1 = {
[1] = pass,
[2] = "Chatted",
[3] = "INF COMBO = FALSE",
[4] = Color3.new(1, 0, 0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
end
end
end)
function attack1()
--Test
--_G.cdr = false--Just global cooldown cause this is just a pure script, so ya know you dont accidently spam it and get banned
if _G.cdr then return end-- it will stop the script from running after you used it until the cooldown is done
_G.cdr = true---sets to true so the line above would work
pass = getrenv()._G.Pass
player = game.Players.LocalPlayer
m = player:GetMouse()
local LockOn = player.Backpack.Main.LockOnScript.LockOn.Value
if LockOn then
target = LockOn
r2 = target.HumanoidRootPart.CFrame
elseif not LockOn then
r2 = m.Hit*CFrame.new(0,4,0)
end
char = player.Character
h = char.Humanoid
a = Instance.new('Animation')
a.AnimationId = 'rbxassetid://4905914802'
k = h:LoadAnimation(a)
k:Play()
k:AdjustSpeed(3)
--char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,20,0)
--wait(.1)
amm = 5
--char.HumanoidRootPart.Position + Vector3.new(0,10000,0)
for i = 1,amm,1 do
spawn(function()
local A_1 = {
[1] = pass,
[2] = "KnifeProjectile",
[3] = "Spawn",
[4] = r2.p
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
end)
end
am = 0
local tab2 = {}-- Adds the table for the projectiles
val = Instance.new('NumberValue',player)--Creates a number value Instance to be able to detect value
val.Name = 'KnifeSlashes Amount'
detect = char.Attacks.ChildAdded:Connect(function(pp)--- detects if an instance is added to the Attacks Folder
if pp.Name == 'KnifeSlashProjectile' then-- you can use dex to get the name of the projectiles
table.insert(tab2,pp)---inserts the part to the table so it can be used later
am = am + 1-- everytime a projectile is added it will add the numbers and change the NumberValue to that number
val.Value = am
pp:WaitForChild('BodyVelocity'):Destroy()-- Removes body velocity(Body Velocity is the instance that makes the projectile move)
end
end)
detect2 = val:GetPropertyChangedSignal("Value"):Connect(function()
if val.Value == amm then--- Detect when there are a specific number of projectiles well depending on the remote u have to multiply it sometimes
tab = {}-- Adding table for the BodyPosition
for _,v in pairs(tab2) do---goes through the table
v.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,10,-2)
v1 = Instance.new('BodyPosition',v)-- Adds Body Position Instance(It will move the projectiles to a specific location)
fol = Instance.new('Folder',v1)
v1.Name = 'Client'-- Needs to be named client in soulshatters so it wont crash
v1.MaxForce = Vector3.new(1,1,1)*100000
v1.D = 1000--Dampening
v1.P = 30000---The Velocity that will be used to move the projeciles to a specific position
x = math.random(-10,10)*2
z = math.random(-10,10)*2
v1.Position = (char.HumanoidRootPart.CFrame).p + Vector3.new(0,10,0)
table.insert(tab,v1)--Inserts the instances to the table
v1.Position = (char.HumanoidRootPart.CFrame).p + Vector3.new(x,10,z)
end
wait(.5)
for i = 1,#tab do--will loop for how many things are in the table
local LockOn = player.Backpack.Main.LockOnScript.LockOn.Value--LockOn Value to get the lock on of a player
if LockOn then -- Checks if you are locked on
target = LockOn
r2 = target.HumanoidRootPart.CFrame
r1 = target.HumanoidRootPart
elseif not LockOn then--If you are not locked it will use your Mouse Position instead
r2 = m.Hit
r1 = m.Target
end
x = math.random(-20,20)
z = math.random(-20,20)
tab[i].D = 150---when you add things into a table there wil be a number that defines that instance in the table(kinda like names work)
tab[i].Position = r2.p + Vector3.new(0,-4,0)
tab2[i].CFrame = r2*CFrame.new(x,10,z)
wait()
spawn(function()-- Remote to make it damage the target
local A_1 = {
[1] = pass,
[2] = "KnifeProjectile",
[3] = "Hit",
[4] = tab2[i], --The projectile
[5] = r2, --The target CFrame
[6] = r1-- Target Part
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
end)
wait(.1)
end
wait(3)---cooldown
detect:Disconnect()-- Disconnects the functions so it wont keep running
detect2:Disconnect()
val:Destroy()-- Destroy the Number value instance used to detect the Projectiles
_G.cdr = false--_G is a global value so if u used the same _G.(local name) in another script it will still work
-- so this is just to make the cooldown Global
end
end)
end
function attack2()
--Test
--_G.cdr = false--Just global cooldown cause this is just a pure script, so ya know you dont accidently spam it and get banned
if _G.cdr then return end-- it will stop the script from running after you used it until the cooldown is done
_G.cdr = true---sets to true so the line above would work
pass = getrenv()._G.Pass
player = game.Players.LocalPlayer
m = player:GetMouse()
local LockOn = player.Backpack.Main.LockOnScript.LockOn.Value
if LockOn then
target = LockOn
r2 = target.HumanoidRootPart.CFrame
elseif not LockOn then
r2 = m.Hit*CFrame.new(0,4,0)
end
char = player.Character
h = char.Humanoid
a = Instance.new('Animation')
a.AnimationId = 'rbxassetid://4905914802'
k = h:LoadAnimation(a)
k:Play()
k:AdjustSpeed(3)
--char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,20,0)
--wait(.1)
amm = 5
--char.HumanoidRootPart.Position + Vector3.new(0,10000,0)
for i = 1,amm,1 do
spawn(function()
local A_1 = {
[1] = pass,
[2] = "KnifeProjectilePurple",
[3] = "Spawn",
[4] = r2.p
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
end)
end
am = 0
local tab2 = {}-- Adds the table for the projectiles
val = Instance.new('NumberValue',player)--Creates a number value Instance to be able to detect value
val.Name = 'KnifeSlashes Amount'
detect = char.Attacks.ChildAdded:Connect(function(pp)--- detects if an instance is added to the Attacks Folder
if pp.Name == 'KnifeSlashProjectilePurple' then-- you can use dex to get the name of the projectiles
table.insert(tab2,pp)---inserts the part to the table so it can be used later
am = am + 1-- everytime a projectile is added it will add the numbers and change the NumberValue to that number
val.Value = am
pp:WaitForChild('BodyVelocity'):Destroy()-- Removes body velocity(Body Velocity is the instance that makes the projectile move)
end
end)
detect2 = val:GetPropertyChangedSignal("Value"):Connect(function()
if val.Value == amm then--- Detect when there are a specific number of projectiles well depending on the remote u have to multiply it sometimes
tab = {}-- Adding table for the BodyPosition
for _,v in pairs(tab2) do---goes through the table
v.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,10,0)
v1 = Instance.new('BodyPosition',v)-- Adds Body Position Instance(It will move the projectiles to a specific location)
fol = Instance.new('Folder',v1)
v1.Name = 'Client'-- Needs to be named client in soulshatters so it wont crash
v1.MaxForce = Vector3.new(0,1,0)*100000
v1.D = 1000--Dampening
v1.P = 30000---The Velocity that will be used to move the projeciles to a specific position
x = math.random(0,0)*2
z = math.random(0,10)*2
v1.Position = (char.HumanoidRootPart.CFrame).p + Vector3.new(0,10,0)
table.insert(tab,v1)--Inserts the instances to the table
v1.Position = (char.HumanoidRootPart.CFrame).p + Vector3.new(x,10,z)
end
wait(.5)
for i = 1,#tab do--will loop for how many things are in the table
local LockOn = player.Backpack.Main.LockOnScript.LockOn.Value--LockOn Value to get the lock on of a player
if LockOn then -- Checks if you are locked on
target = LockOn
r2 = target.HumanoidRootPart.CFrame
r1 = target.HumanoidRootPart
elseif not LockOn then--If you are not locked it will use your Mouse Position instead
r2 = m.Hit
r1 = m.Target
end
x = math.random(0,0)
z = math.random(-20,2)
tab[i].D = 150---when you add things into a table there wil be a number that defines that instance in the table(kinda like names work)
tab[i].Position = r2.p + Vector3.new(0,-4,0)
tab2[i].CFrame = r2*CFrame.new(x,10,z)
wait()
spawn(function()-- Remote to make it damage the target
local A_1 = {
[1] = pass,
[2] = "KnifeProjectilePurple",
[3] = "Hit",
[4] = tab2[i], --The projectile
[5] = r2, --The target CFrame
[6] = r1-- Target Part
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
end)
wait(.1)
end
wait(3)---cooldown
detect:Disconnect()-- Disconnects the functions so it wont keep running
detect2:Disconnect()
val:Destroy()-- Destroy the Number value instance used to detect the Projectiles
_G.cdr = false--_G is a global value so if u used the same _G.(local name) in another script it will still work
-- so this is just to make the cooldown Global
end
end)
end
function attack3()
local char = player.Character
local bigmogus = char.Humanoid
local attack3sus = Instance.new('Animation')
attack3sus.AnimationId = 'rbxassetid://4905914802'
local amgus = bigmogus:LoadAnimation(a)
amgus:Play()
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
wait(0.5)
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
wait(0.5)
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "KnifeProjectileYellow", "Spawn", Vector3.new(0,2000,0)})
amgus:Stop()
end
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
rmb()
end
end)
mouse.KeyDown:Connect(function(k)
if k == "z" then
attack1()
end
end)
mouse.KeyDown:Connect(function(k)
if k == "x" then
attack2()
end
end)
mouse.KeyDown:Connect(function(k)
if k == "c" then
attack3()
end
end)
end)
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP1.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Sans"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
function Chat(text,color)
if dead == true then return end
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "Chatted",
[3] = text,
[4] = color
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalovania"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://6118537198"
Sound.Name = "1Megalovania"
spawn(function()
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://5657849029"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(2)
wait(2)
Chat("Lets Just get to the point.", Color3.fromRGB(255, 0, 0))
wait(2)
Chat("So your finally here...", Color3.fromRGB(255, 0, 0))
wait(1)
Chat("Well.", Color3.fromRGB(255, 0, 0))
wait(2)
Chat("Who said you will finish the job?", Color3.fromRGB(255, 0, 0))
wait(2)
Chat("Ill make sure ill finish the job!", Color3.fromRGB(255, 0, 0))
wait(1)
k:Stop()
--sword by glasyrx cool yes
char = game.Players.LocalPlayer.Character
for _,v in pairs(game.ReplicatedStorage.Resources.Weapons:GetChildren()) do
if v.Name == 'ChaosSaber' then
sword2 = v:Clone()
sword2.Parent = char
sword2.ChaosSaber:Destroy()
sword2.Anchored = false
weld = Instance.new('Weld',sword2)
weld.Part0 = sword2
weld.Part1 = char['Left Arm']
sword2.Name = 'GTFSword3'
sword2.Color = Color3.fromRGB(223, 0, 216)
weld.C0 = CFrame.new(0.95,-1.7,-0)*CFrame.Angles(1.6,0,-1.6)
sword2.Transparency = 0.8
wait(0.5)
sword2.Transparency = 0.7
wait(0.5)
sword2.Transparency = 0.5
wait(0.5)
sword2.Transparency = 0
end
end
--sword by glasyrx cool yes
char = game.Players.LocalPlayer.Character
for _,v in pairs(game.ReplicatedStorage.Resources.Weapons:GetChildren()) do
if v.Name == 'ChaosSaber' then
sword2 = v:Clone()
sword2.Parent = char
sword2.ChaosSaber:Destroy()
sword2.Anchored = false
weld = Instance.new('Weld',sword2)
weld.Part0 = sword2
weld.Part1 = char['Right Arm']
sword2.Name = 'GTFSword3'
sword2.Color = Color3.fromRGB(223, 0, 216)
weld.C0 = CFrame.new(0.95,-1.7,-0)*CFrame.Angles(1.6,0,-1.6)
sword2.Transparency = 0.8
wait(0.5)
sword2.Transparency = 0.7
wait(0.5)
sword2.Transparency = 0.5
wait(0.5)
sword2.Transparency = 0
end
end
game.Players.LocalPlayer.Character.Bone:Destroy()
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text = "Bones Enabled"
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.LeftJaw.Color = Color3.fromRGB(242, 243, 243)
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.RightJaw.Color = Color3.fromRGB(242, 243, 243)
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.Eye1.Color = Color3.fromRGB(255, 0, 0)
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.Eye2.Color = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.PlayerGui.UI.Ui.StaminaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.Text = "Sans"
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextColor3 = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(255, 0, 255)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.Health.BackgroundColor3 = Color3.fromRGB(255, 0, 255)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.HealthLabel.Text = "488/488"
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.TextColor3 = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.TextStrokeColor3 = Color3.fromRGB(255, 0, 255)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Font = "Arcade"
game.Workspace.ServerEffects.ServerCooldown:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves1["4"]:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves2["2"]:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves2["3"]:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves2["4"]:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves2["5"]:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves2["6"]:Destroy()
game:GetService("Players").LocalPlayer.PlayerGui.UI.Ui.MoveDebounceShower.Moves3["3"]:Destroy()
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "1" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Bones Enabled" then
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Knockback",
["HitEffect"] = "BoneHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, 28, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","CrossLineBones",game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.HumanoidRootPart.CFrame})
end
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "1" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Swords Enabled" then
game.ReplicatedStorage.Effects.BurstEffect.Effect1.Color = Color3.fromRGB(170, 0, 170)
game.ReplicatedStorage.Effects.BurstEffect.Effect2.Color = Color3.fromRGB(170, 0, 170)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Knockback",
["HitEffect"] = "BoneHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(50,10,50)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback1,
["Velocity"] = Vector3.new(0, 1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
game.ReplicatedStorage.Effects.KnifeHitEffect22.BallEffect.Color = Color3.fromRGB(170, 0, 170)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","KnifeHitEffect22",game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.HumanoidRootPart.CFrame})
end
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "1" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Blasters Enabled" then
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.Head.Anchored = true
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.Eye1.Anchored = true
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.Eye2.Anchored = true
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.RootPart.Anchored = true
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.LeftJaw.Anchored = true
game.ReplicatedStorage.Effects.BigDeltaGasterBlaster.RightJaw.Anchored = true
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "Effect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(100, -100, 100),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 0
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","BigDeltaGasterBlaster",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame})
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "KnifeHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(100, -100, 100),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","DeterminationExplosion",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame})
wait(1)
game.Players.LocalPlayer.Character.Effects.BigDeltaGasterBlaster:Destroy()
end
end
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "2" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Swords Enabled" then
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "KnifeHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(30, 30, 30),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","KnifeHitEffect3",game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.HumanoidRootPart.CFrame})
end
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "2" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Bones Enabled" then
boneCloned = false
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3731949745"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1.5)
wait(0.25)
k:AdjustSpeed(0)
wait(0.2)
spawn(function()
ez = true
spawn(function()
player = game.Players.LocalPlayer
char = player.Character
for _,v in pairs(game.ReplicatedStorage.Effects.UnderswapPapyrusBones:GetChildren()) do
if v.Name == 'Bone' and boneCloned == false then
boneCloned = true
clone = v:Clone()
clone.Parent = char
clone.Anchored = true
clone.Name = 'SpkBone'
clone.Transparency = 0
clone.BrickColor = BrickColor.new(255, 255, 255)
clone.Material = Enum.Material.Neon
clone.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,-9,-4)
end
end
end)
wait(0.3)
spawn(function()
repeat wait()
clone.CFrame = clone.CFrame*CFrame.new(0, 3, 0)
until ez == false
end)
wait(0.1625)
ez = false
wait(1.3)
spawn(function()
repeat wait()
clone.Transparency = clone.Transparency + 0.15
until ez2 == false
end)
wait(0.2)
ez2 = false
wait()
clone:Destroy()
end)
spawn(function()
wait(0.2)
local player = game.Players.LocalPlayer
local char = player.Character
local sound = Instance.new('Sound',char.Head)
local id = 3731906158
sound.Volume = 3
sound.SoundId = 'rbxassetid://'..id
sound:Play()
end)
spawn(function()
local args = {
[1] = getrenv()._G.Pass,
[2] = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value,
[3] = {
["HitTime"] = 0.65,
["Type"] = "Knockback",
["HitEffect"] = "BoneHitEffect",
["CombatInv"] = true,
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Hurt1,
["Velocity"] = Vector3.new(0, 1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Kick,
["Damage"] = 35
}
}
game:GetService("ReplicatedStorage").Remotes.Damage:InvokeServer(unpack(args))
end)
wait(0.2)
k:AdjustSpeed(1.5)
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "3" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Bones Enabled" then
game.ReplicatedStorage.Effects.GroundSpear.Part.BrickColor = BrickColor.new(170, 0, 170)
game.ReplicatedStorage.Effects.GroundSpear.Spear.BrickColor = BrickColor.new(170, 0, 170)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","GroundSpear",game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.HumanoidRootPart.CFrame})
end
wait(0.5)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 1,
["Type"] = "Normal",
["HitEffect"] = "BurstEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -100, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "e" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Blasters Enabled" then
wait(0.1)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text = "Swords Enabled"
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "q" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Bones Enabled" then
wait(0.1)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text = "Swords Enabled"
end
end
end)
end)
wait(25)
Chat("papyrus was hiding something from me.....", Color3.fromRGB(255, 0, 0))
wait(5)
Chat("cant blame him, he knew it would corrupt me.", Color3.fromRGB(255, 0, 0))
wait(5)
Chat("but thanks to me, he is nothing but dust.", Color3.fromRGB(255, 0, 0))
wait(5)
Chat("and thanks to his death, i finally know why he kept it a secret.", Color3.fromRGB(255, 0, 0))
wait(10)
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "Bones",
[3] = "AirSpawn",
[4] = Vector3.new(10,60,0)
}
}
game:GetService("ReplicatedStorage").Remotes.SansMoves:InvokeServer(unpack(args))
wait(0.01)
game.Players.LocalPlayer.Character.Attacks.Bone.BrickColor = BrickColor.new(255, 0, 0)
wait(1)
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "Bones",
[3] = "AirSpawn",
[4] = Vector3.new(10,60,0)
}
}
game:GetService("ReplicatedStorage").Remotes.SansMoves:InvokeServer(unpack(args))
wait(0.01)
game.Players.LocalPlayer.Character.Attacks.Bone.BrickColor = BrickColor.new(255, 0, 0)
wait(1)
Chat("after his fall, my soul grew stronger...", Color3.fromRGB(255, 0, 0))
wait(5)
Chat("but my mind was breaking.", Color3.fromRGB(255, 0, 0))
wait(5)
Chat("i was lost in grief in a dark and cruel world,", Color3.fromRGB(255, 0, 0))
wait(5)
Chat("a world shaped in part by my brother actions.", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("amidst the destruction, a strange figure approached me.", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("and in my darkest hour, offered the solution to my problems", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("he said i was the true hero of this world,", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("making me out to be the savior of all.", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("at first, i thought he was mad as well but he started to share his knowledge with me.", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("the knowledge about time and space, resets, the endless deaths, your struggle for ultimate power...", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("an intense mind bending reality that nobody could hope to comprehend.", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("and because of that harsh reality, i understood that my madness was not detrimental.", Color3.fromRGB(255, 0, 0))
wait(8)
Chat("it was an awakening", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("with my newfound knowledge, these newfound powers...", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("i will be the hero to save these tormented souls. the hero to save this everything from you.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("the hero who will put an end to this endless cycle of resets once and for all.", Color3.fromRGB(255, 0, 0))
wait(18)
Chat("at first i believed that once i understood my brothers plan, i could continue his work...", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("but as i continued to dust monsters, i began to see how flawed his plan was.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("he planned to accept his madness. to lose himself fighting you.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("he believed the only way he would emerge victorious was to become an instinctual dusting machine.", Color3.fromRGB(255, 0, 0))
wait(18)
Chat("but i realized after reaching hot land that wouldnt work...", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("you cannot be defeated through battle, as you will return smarter, faster.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("all because you have the power to shape this world to your desires.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("but if i can so much as chip away your DETERMINATION...", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("i can use this power to erase YOU from this world.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("to finally let this timeline continue its cycle.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("i will be the one to manipulate this world. a god among our fellow monsters.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("its what must be done to end this nightmare for once and for all.", Color3.fromRGB(255, 0, 0))
wait(10)
Chat("whats necessary to give my people the happy ending you NEVER did.", Color3.fromRGB(255, 0, 0))
wait(40)
game.Players.LocalPlayer.Character.GTFSword3:Destroy()
wait(2)
Chat("-284", Color3.fromRGB(255, 0, 0))
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.Health:Destroy()
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.HealthLabel.Text = "204/488"
wait(3)
Chat("...!", Color3.fromRGB(255, 0, 0))
wait(50)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.HealthLabel.Text = "12/488"
wait(5)
game.Players.LocalPlayer:Kick("You think you can dust me with one blow?")
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.GTAsgore.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Undyne"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
wait(5)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextColor3 = Color3.fromRGB(255, 0, 0)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.StaminaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
game.Players.LocalPlayer.PlayerGui.UI.Ui.StaminaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
game.Players.LocalPlayer.Character.Head.Voice:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.Character.Head
Sound.Volume = 5
Sound.Playing = false
Sound.Looped = false
Sound.SoundId = "rbxassetid://7807218979"
Sound.Name = "Voice"
Sound.PlaybackSpeed = 1
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalo Strike Back"]:Destroy()
local Sound = Instance.new("Sound")
Sound.Parent = game.Players.LocalPlayer.StarterPlaylist
Sound.Volume = 2
Sound.Playing = true
Sound.Looped = true
Sound.SoundId = "rbxassetid://4617295755"
Sound.Name = "1Megalo Strike Back"
spawn(function()
player = game.Players.LocalPlayer
char = player.Character
for _,v in pairs(player.Backpack.Main:GetChildren()) do
er = string.lower(v.Name)
if string.match(er,'moves') then
v.Animations.Idle.AnimationId = "rbxassetid://5411065101"-- change specifc animations to whatever you want
v.Animations.Walk.AnimationId = "rbxassetid://5411071023"
v.Animations.Run.AnimationId = "rbxassetid://5411068397"
v.Animations.Block.AnimationId = "rbxassetid://5411080645"
end
end
---------Module------------------
local module
local modulelocation
original = player.Backpack.Main
clone = player.Backpack.Main:Clone()
for _,v in pairs(original:GetDescendants()) do--- the
if v.Name == 'ModuleScript' then
module = v
modulelocation = v.Parent.Name
end
end
for _,v in pairs(clone:GetDescendants()) do
if v.Name == 'ModuleScript' then
v:Destroy()
end
end
for _,v in pairs(clone:GetDescendants()) do
if v.Name == modulelocation then
module.Parent = v
end
end
-------------Gui stuff-----------Just to make the whole thing work bascially
for _,v in pairs(player.PlayerGui.UI.Ui:GetChildren()) do
er = string.lower(v.Name)
if string.match(er,'move') then
originalm = v
clonem = v:Clone()
end
end
for _,v in pairs(player.PlayerGui:GetChildren()) do
er = string.lower(v.Name)
if string.find(er,'indicator') then
clonem1 = v:Clone()
originalm1 = v
end
end
for _,v in pairs(clone:GetDescendants()) do
if v.Name == 'Extra' then
eg = v
end
end
----------------
clonem1.Parent = eg
clonem.Parent = eg
originalm:Destroy()
originalm1:Destroy()
clone.Parent = player.Backpack
wait()
original:Destroy()---destroys so you can play the animations
end)
wait(1)
game.Players.LocalPlayer.Backpack.Main.UndyneMoves.ModuleScript.Animations.BladesCombat.Light1.AnimationId = "rbxassetid://5411089475"
game.Players.LocalPlayer.Backpack.Main.UndyneMoves.ModuleScript.Animations.BladesCombat.Light2.AnimationId = "rbxassetid://4800163313"
game.Players.LocalPlayer.Backpack.Main.UndyneMoves.ModuleScript.Animations.BladesCombat.Light3.AnimationId = "rbxassetid://5776251749"
game.Players.LocalPlayer.Backpack.Main.UndyneMoves.ModuleScript.Animations.BladesCombat.Light4.AnimationId = "rbxassetid://4800630930"
game.Players.LocalPlayer.Backpack.Main.UndyneMoves.ModuleScript.Animations.BladesCombat.Light5.AnimationId = "rbxassetid://6154060166"
game.Workspace.ServerEffects.ServerCooldown:Destroy()
game.Players.LocalPlayer.Character.Spear:Destroy()
game.ReplicatedStorage.Effects.HeavyHitEffect.Effect1.Color = Color3.fromRGB(255, 176, 0)
game.ReplicatedStorage.Effects.HeavyHitEffect.Effect2.Color = Color3.fromRGB(255, 0, 0)
game.ReplicatedStorage.Effects.SpearGroundExplosion.Explosion.Name = "Explosion1"
game.ReplicatedStorage.Effects.SpearGroundExplosion.Explosion1.Color = Color3.fromRGB(255, 120, 0)
game.ReplicatedStorage.Effects.SpearGroundExplosion.Explosion.Color = Color3.fromRGB(255, 0, 0)
wait(1)
--//=================================\\
--||trident by King Dream#9746
--\\=================================//
pls = game:GetService'Players'
rs = game:GetService'RunService'
uinps = game:GetService'UserInputService'
lp = pls.LocalPlayer
mouse = lp:GetMouse()
c = lp.Character
human = c.Humanoid
critTime = .27
--------------------------------------------------------
local cf0 = CFrame.new(0,-0.80,0) * CFrame.Angles(-3,-1.50,0)
local h = Instance.new("Part",c)
h.Name = "Trident"
h.BrickColor = BrickColor.new(1,0,0)
h.Material = Enum.Material.Neon
h.Size = Vector3.new(2,1,10)
h.Locked = true
h.CanCollide = false
h.Name = "Handle"
local m = Instance.new("SpecialMesh",h)
m.MeshType = "FileMesh"
m.Scale = Vector3.new(1.5,2.3,2.3)
m.MeshId = "http://www.roblox.com/asset/?id=30694864"
local hw = Instance.new("Motor",game.Players.LocalPlayer.Character["Right Arm"])
hw.Name = "HandleWeld"
hw.Part0 = game.Players.LocalPlayer.Character["Right Arm"]
hw.Part1 = h
hw.C0 = cf0:Inverse()
wait(1)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "1" then
local AnimationId = "4385319937"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local mouse = game.Players.LocalPlayer:GetMouse()
function getlockchar()
local char = game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
return char
end
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = getlockchar().HumanoidRootPart.CFrame * CFrame.new(0,0,3)
wait(0.15)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Knockback",
["HitEffect"] = "BurstEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(-20, 0, -20),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "2" then
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "LightHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
h.BrickColor = BrickColor.new(255,170,0)
wait(0.5)
h.BrickColor = BrickColor.new(0,0,255)
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "LightHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
wait(0.5)
h.BrickColor = BrickColor.new(255,170,0)
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "LightHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
wait(0.5)
h.BrickColor = BrickColor.new(0,0,255)
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "LightHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
wait(0.5)
h.BrickColor = BrickColor.new(255,170,0)
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "LightHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
wait(0.5)
h.BrickColor = BrickColor.new(0,0,255)
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.8,
["Type"] = "Normal",
["HitEffect"] = "LightHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
h.BrickColor = BrickColor.new(1,0,0)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "3" then
local mouse = game.Players.LocalPlayer:GetMouse()
function getlockchar()
local char = game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
return char
end
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = getlockchar().HumanoidRootPart.CFrame * CFrame.new(0,0,3)
local AnimationId = "5411089475"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(0.3)
wait(0.3)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 1,
["Type"] = "Knockback",
["HitEffect"] = "HeavyHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = Vector3.new(0, -1, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
lockon = game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
for _,v in pairs(game.ReplicatedStorage.RogueEffects.FireEffect:GetDescendants()) do
if v.Name == "Fire" then
print("debug2398")
clone = v:Clone()
print("debug29388")
clone.Parent = lockon.Torso
clone.Name = "CustomParticle"
end
end
wait(5)
for i = 1,4 do
game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.Torso.CustomParticle:Destroy()
end
end
end)
player = game.Players.LocalPlayer
char = player.Character
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "4" then
local AnimationId = "4408052168"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","SpearGroundExplosion",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame})
end
for _,v in pairs(game.workspace:GetChildren()) do
if v:FindFirstChildOfClass('Humanoid') and v ~= char and v:FindFirstChild('HumanoidRootPart') then
mag = (char.HumanoidRootPart.Position - v.HumanoidRootPart.Position).magnitude
if mag <= 10 then
spawn(function()
local A_1 = getrenv()._G.Pass
local A_2 = v
local A_3 = {
["Type"] = "Normal",
["HitEffect"] = "HeavyHitEffect",
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.Clashing,
["Velocity"] = Vector3.new(0, -0.1, 0),
["HitTime"] = 1,
["CombatInv"] = true,
["Sound"] = game:GetService("ReplicatedStorage").RogueSounds.BaneDischarge,
["Damage"] = 4
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end)
end
end
end
end
end)
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.Betty.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Betty"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
end)
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.DTP2.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Sans"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
wait(4)
function Chat(text,color)
if dead == true then return end
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "Chatted",
[3] = text,
[4] = color
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
function playSound(id,pitch)
spawn(function()
local player = game.Players.LocalPlayer
local char = player.Character
local sound = Instance.new('Sound',char.Head)
sound.Volume = 2
sound.SoundId = 'rbxassetid://'..id
sound.Pitch = pitch
sound:Play()
end)
end
game.Players.LocalPlayer.Character.Bone:Destroy()
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text = "Bones Enabled"
game.Players.LocalPlayer.PlayerGui.UI.Ui.StaminaBar.Bar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
game.Players.LocalPlayer.PlayerGui.UI.Ui.ManaBar.Bar.BackgroundColor3 = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.Text = "Sans"
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextColor3 = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(255, 0, 255)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.Health.BackgroundColor3 = Color3.fromRGB(255, 0, 255)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.Health:Destroy()
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.HealthLabel.Text = "12/488"
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.TextColor3 = Color3.fromRGB(170, 0, 170)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.TextStrokeColor3 = Color3.fromRGB(255, 0, 255)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Font = "Arcade"
spawn(function()
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://5657849029"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(5)
wait(2)
Chat("You really thought you could dust me in one blow?", Color3.fromRGB(255, 255, 255))
wait(2)
Chat("im not that weak.", Color3.fromRGB(255, 255, 255))
wait(4)
Chat("you will have to do more than slash me with that rusty knife", Color3.fromRGB(255, 255, 255))
wait(5)
char = game.Players.LocalPlayer.Character
for _,v in pairs(game.ReplicatedStorage.Resources.Weapons:GetChildren()) do
if v.Name == 'ChaosSaber' then
sword2 = v:Clone()
sword2.Parent = char
sword2.ChaosSaber:Destroy()
sword2.Anchored = false
weld = Instance.new('Weld',sword2)
weld.Part0 = sword2
weld.Part1 = char['Right Arm']
sword2.Name = 'GTFSword3'
sword2.Color = Color3.fromRGB(223, 0, 216)
weld.C0 = CFrame.new(0.95,-1.7,-0)*CFrame.Angles(1.6,0,-1.6)
sword2.Transparency = 0.8
wait(0.5)
sword2.Transparency = 0.7
wait(0.5)
sword2.Transparency = 0.5
wait(0.5)
sword2.Transparency = 0
end
end
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","SpearJusticeExplosion",game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame})
playSound(3215220222, 1)
k:Stop()
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.HumanoidRootPart
local torso = char.Torso
local hum = char.Humanoid
local root = char.HumanoidRootPart
local rs = game:GetService("RunService").RenderStepped
local new = Instance.new
local v3 = Vector3.new
local ns = NumberSequence.new
local nr = NumberRange.new
local bc = BrickColor.new
local cf = CFrame.new
local cfa = CFrame.Angles
local rad = math.rad
a1 = new("Part", char)
a1.Name = "Head"
a1.BrickColor = BrickColor.new("White")
a1.Material = "Neon"
a1.Transparency = 0
aa1 = new("SpecialMesh", a1)
aa1.MeshType = "FileMesh"
aa1.Offset = v3(7, 3, -0.1)
aa1.Scale = v3(0.1, 0.1, 0.1)
aa1.MeshId = "rbxassetid://2267134290"
aaa1 = new("Weld", a1)
aaa1.Part0 = hed
aaa1.Part1 = a1
aaa1.C0 = CFrame.Angles(0, math.rad(0), 0)
a2 = new("Part", char)
a2.Name = "RJaw"
a2.BrickColor = BrickColor.new("Dark stone grey")
a2.Material = "Neon"
a2.Transparency = 0
aa2 = new("SpecialMesh", a2)
aa2.MeshType = "FileMesh"
aa2.Offset = v3(9.1, 2.01, -0.2)
aa2.Scale = v3(0.07, 0.07, 0.07)
aa2.MeshId = "rbxassetid://2267146284"
aaa2 = new("Weld", a2)
aaa2.Part0 = hed
aaa2.Part1 = a2
aaa2.C0 = CFrame.Angles(0, math.rad(0), 0)
a3 = new("Part", char)
a3.Name = "LJaw"
a3.BrickColor = BrickColor.new("Dark stone grey")
a3.Material = "Neon"
a3.Transparency = 0
aa3 = new("SpecialMesh", a3)
aa3.MeshType = "FileMesh"
aa3.Offset = v3(5, 2.01, -0.2)
aa3.Scale = v3(0.07, 0.07, 0.07)
aa3.MeshId = "rbxassetid://2267147917"
aaa3 = new("Weld", a3)
aaa3.Part0 = hed
aaa3.Part1 = a3
aaa3.C0 = CFrame.Angles(0, math.rad(0), 0)
a4 = new("Part", char)
a4.Name = "Inside"
a4.BrickColor = BrickColor.new("White")
a4.Material = "Neon"
a4.Transparency = 0
aa4 = new("SpecialMesh", a4)
aa4.MeshType = "FileMesh"
aa4.Offset = v3(7, 3, -0.1)
aa4.Scale = v3(0.1, 0.1, 0.1)
aa4.MeshId = "rbxassetid://2267130588"
aaa4 = new("Weld", a4)
aaa4.Part0 = hed
aaa4.Part1 = a4
aaa4.C0 = CFrame.Angles(0, math.rad(0), 0)
a5 = new("Part", char)
a5.Name = "Inside2"
a5.BrickColor = BrickColor.new("White")
a5.Material = "Neon"
a5.Transparency = 0
aa5 = new("SpecialMesh", a5)
aa5.MeshType = "FileMesh"
aa5.Offset = v3(7, 3, -0.1)
aa5.Scale = v3(0.1, 0.1, 0.1)
aa5.MeshId = "rbxassetid://2267130588"
aaa5 = new("Weld", a5)
aaa5.Part0 = hed
aaa5.Part1 = a5
aaa5.C0 = CFrame.Angles(0, math.rad(0), 0)
a1e = new("Part", char)
a1e.Name = "Head"
a1e.BrickColor = BrickColor.new("White")
a1e.Material = "Neon"
a1e.Transparency = 0
aa1e = new("SpecialMesh", a1e)
aa1e.MeshType = "FileMesh"
aa1e.Offset = v3(-7, 3, -0.1)
aa1e.Scale = v3(0.1, 0.1, 0.1)
aa1e.MeshId = "rbxassetid://2267134290"
aaa1e = new("Weld", a1e)
aaa1e.Part0 = hed
aaa1e.Part1 = a1e
aaa1e.C0 = CFrame.Angles(0, math.rad(0), 0)
a2e = new("Part", char)
a2e.Name = "RJaw"
a2e.BrickColor = BrickColor.new("Dark stone grey")
a2e.Material = "Neon"
a2e.Transparency = 0
aa2e = new("SpecialMesh", a2e)
aa2e.MeshType = "FileMesh"
aa2e.Offset = v3(-5, 2.01, -0.2)
aa2e.Scale = v3(0.07, 0.07, 0.07)
aa2e.MeshId = "rbxassetid://2267146284"
aaa2e = new("Weld", a2e)
aaa2e.Part0 = hed
aaa2e.Part1 = a2e
aaa2e.C0 = CFrame.Angles(0, math.rad(0), 0)
a3e = new("Part", char)
a3e.Name = "LJaw"
a3e.BrickColor = BrickColor.new("Dark stone grey")
a3e.Material = "Neon"
a3e.Transparency = 0
aa3e = new("SpecialMesh", a3e)
aa3e.MeshType = "FileMesh"
aa3e.Offset = v3(-9.1, 2.01, -0.2)
aa3e.Scale = v3(0.07, 0.07, 0.07)
aa3e.MeshId = "rbxassetid://2267147917"
aaa3e = new("Weld", a3e)
aaa3e.Part0 = hed
aaa3e.Part1 = a3e
aaa3e.C0 = CFrame.Angles(0, math.rad(0), 0)
a5e = new("Part", char)
a5e.Name = "Inside2"
a5e.BrickColor = BrickColor.new("White")
a5e.Material = "Neon"
a5e.Transparency = 0
aa5e = new("SpecialMesh", a5e)
aa5e.MeshType = "FileMesh"
aa5e.Offset = v3(-7, 3, -0.1)
aa5e.Scale = v3(0.1, 0.1, 0.1)
aa5e.MeshId = "rbxassetid://2267130588"
aaa5e = new("Weld", a5e)
aaa5e.Part0 = hed
aaa5e.Part1 = a5e
aaa5e.C0 = CFrame.Angles(0, math.rad(0), 0)
end
end)
player = game.Players.LocalPlayer
char = player.Character
for _,v in pairs(player.Backpack.Main:GetChildren()) do
er = string.lower(v.Name)
if string.match(er,'moves') then
v.Animations.Idle.AnimationId = "rbxassetid://5028878836"-- change specifc animations to whatever you want
v.Animations.Walk.AnimationId = "rbxassetid://5096023358"
v.Animations.Run.AnimationId = "rbxassetid://4370518984"
v.Animations.Block.AnimationId = "rbxassetid://3203734026"
print('e')
end
end
---------Module------------------
local module
local modulelocation
original = player.Backpack.Main
clone = player.Backpack.Main:Clone()
for _,v in pairs(original:GetDescendants()) do--- the
if v.Name == 'ModuleScript' then
module = v
modulelocation = v.Parent.Name
end
end
for _,v in pairs(clone:GetDescendants()) do
if v.Name == 'ModuleScript' then
v:Destroy()
end
end
for _,v in pairs(clone:GetDescendants()) do
if v.Name == modulelocation then
module.Parent = v
end
end
-------------Gui stuff-----------Just to make the whole thing work bascially
for _,v in pairs(player.PlayerGui.UI.Ui:GetChildren()) do
er = string.lower(v.Name)
if string.match(er,'move') then
originalm = v
clonem = v:Clone()
end
end
for _,v in pairs(player.PlayerGui:GetChildren()) do
er = string.lower(v.Name)
if string.find(er,'indicator') then
clonem1 = v:Clone()
originalm1 = v
end
end
for _,v in pairs(clone:GetDescendants()) do
if v.Name == 'Extra' then
eg = v
end
end
----------------
clonem1.Parent = eg
clonem.Parent = eg
originalm:Destroy()
originalm1:Destroy()
clone.Parent = player.Backpack
wait()
original:Destroy()---destroys so you can play the animations
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "c" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Sword Enabled" then
local AnimationId = "5776249806"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.01,
["Type"] = "Normal",
["HitEffect"] = "YellowHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(50,10,50)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback1,
["Velocity"] = Vector3.new(0, 100, 0),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
game.ReplicatedStorage.Effects.KnifeHitEffect22.BallEffect.Color = Color3.fromRGB(255, 120, 0)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","KnifeHitEffect22",game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.HumanoidRootPart.CFrame})
game.Players.LocalPlayer.Character.GTFSword3.Color = Color3.fromRGB(255, 120, 0)
wait(1)
game.Players.LocalPlayer.Character.GTFSword3.Color = Color3.fromRGB(170, 0, 170)
end
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "x" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Sword Enabled" then
local AnimationId = "5776249806"
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://"..AnimationId
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = 0.01,
["Type"] = "Normal",
["HitEffect"] = "YellowHitEffect",
["VictimCFrame"] = CFrame.new(Vector3.new(50,10,50)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback1,
["Velocity"] = Vector3.new(100, -100, 100),
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = 10
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
game.ReplicatedStorage.Effects.KnifeHitEffect22.BallEffect.Color = Color3.fromRGB(255, 120, 0)
for i,v in pairs(getconnections(game:GetService("ReplicatedStorage").Remotes.Effects.OnClientEvent)) do
v:Fire({"Model","DeltaExplosion",game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.HumanoidRootPart.CFrame})
game.Players.LocalPlayer.Character.GTFSword3.Color = Color3.fromRGB(255, 255, 0)
wait(1)
game.Players.LocalPlayer.Character.GTFSword3.Color = Color3.fromRGB(170, 0, 170)
end
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "e" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Blasters Enabled" then
wait(0.1)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text = "Sword Enabled"
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "q" then
if game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text == "Bones Enabled" then
wait(0.1)
game.Players.LocalPlayer.PlayerGui.SansIndicator.Indicator.Text = "Sword Enabled"
end
end
end)
end)
game.Players.LocalPlayer.PlayerGui.Altered.CustomSelection.TitleCUS.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Chara"
wait(1)
game.Players.LocalPlayer.Character.Head:WaitForChild("HealthBar"):Destroy()
wait(1)
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
game.Players.LocalPlayer.Character:WaitForChild("ForceField"):Destroy()
local v1 = {
[1] = getrenv()._G.Pass,
[2] = "Damage",
[3] = math.huge,
[4] = game.Players.LocalPlayer.Character
}
local event = game:GetService("ReplicatedStorage").Remotes.Events
event:FireServer(v1)
game.Players.LocalPlayer.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if game.Players.LocalPlayer.Character.Humanoid.Health == 0 then
game.Players.LocalPlayer.Character.Humanoid.Health = 1
end
end)
wait(2)
--[[
EXECUTE ON GLITCHTALE CHARA
---------------------------
E - Create Strings
Q - Delete a string
U - Enable Red Slashes / Fatal Error Strings
P - Disable Red Slashes / Fatal Error Strings
G - Sit Toggle
--------------------------
Enjoy!!
--]]
function Chat(text,color)
if dead == true then return end
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "Chatted",
[3] = text,
[4] = color
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
end
Chat("Script made by fatal error! Strings made by king dream And Fatal Error Strings made by exn", Color3.fromRGB(255, 255, 255))
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(k)
if k == "e" then
local slashes = {}
local p = game:GetService("Players").LocalPlayer
local character = p.Character or p.CharacterAdded:Wait()
local mouse = p:GetMouse()
local setOrb = false
character:WaitForChild("Attacks").ChildAdded:Connect(function(child)
if child.Name == "BlueString" and #slashes <= 0 then
child:WaitForChild("Hitted"):Destroy()
table.insert(slashes,child)
end
end)
local speed = 23
local lradius = 20
local radius = 1300
local ts = 0
local rad,cos,sin = math.rad,math.cos,math.sin
local root = p.Character.HumanoidRootPart
game:GetService("RunService").RenderStepped:Connect(function()
for i,v in pairs(slashes) do
if not v or not v.Parent then
table.remove(slashes,i)
return
end
local y = root.Position.Y
local z = root.Position.Z
local x = root.Position.X + radiuscos(rad(ts))
v.Position = Vector3.new(x,y,root.Position.Z + radiussin(rad(ts)))
ts = ts + 155545645645
end
end)
game:GetService("ReplicatedStorage").Remotes.CharaMoves:InvokeServer({getrenv()._G.Pass, "PatienceAttack", "Spawn", Vector3.new(0,0,0)})
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "u" then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame + Vector3.new(0,25,0)
wait()
game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "PlaySound",
[3] = game:GetService("ReplicatedStorage").Resources.Sounds.Moves.YellowBeam.Charge,
[4] = game:GetService("Players").LocalPlayer.Character.Head
}
}
game:GetService("ReplicatedStorage").Remotes.Functions:InvokeServer(unpack(args))
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://4562533193"
local k2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k2:Play()
k2:AdjustSpeed(0.75)
char = game.Players.LocalPlayer.Character
char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0, 1, 0)
playerpos = char.HumanoidRootPart.Position + Vector3.new(0, 0, 0)
local part = Instance.new("Part")
part.Name = "Platform" -- Name the part... hehe
part.Anchored = true -- Anchor the part
part.Parent = game.Workspace -- Put the part into the Workspace
part.Shape = Enum.PartType.Block -- Give the part a ball shape
part.Transparency = 1
part.Size = Vector3.new(5, 1, 5)
part.Position = playerpos + Vector3.new(5, 5, 5)
stop = false
local player = game.Players.LocalPlayer
local char = player.Character
local selfpos = char.RealKnife.Blade.Position
stop = false
for yay = 1, 2 do
spawn(function()
wait(0.3)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileDarkRed",
[3] = "Spawn",
[4] = Vector3.new(0, 1000, 0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "KnifeProjectileDarkRed",
[3] = "Spawn",
[4] = Vector3.new(0, 1000, 0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.CharaMoves
Event:InvokeServer(A_1)
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "Chatted",
[3] = "Aura Enabled.",
[4] = Color3.new(1,0,0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
wait(2)
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame + Vector3.new(0,1,0)
wait()
game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
end)
end
spawn(function()
wait(1)
part:Destroy()
wait(1)
stop = true
end)
game:GetService("ReplicatedStorage").Remotes.UndyneMoves:InvokeServer(unpack(args))
while stop == false do wait()
spawn(function()
for _,v in pairs(game.Players.LocalPlayer.Character.Attacks:GetChildren()) do
spawn(function()
v.Name = 'affected'
for _,e in pairs(v:GetChildren()) do
if e.Name == 'Particle' or e.Name == 'Hitted' or e.Name == 'HitBox' then
e:Destroy()
end
end
v:WaitForChild('BodyVelocity'):Destroy()
local move = Instance.new('BodyPosition',v)
move.Name = 'Client'
move.D = 1000
move.MaxForce = Vector3.new(1,18,1)*1000000
move.P = 25000
wait(1.5)
move.D = 0
spawn(function()
for thing = 1, 1000 do
selfpos = char.RealKnife.Blade.Position
move.Position = selfpos
wait(1)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "p" then
move.D = 1000
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3765380192"
local k2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k2:Play()
wait(0.7)
v:Destroy()
local A_1 =
{
[1] = getrenv()._G.Pass,
[2] = "Chatted",
[3] = "Aura Disabled.",
[4] = Color3.new(1,0,0)
}
local Event = game:GetService("ReplicatedStorage").Remotes.Events
Event:FireServer(A_1)
k2:Stop()
end
end)
end)
end
end)
end
end
end)
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(k)
if k == "q" then
game.Players.LocalPlayer.Character.Attacks.BlueString:Destroy()
game.Players.LocalPlayer.Character.Attacks.affected:Destroy()
end
end)
local sitstart = Instance.new("Animation")
sitstart.AnimationId = "rbxassetid://7507477136"
local sitstartplay = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid"):LoadAnimation(sitstart)
local sitloop = Instance.new("Animation")
sitloop.AnimationId = "rbxassetid://7507481748"
local sitloopplay = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid"):LoadAnimation(sitloop)
local sitend = Instance.new("Animation")
sitend.AnimationId = "rbxassetid://7507485912"
local sitendplay = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid"):LoadAnimation(sitend)
local sitting = false
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "g" then if sitting == false then
sitting = true
sitstartplay:Play()
wait(1)
sitloopplay:Play()
elseif sitting == true then
sitting = false
sitloopplay:Stop()
sitendplay:Play()
end
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "n" then
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3752218582"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:GetService("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 =
{
["HitTime"] = 1,
["Type"] = "Knockback",
["HitEffect"] = "LightHitEffect",
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Sound"] = game:GetService("ReplicatedStorage").Sounds.SakuyaAttack1,
["Velocity"] = Vector3.new(-10, -0.1, -0),
["CombatInv"] = true,
["Damage"] = 40
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "n" then wait(0.2)
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3752218582"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:GetService("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 =
{
["HitTime"] = 1,
["Type"] = "Knockback",
["HitEffect"] = "LightHitEffect",
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Sound"] = game:GetService("ReplicatedStorage").Sounds.SakuyaAttack1,
["Velocity"] = Vector3.new(10, -0.1, -0),
["CombatInv"] = true,
["Damage"] = 40
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "n" then wait(0.3)
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3752218582"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:GetService("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 =
{
["HitTime"] = 1,
["Type"] = "Knockback",
["HitEffect"] = "LightHitEffect",
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Sound"] = game:GetService("ReplicatedStorage").Sounds.SakuyaAttack1,
["Velocity"] = Vector3.new(0, 10, -0),
["CombatInv"] = true,
["Damage"] = 40
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "n" then wait(0.4)
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3752218582"
local k = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
k:Play()
k:AdjustSpeed(1)
local A_1 = getrenv()._G.Pass
local A_2 = game:GetService("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 =
{
["HitTime"] = 1,
["Type"] = "Knockback",
["HitEffect"] = "LightHitEffect",
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Sound"] = game:GetService("ReplicatedStorage").Sounds.SakuyaAttack1,
["Velocity"] = Vector3.new(0, 0, 3),
["CombatInv"] = true,
["Damage"] = 40
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
end)
-- CREDITS:
-- Fatal Error Sans#4931 (Made this script)
-- King Dream for the Strings
-- exn from Project GTC for the red stuff
end)
game.Players.LocalPlayer.PlayerGui.Altered.CharacterSelection.TitleCS.MouseButton1Click:Connect(function()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.Players.LocalPlayer.PlayerGui.CharacterSelection.Character.Value = "Sans"
game.Players.LocalPlayer.PlayerGui.Altered:Destroy()
wait(5)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.Health:Destroy()
game.Players.LocalPlayer:WaitForChild("StarterPlaylist")
game.Players.LocalPlayer.StarterPlaylist["1Megalovania"]:Destroy()
local s1 = Instance.new("Sound")
s1.Parent = game.Players.LocalPlayer.StarterPlaylist
s1.Volume = 2
s1.Playing = true
s1.Looped = true
s1.SoundId = "rbxassetid://6463854800"
s1.Name = "1LostMemories"
--attack recolor by meko
local char = game:GetService("Players").LocalPlayer.Character
local effects = char.Effects
local stuff = {"Bone"}
local colors = {Color3.fromRGB(255, 128, 0)}
local function check(part)
for i = 1, #stuff do
if part.Name == stuff[i] then
part.Color = colors[i]
end
end
end
effects.DescendantAdded:Connect(check)
local char = game:GetService("Players").LocalPlayer.Character
local beams = char
local stuff = {"Eye", "Back", "Middle", "CircleEffect", "E", "ExplosionEffect", "BeamSmoke"}
local colors = {Color3.fromRGB(0, 120, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(255, 0, 0)}
local function check(part)
for i = 1, #stuff do
if part.Name == stuff[i] then
part.Color = colors[i]
end
end
end
beams.DescendantAdded:Connect(check)
local char = game:GetService("Players").LocalPlayer.Character
local attacks = char.Attacks
local stuff = {"Bone"}
local colors = {Color3.fromRGB(0, 0, 170)}
local function check(part)
for i = 1, #stuff do
if part.Name == stuff[i] then
part.Color = colors[i]
end
end
end
attacks.DescendantAdded:Connect(check)
--scarf
player = game.Players.LocalPlayer
char = player.Character
for _,v in pairs(game:GetService("ReplicatedStorage").Resources.Character.Accessories.SFChara.Scarf:GetChildren()) do
if v.Name == 'RainbowScarf' then
clone1 = v:Clone()
clone1.Name = 'Scarf'
clone1.Parent = char
weld = Instance.new('Weld',clone1)
weld.Part0 = char['Scarf']
weld.Part1 = char['Head']
weld.C1 = CFrame.new(-0,-0.8,-0)*CFrame.Angles(0,3,0)
clone1.Transparency = 0
char.Scarf.Color = Color3.new(1, 0, 0)
char.Scarf.Decal.Texture = ""
char.Scarf.Mesh.TextureId = ""
end
end
--eye thing idk
player = game.Players.LocalPlayer
char = player.Character
for _,v in pairs(game.ReplicatedStorage.Effects.CharaKnifeProjectile:GetChildren()) do
if v.Name == 'ParticleEmitter' then
X = v:Clone()
X.Parent = char.Head
X.Name = 'X'
char.Head.X.Speed = NumberRange.new(0, 0)
char.Head.X.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255))
char.Head.X.Size = NumberSequence.new(0.3, 0)
local attachment = Instance.new("Attachment", script.Parent)
attachment.Parent = char.Head
attachment.Position = Vector3.new(0.1, 0, 0)
char.Head.X.Parent = attachment
for _,v in pairs(game:GetService("ReplicatedStorage").Effects.OverwriteAct.Attachment:GetChildren()) do
if v.Name == 'Body' then
x = v:Clone()
x.Name = 'A'
x.Parent = char.Head
x.Enabled = true
x.Size = NumberSequence.new(0.3, 0)
x.Speed = NumberRange.new(-25, -25)
local attachment = Instance.new("Attachment")
attachment.Parent = char.Head
attachment.Position = Vector3.new(0.1, 0.2, 0)
char.Head.A.Parent = attachment
end
end
end
end
--slash
spawn(function()
player = game.Players.LocalPlayer
char = player.Character
for _,v in pairs(game:GetService("ReplicatedStorage").Resources.Character.Accessories.SFChara:GetChildren()) do
if v.Name == 'SlashEffect' then
clone = v:Clone()
clone.Parent = char.Torso
clone.Name = "getting hit"
end
end
end)
--locals
local phase1 = true
local phase2 = false
local v1 = game:GetService("ReplicatedStorage")
local v2 = game:GetService("Workspace")
local v3 = v1.Remotes.Effects
local v4 = game:GetService("Players")
local v5 = v4.LocalPlayer
local v6 = v5.Character
local v7 = v5.PlayerGui.UI.Ui
local l__ServerEffects__child = v2.ServerEffects.ServerCooldown
local v8 = Instance.new("Sound")
v8.Parent = v5.StarterPlaylist
v8.SoundId = "rbxassetid://5309259110"
v8.Name = "2Stormheart"
v8.Playing = false
v8.Volume = 0.5
v8.PlaybackSpeed = 1
v8.Looped = true
v8.EmitterSize = 10
--name loop
coroutine.resume(coroutine.create(function()
while phase1 == true do
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.BackHealth.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
wait(1)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.BackHealth.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
game.Players.LocalPlayer.Character.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
wait(1)
end
end))
local v9 = game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
function f1(hittime, rtype, hiteffect, velocity, damage)
local A_1 = getrenv()._G.Pass
local A_2 = game:service("Players").LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value
local A_3 = {
["HitTime"] = hittime,
["Type"] = rtype,
["HitEffect"] = hiteffect,
["VictimCFrame"] = CFrame.new(Vector3.new(0,0,0)),
["HurtAnimation"] = game:GetService("ReplicatedStorage").Animations.HurtAnimations.Knockback2,
["Velocity"] = velocity,
["Sound"] = game:GetService("ReplicatedStorage").Sounds.Knockback,
["Damage"] = damage
}
local Event = game:GetService("ReplicatedStorage").Remotes.Damage
Event:InvokeServer(A_1, A_2, A_3)
end
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "z" then
f1(0.9, "Normal", "KnifeHitEffect", Vector3.new(0, 2, 0), 7)
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "GasterBlasters",
[3] = "SummonOne",
[4] = workspace:FindFirstChild(game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.Name).Torso.Position
}
}
game:GetService("ReplicatedStorage").Remotes.SansMoves:InvokeServer(unpack(args))
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "x" then
f1(1, "Normal", "BurstEffect", Vector3.new(0, 5, 0), 0)
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "Bones",
[3] = "AirSpawn",
[4] = workspace:FindFirstChild(game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.Name).Torso.Position
}
}
game:GetService("ReplicatedStorage").Remotes.SansMoves:InvokeServer(unpack(args))
wait(0.5)
f1(1, "Normal", "BurstEffect", Vector3.new(0, 5, 0), 0)
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "Bones",
[3] = "AirSpawn",
[4] = workspace:FindFirstChild(game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.Name).Torso.Position
}
}
game:GetService("ReplicatedStorage").Remotes.SansMoves:InvokeServer(unpack(args))
wait(0.5)
f1(1, "Normal", "BurstEffect", Vector3.new(0, 5, 0), 0)
local args = {
[1] = {
[1] = getrenv()._G.Pass,
[2] = "Bones",
[3] = "AirSpawn",
[4] = workspace:FindFirstChild(game.Players.LocalPlayer.Backpack.Main.LockOnScript.LockOn.Value.Name).Torso.Position
}
}
game:GetService("ReplicatedStorage").Remotes.SansMoves:InvokeServer(unpack(args))
wait(0.5)
f1(1, "Normal", "BurstEffect", Vector3.new(30, 5, 30), 0)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(k)
if k == "p" then
if phase2 == false then
if phase1 == true then
phase1 = false
phase2 = true
local char = game:GetService("Players").LocalPlayer.Character
local attacks2 = char.Attacks
local effects2 = char.Effects
local beams2 = char
local stuff2 = {"Bone", "Eye", "Back", "Middle", "CircleEffect", "E", "ExplosionEffect", "BeamSmoke"}
local colors2 = {Color3.fromRGB(0, 255, 0), Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0)}
local function check(part)
for i = 1, #stuff do
if part.Name == stuff2[i] then
part.Color = colors2[i]
end
end
end
attacks2.DescendantAdded:Connect(check)
effects2.DescendantAdded:Connect(check)
beams2.DescendantAdded:Connect(check)
s1.Playing = false
v8.Playing = true
v6.Head.Attachment:Destroy()
while phase2 == true do
v6.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(255, 0, 0)
v6.Head.HealthBar.Frame.BackHealth.BackgroundColor3 = Color3.fromRGB(0, 0, 255)
v6.Scarf.Color = Color3.fromRGB(0, 255, 0)
v6.Head.Attachment.A.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0))
wait(0.2)
v6.Head.HealthBar.Frame.BackHealth.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
v6.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(0, 255, 0)
v6.Scarf.Color = Color3.fromRGB(0, 0, 255)
v6.Head.Attachment.A.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
wait(0.2)
v6.Head.HealthBar.Frame.BackHealth.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
v6.Head.HealthBar.Frame.PName.TextStrokeColor3 = Color3.fromRGB(0, 0, 255)
v6.Scarf.Color = Color3.fromRGB(255, 0, 0)
v6.Head.Attachment.A.Color = ColorSequence.new(Color3.fromRGB(0, 0, 255))
wait(0.2)
end
end
end
end
end)
end)
|
local Event = require('__stdlib__/stdlib/event/event')
local table = require('__stdlib__/stdlib/utils/table')
local function summon_tree_deconstruction_planner(event)
local player = game.players[event.player_index]
local stack = player.cursor_stack
if player.clear_cursor() and stack.set_stack('deconstruction-planner') then
stack.trees_and_rocks_only = true
end
end
Event.register('picker-summon-trees-deconstruction-planner', summon_tree_deconstruction_planner)
local function toggle_filter_mode(event)
local player = game.players[event.player_index]
local stack = player.cursor_stack
local mode = event.input_name == 'picker-toggle-filter-mode' and 'entity_filter_mode' or 'tile_filter_mode'
if stack.valid_for_read and stack.name == 'deconstruction-planner' then
local whitelist = defines.deconstruction_item[mode].whitelist
local blacklist = defines.deconstruction_item[mode].blacklist
if stack[mode] == whitelist then
stack[mode] = blacklist
player.print({'deconstructor.' .. mode .. '-blacklist'})
else
stack[mode] = whitelist
player.print({'deconstructor.' .. mode .. '-whitelist'})
end
end
end
Event.register({'picker-toggle-filter-mode', 'picker-toggle-tile-filter-mode'}, toggle_filter_mode)
local tile_mode = table.invert(defines.deconstruction_item.tile_selection_mode)
local function cycle_tile_mode(event)
local player = game.players[event.player_index]
local stack = player.cursor_stack
if stack.valid_for_read and stack.name == 'deconstruction-planner' then
local next_mode = (stack.tile_selection_mode + 1 < table.size(tile_mode)) and (stack.tile_selection_mode + 1) or 0
stack.tile_selection_mode = next_mode
player.print({'deconstructor.tile-selection-mode', {'deconstructor.' .. tile_mode[next_mode]}})
end
end
Event.register('picker-cycle-tile-selection-mode', cycle_tile_mode)
--Event.register('picker-pick-deconstruction-filter', pick_deconstruction_filter)
-- On keypress With no decon plan mark item for deconstruction,
-- with an item add the item to the white/black list.
local function mark_for_deconstruction(event)
local player = game.get_player(event.player_index)
local selected = player.selected
if selected then
local stack = player.cursor_stack
if stack.is_deconstruction_item then
if not (selected.type == 'resource' or selected.has_flag('not-deconstructable')) then
local name, count = selected.name, stack.entity_filter_count
local first_empty = 0
local p = selected.position
for i = 1, count do
local filter = stack.get_entity_filter(i)
if name == filter then
stack.set_entity_filter(i, nil)
player.create_local_flying_text {text = {'deconstructor.removed', {'entity-name.' .. selected.name}}, position = p}
return
elseif not filter and first_empty == 0 then
first_empty = i
end
end
if first_empty > 0 and stack.set_entity_filter(first_empty, name) then
player.create_local_flying_text {text = {'deconstructor.added', {'entity-name.' .. selected.name}}, position = p}
else
player.create_local_flying_text {text = {'deconstructor.no-empty-slots'}, position = p}
end
end
elseif not stack.valid_for_read then
local force = player.force
if force == selected.force then
if selected.to_be_deconstructed() then
selected.cancel_deconstruction(force, player)
else
selected.order_deconstruction(force, player)
end
end
end
end
end
Event.register('picker-mark-for-deconstruction', mark_for_deconstruction)
|
local ScreenManager = require( 'lib.screenmanager.ScreenManager' );
---
-- This function is called exactly once at the beginning of the game.
--
function love.load()
print( "===================" );
print( string.format( "Title: '%s'", getTitle() ));
print( string.format( "Version: %s", getVersion() ));
print( string.format( "LOVE Version: %d.%d.%d (%s)", love.getVersion() ));
print( string.format( "Resolution: %dx%d", love.graphics.getDimensions() ));
-- Check the user's hardware.
print( "\n---- RENDERER ---- " );
local name, version, vendor, device = love.graphics.getRendererInfo();
print( string.format( "Name: %s \nVersion: %s \nVendor: %s \nDevice: %s", name, version, vendor, device ));
print( "\n---- SYSTEM ---- " );
print( love.system.getOS() );
print( "===================" );
print( os.date( '%c', os.time() ));
print( "===================" );
local screens = {
loading = require( 'src.screens.LoadingScreen' ),
selection = require( 'src.screens.SelectionScreen' ),
main = require( 'src.screens.MainScreen' ),
input = require( 'src.screens.InputPanel' )
};
ScreenManager.init( screens, 'loading' );
end
---
-- Callback function used to draw on the screen every frame.
--
function love.draw()
ScreenManager.draw();
end
---
-- Callback function used to update the state of the game every frame.
-- @param dt (number) Time since the last update in seconds.
--
function love.update( dt )
ScreenManager.update( dt );
end
---
-- Callback function triggered when the game is closed.
--
function love.quit()
ScreenManager.quit();
end
---
-- Called when the window is resized, for example if the user resizes the window, or if
-- love.window.setMode is called with an unsupported width or height in fullscreen and
-- the window chooses the closest appropriate size.
-- @param x (number) The new width, in pixels.
-- @param y (number) The new height, in pixels.
--
function love.resize( x, y )
ScreenManager.resize( x, y );
end
---
-- Callback function triggered when a key is pressed.
-- @param key (KeyConstant) Character of the pressed key.
-- @param scancode (Scancode) The scancode representing the pressed key.
-- @param isrepeat (boolean) Whether this keypress event is a repeat. The delay between
-- key repeats depends on the user's system settings.
--
function love.keypressed( key, scancode, isrepeat )
-- Transform strings to numbers to fit the control values we read from the config file.
if tonumber( key ) then
key = tonumber( key );
end
ScreenManager.keypressed( key, scancode, isrepeat );
end
---
-- Callback function triggered when a mouse button is pressed.
-- @param x (number) Mouse x position, in pixels.
-- @param y (number) Mouse y position, in pixels.
-- @param button (number) The button index that was pressed. 1 is the primary mouse button,
-- 2 is the secondary mouse button and 3 is the middle button. Further
-- buttons are mouse dependent.
-- @param istouch (boolean) True if the mouse button press originated from a touchscreen touch-press.
--
function love.mousepressed( x, y, button, istouch )
ScreenManager.mousepressed( x, y, button, istouch );
end
---
-- Callback function triggered when a mouse button is released.
-- @param x (number) Mouse x position, in pixels.
-- @param y (number) Mouse y position, in pixels.
-- @param button (number) The button index that was pressed. 1 is the primary mouse button,
-- 2 is the secondary mouse button and 3 is the middle button. Further
-- buttons are mouse dependent.
-- @param istouch (boolean) True if the mouse button press originated from a touchscreen touch-release.
--
function love.mousereleased( x, y, button, istouch )
ScreenManager.mousereleased( x, y, button, istouch );
end
---
-- Callback function triggered when the mouse is moved.
-- @param x (number) The mouse position on the x-axis.
-- @param y (number) The mouse position on the y-axis.
-- @param dx (number) The amount moved along the x-axis since the last time love.mousemoved was called.
-- @param dy (number) The amount moved along the y-axis since the last time love.mousemoved was called.
--
function love.mousemoved( x, y, dx, dy )
ScreenManager.mousemoved( x, y, dx, dy );
end
---
-- Callback function triggered when the mouse wheel is moved.
-- @param x (number) Amount of horizontal mouse wheel movement. Positive values indicate movement to the right.
-- @param y (number) Amount of vertical mouse wheel movement. Positive values indicate upward movement.
--
function love.wheelmoved( x, y )
ScreenManager.wheelmoved( x, y );
end
---
-- Callback function triggered when a directory is dragged and dropped onto the window.
-- @param path (string) The full platform-dependent path to the directory. It can be used as an argument to
-- love.filesystem.mount, in order to gain read access to the directory with love.filesystem.
--
function love.directorydropped( path )
ScreenManager.directorydropped( path );
end
---
-- Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard
-- layout, the text "@" will be generated.
-- @param text (string) The UTF-8 encoded unicode text.
--
function love.textinput( text )
ScreenManager.textinput( text );
end
|
--[[----------------------------------------------------------------------------
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
------------------------------------------------------------------------------]]
local utils = paths.dofile'utils.lua'
local ImageDetect = torch.class('fbcoco.ImageDetect')
function ImageDetect:__init(model, transformer, scale, max_size)
assert(model, 'must provide model!')
assert(transformer, 'must provide transformer!')
self.model = model
self.image_transformer = transformer
self.scale = scale or {600}
self.max_size = max_size or 1000
self.sm = nn.SoftMax():cuda()
end
local function getImages(self,images,im)
local num_scales = #self.scale
local imgs = {}
local im_sizes = {}
local im_scales = {}
im = self.image_transformer:forward(im)
local im_size = im[1]:size()
local im_size_min = math.min(im_size[1],im_size[2])
local im_size_max = math.max(im_size[1],im_size[2])
for i=1,num_scales do
local im_scale = self.scale[i]/im_size_min
if torch.round(im_scale*im_size_max) > self.max_size then
im_scale = self.max_size/im_size_max
end
local im_s = {im_size[1]*im_scale,im_size[2]*im_scale}
table.insert(imgs,image.scale(im,im_s[2],im_s[1]))
table.insert(im_sizes,im_s)
table.insert(im_scales,im_scale)
end
-- create single tensor with all images, padding with zero for different sizes
im_sizes = torch.IntTensor(im_sizes)
local max_shape = im_sizes:max(1)[1]
images:resize(num_scales,3,max_shape[1],max_shape[2]):zero()
for i=1,num_scales do
images[i][{{},{1,imgs[i]:size(2)},{1,imgs[i]:size(3)}}]:copy(imgs[i])
end
return im_scales
end
local function project_im_rois(im_rois,scales)
local levels
local rois = torch.FloatTensor()
if #scales > 1 then
local scales = torch.FloatTensor(scales)
local widths = im_rois[{{},3}] - im_rois[{{},1}] + 1
local heights = im_rois[{{},4}] - im_rois[{{}, 2}] + 1
local areas = widths * heights
local scaled_areas = areas:view(-1,1) * torch.pow(scales:view(1,-1),2)
local diff_areas = torch.abs(scaled_areas - 224 * 224)
levels = select(2, diff_areas:min(2))
else
levels = torch.FloatTensor()
rois:resize(im_rois:size(1),5)
rois[{{},1}]:fill(1)
rois[{{},{2,5}}]:copy(im_rois):add(-1):mul(scales[1]):add(1)
end
return rois
end
local function recursiveSplit(x, bs, dim)
if type(x) == 'table' then
local res = {}
for k,v in pairs(x) do
local tmp = v:split(bs,dim)
for i=1,#tmp do
if not res[i] then res[i] = {} end
res[i][k] = tmp[i]
end
end
return res
else
return x:split(bs, dim)
end
end
function ImageDetect:memoryEfficientForward(model, input, bs, recompute_features)
local images = input[1]
local rois = input[2]
local recompute_features = recompute_features == nil and true or recompute_features
assert(model.output[1]:numel() > 0)
local rest = nn.Sequential()
for i=2,#model.modules do rest:add(model:get(i)) end
local final = model:get(#model.modules)
-- assuming the net has bbox regression part
self.output = self.output or {torch.CudaTensor(), torch.CudaTensor()}
local num_classes = self.model.output[1]:size(2)
self.output[1]:resize(rois:size(1), num_classes)
self.output[2]:resize(rois:size(1), num_classes * 4)
if recompute_features then
model:get(1):forward{images,rois}
else
model:get(1).output[2] = rois
end
local features = model:get(1).output
assert(features[2]:size(1) == rois:size(1))
local roi_split = features[2]:split(bs,1)
local output1_split = self.output[1]:split(bs,1)
local output2_split = self.output[2]:split(bs,1)
for i,v in ipairs(roi_split) do
local out = rest:forward({features[1], v})
output1_split[i]:copy(out[1])
output2_split[i]:copy(out[2])
end
local function test()
local output_full = model:forward({images,rois})
local output_split = self.output
assert((output_full[1] - output_split[1]):abs():max() == 0)
assert((output_full[2] - output_split[2]):abs():max() == 0)
end
--test()
return self.output
end
function ImageDetect:computeRawOutputs(im, boxes, min_images, recompute_features)
self.model:evaluate()
local inputs = {torch.FloatTensor(),torch.FloatTensor()}
local im_scales = getImages(self,inputs[1],im)
inputs[2] = project_im_rois(boxes,im_scales)
if min_images then
assert(inputs[1]:size(1) == 1)
inputs[1] = inputs[1]:expand(min_images, inputs[1]:size(2), inputs[1]:size(3), inputs[1]:size(4))
end
self.inputs_cuda = self.inputs_cuda or {torch.CudaTensor(),torch.CudaTensor()}
self.inputs_cuda[1]:resize(inputs[1]:size()):copy(inputs[1])
self.inputs_cuda[2]:resize(inputs[2]:size()):copy(inputs[2])
return self.model:forward(self.inputs_cuda)
end
-- supposes boxes is in [x1,y1,x2,y2] format
function ImageDetect:detect(im, boxes, min_images, recompute_features)
self.model:evaluate()
local inputs = {torch.FloatTensor(),torch.FloatTensor()}
local im_scales = getImages(self,inputs[1],im)
-- boxes are not changed from the prop file up to here (except the xy order)
inputs[2] = project_im_rois(boxes,im_scales)
if min_images then
assert(inputs[1]:size(1) == 1)
inputs[1] = inputs[1]:expand(min_images, inputs[1]:size(2), inputs[1]:size(3), inputs[1]:size(4))
end
self.inputs_cuda = self.inputs_cuda or {torch.CudaTensor(),torch.CudaTensor()}
self.inputs_cuda[1]:resize(inputs[1]:size()):copy(inputs[1])
self.inputs_cuda[2]:resize(inputs[2]:size()):copy(inputs[2])
local output0
if opt and opt.disable_memory_efficient_forward then
print('memory efficient forward disabled')
output0 = self.model:forward(self.inputs_cuda)
else
output0 = self:memoryEfficientForward(self.model, self.inputs_cuda, 500, recompute_features)
end
local class_values, bbox_values
if torch.type(output0) == 'table' then
class_values= output0[1]
bbox_values = output0[2]:float()
for i,v in ipairs(bbox_values:split(4,2)) do
utils.convertFrom(v,boxes,v)
end
else
class_values = output0
end
if not self.model.noSoftMax then
class_values = self.sm:forward(class_values)
end
return class_values:float(), bbox_values
end
|
Player = class('Player')
function Player:initialize(playerNum, x, y, width, height)
self.playerNumber = playerNum or 0
self.x = x or math.random(love.graphics.getWidth())
self.y = y or math.random(love.graphics.getHeight())
self.width = width or math.random(30, 70)
self.height = height or math.random(30, 70)
self.vx = 0
self.vy = 0
self.speed = .1
self.damping = 1
end
function Player:update(dt)
--self.x = self.x + self.vx * dt
--self.y = self.y + self.vy * dt
--self.vx = self.vx * self.damping
--self.vy = self.vy * self.damping
end
function Player:updateValues(x, y, width, height)
self.x = x or self.x
self.y = y or self.y
end
function Player:move(dx, dy)
dx = dx or 0
dy = dy or 0
--dx = dx * self.speed
--dy = dy * self.speed
--self.vx = self.vx + dx
--self.vy = self.vy + dy
self.x = self.x + dx
self.y = self.y + dy
end
function Player:draw()
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height)
end
function Player:getValues()
return self.playerNumber, self.x, self.y, self.width, self.height
end
function Player:isChanged()
return true
end
|
--[[/*
* (C) 2012-2013 Marmalade.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/--]]
--------------------------------------------------------------------------------
-- Color
-- NOTE: This file must have no dependencies on the ones loaded after it by
-- openquick_init.lua. For example, it must have no dependencies on QDirector.lua
--------------------------------------------------------------------------------
color = {}
-- Color constants
-- The full list of CSS3 color constants are supported: http://www.w3.org/TR/css3-color/
-- Names are amended to camelCase capitalisation
color.aliceBlue = quick.QColor:new(0xF0,0xF8,0xFF)
color.antiqueWhite = quick.QColor:new(0xFA,0xEB,0xD7)
color.aqua = quick.QColor:new(0x00,0xFF,0xFF)
color.aquamarine = quick.QColor:new(0x7F,0xFF,0xD4)
color.azure = quick.QColor:new(0xF0,0xFF,0xFF)
color.beige = quick.QColor:new(0xF5,0xF5,0xDC)
color.bisque = quick.QColor:new(0xFF,0xE4,0xC4)
color.black = quick.QColor:new(0x00,0x00,0x00)
color.blanchedAlmond = quick.QColor:new(0xFF,0xEB,0xCD)
color.blue = quick.QColor:new(0x00,0x00,0xFF)
color.blueViolet = quick.QColor:new(0x8A,0x2B,0xE2)
color.brown = quick.QColor:new(0xA5,0x2A,0x2A)
color.burlyWood = quick.QColor:new(0xDE,0xB8,0x87)
color.cadetBlue = quick.QColor:new(0x5F,0x9E,0xA0)
color.chartreuse = quick.QColor:new(0x7F,0xFF,0x00)
color.chocolate = quick.QColor:new(0xD2,0x69,0x1E)
color.coral = quick.QColor:new(0xFF,0x7F,0x50)
color.cornflowerBlue = quick.QColor:new(0x64,0x95,0xED)
color.cornsilk = quick.QColor:new(0xFF,0xF8,0xDC)
color.crimson = quick.QColor:new(0xDC,0x14,0x3C)
color.cyan = quick.QColor:new(0x00,0xFF,0xFF)
color.darkBlue = quick.QColor:new(0x00,0x00,0x8B)
color.darkCyan = quick.QColor:new(0x00,0x8B,0x8B)
color.darkGoldenRod = quick.QColor:new(0xB8,0x86,0x0B)
color.darkGray = quick.QColor:new(0xA9,0xA9,0xA9)
color.darkGrey = quick.QColor:new(0xA9,0xA9,0xA9)
color.darkGreen = quick.QColor:new(0x00,0x64,0x00)
color.darkKhaki = quick.QColor:new(0xBD,0xB7,0x6B)
color.darkMagenta = quick.QColor:new(0x8B,0x00,0x8B)
color.darkOliveGreen = quick.QColor:new(0x55,0x6B,0x2F)
color.darkorange = quick.QColor:new(0xFF,0x8C,0x00)
color.darkOrchid = quick.QColor:new(0x99,0x32,0xCC)
color.darkRed = quick.QColor:new(0x8B,0x00,0x00)
color.darkSalmon = quick.QColor:new(0xE9,0x96,0x7A)
color.darkSeaGreen = quick.QColor:new(0x8F,0xBC,0x8F)
color.darkSlateBlue = quick.QColor:new(0x48,0x3D,0x8B)
color.darkSlateGray = quick.QColor:new(0x2F,0x4F,0x4F)
color.darkSlateGrey = quick.QColor:new(0x2F,0x4F,0x4F)
color.darkTurquoise = quick.QColor:new(0x00,0xCE,0xD1)
color.darkViolet = quick.QColor:new(0x94,0x00,0xD3)
color.deepPink = quick.QColor:new(0xFF,0x14,0x93)
color.deepSkyBlue = quick.QColor:new(0x00,0xBF,0xFF)
color.dimGray = quick.QColor:new(0x69,0x69,0x69)
color.dimGrey = quick.QColor:new(0x69,0x69,0x69)
color.dodgerBlue = quick.QColor:new(0x1E,0x90,0xFF)
color.fireBrick = quick.QColor:new(0xB2,0x22,0x22)
color.floralWhite = quick.QColor:new(0xFF,0xFA,0xF0)
color.forestGreen = quick.QColor:new(0x22,0x8B,0x22)
color.fuchsia = quick.QColor:new(0xFF,0x00,0xFF)
color.gainsboro = quick.QColor:new(0xDC,0xDC,0xDC)
color.ghostWhite = quick.QColor:new(0xF8,0xF8,0xFF)
color.gold = quick.QColor:new(0xFF,0xD7,0x00)
color.goldenRod = quick.QColor:new(0xDA,0xA5,0x20)
color.gray = quick.QColor:new(0x80,0x80,0x80)
color.grey = quick.QColor:new(0x80,0x80,0x80)
color.green = quick.QColor:new(0x00,0xFF,0x00)
color.greenYellow = quick.QColor:new(0xAD,0xFF,0x2F)
color.honeyDew = quick.QColor:new(0xF0,0xFF,0xF0)
color.hotPink = quick.QColor:new(0xFF,0x69,0xB4)
color.indianRed = quick.QColor:new(0xCD,0x5C,0x5C)
color.indigo = quick.QColor:new(0x4B,0x00,0x82)
color.ivory = quick.QColor:new(0xFF,0xFF,0xF0)
color.khaki = quick.QColor:new(0xF0,0xE6,0x8C)
color.lavender = quick.QColor:new(0xE6,0xE6,0xFA)
color.lavenderBlush = quick.QColor:new(0xFF,0xF0,0xF5)
color.lawnGreen = quick.QColor:new(0x7C,0xFC,0x00)
color.lemonChiffon = quick.QColor:new(0xFF,0xFA,0xCD)
color.lightBlue = quick.QColor:new(0xAD,0xD8,0xE6)
color.lightCoral = quick.QColor:new(0xF0,0x80,0x80)
color.lightCyan = quick.QColor:new(0xE0,0xFF,0xFF)
color.lightGoldenRodYellow= quick.QColor:new(0xFA,0xFA,0xD2)
color.lightGray = quick.QColor:new(0xD3,0xD3,0xD3)
color.lightGrey = quick.QColor:new(0xD3,0xD3,0xD3)
color.lightGreen = quick.QColor:new(0x90,0xEE,0x90)
color.lightPink = quick.QColor:new(0xFF,0xB6,0xC1)
color.lightSalmon = quick.QColor:new(0xFF,0xA0,0x7A)
color.lightSeaGreen = quick.QColor:new(0x20,0xB2,0xAA)
color.lightSkyBlue = quick.QColor:new(0x87,0xCE,0xFA)
color.lightSlateGray = quick.QColor:new(0x77,0x88,0x99)
color.lightSlateGrey = quick.QColor:new(0x77,0x88,0x99)
color.lightSteelBlue = quick.QColor:new(0xB0,0xC4,0xDE)
color.lightYellow = quick.QColor:new(0xFF,0xFF,0xE0)
color.lime = quick.QColor:new(0x00,0xFF,0x00)
color.limeGreen = quick.QColor:new(0x32,0xCD,0x32)
color.linen = quick.QColor:new(0xFA,0xF0,0xE6)
color.magenta = quick.QColor:new(0xFF,0x00,0xFF)
color.maroon = quick.QColor:new(0x80,0x00,0x00)
color.mediumAquaMarine = quick.QColor:new(0x66,0xCD,0xAA)
color.mediumBlue = quick.QColor:new(0x00,0x00,0xCD)
color.mediumOrchid = quick.QColor:new(0xBA,0x55,0xD3)
color.mediumPurple = quick.QColor:new(0x93,0x70,0xD8)
color.mediumSeaGreen = quick.QColor:new(0x3C,0xB3,0x71)
color.mediumSlateBlue = quick.QColor:new(0x7B,0x68,0xEE)
color.mediumSpringGreen = quick.QColor:new(0x00,0xFA,0x9A)
color.mediumTurquoise = quick.QColor:new(0x48,0xD1,0xCC)
color.mediumVioletRed = quick.QColor:new(0xC7,0x15,0x85)
color.midnightBlue = quick.QColor:new(0x19,0x19,0x70)
color.mintCream = quick.QColor:new(0xF5,0xFF,0xFA)
color.mistyRose = quick.QColor:new(0xFF,0xE4,0xE1)
color.moccasin = quick.QColor:new(0xFF,0xE4,0xB5)
color.navajoWhite = quick.QColor:new(0xFF,0xDE,0xAD)
color.navy = quick.QColor:new(0x00,0x00,0x80)
color.oldLace = quick.QColor:new(0xFD,0xF5,0xE6)
color.olive = quick.QColor:new(0x80,0x80,0x00)
color.oliveDrab = quick.QColor:new(0x6B,0x8E,0x23)
color.orange = quick.QColor:new(0xFF,0xA5,0x00)
color.orangeRed = quick.QColor:new(0xFF,0x45,0x00)
color.orchid = quick.QColor:new(0xDA,0x70,0xD6)
color.paleGoldenRod = quick.QColor:new(0xEE,0xE8,0xAA)
color.paleGreen = quick.QColor:new(0x98,0xFB,0x98)
color.paleTurquoise = quick.QColor:new(0xAF,0xEE,0xEE)
color.paleVioletRed = quick.QColor:new(0xD8,0x70,0x93)
color.papayaWhip = quick.QColor:new(0xFF,0xEF,0xD5)
color.peachPuff = quick.QColor:new(0xFF,0xDA,0xB9)
color.peru = quick.QColor:new(0xCD,0x85,0x3F)
color.pink = quick.QColor:new(0xFF,0xC0,0xCB)
color.plum = quick.QColor:new(0xDD,0xA0,0xDD)
color.powderBlue = quick.QColor:new(0xB0,0xE0,0xE6)
color.purple = quick.QColor:new(0x80,0x00,0x80)
color.red = quick.QColor:new(0xFF,0x00,0x00)
color.rosyBrown = quick.QColor:new(0xBC,0x8F,0x8F)
color.royalBlue = quick.QColor:new(0x41,0x69,0xE1)
color.saddleBrown = quick.QColor:new(0x8B,0x45,0x13)
color.salmon = quick.QColor:new(0xFA,0x80,0x72)
color.sandyBrown = quick.QColor:new(0xF4,0xA4,0x60)
color.seaGreen = quick.QColor:new(0x2E,0x8B,0x57)
color.seaShell = quick.QColor:new(0xFF,0xF5,0xEE)
color.sienna = quick.QColor:new(0xA0,0x52,0x2D)
color.silver = quick.QColor:new(0xC0,0xC0,0xC0)
color.skyBlue = quick.QColor:new(0x87,0xCE,0xEB)
color.slateBlue = quick.QColor:new(0x6A,0x5A,0xCD)
color.slateGray = quick.QColor:new(0x70,0x80,0x90)
color.slateGrey = quick.QColor:new(0x70,0x80,0x90)
color.snow = quick.QColor:new(0xFF,0xFA,0xFA)
color.springGreen = quick.QColor:new(0x00,0xFF,0x7F)
color.steelBlue = quick.QColor:new(0x46,0x82,0xB4)
color.tan = quick.QColor:new(0xD2,0xB4,0x8C)
color.teal = quick.QColor:new(0x00,0x80,0x80)
color.thistle = quick.QColor:new(0xD8,0xBF,0xD8)
color.tomato = quick.QColor:new(0xFF,0x63,0x47)
color.turquoise = quick.QColor:new(0x40,0xE0,0xD0)
color.violet = quick.QColor:new(0xEE,0x82,0xEE)
color.wheat = quick.QColor:new(0xF5,0xDE,0xB3)
color.white = quick.QColor:new(0xFF,0xFF,0xFF)
color.whiteSmoke = quick.QColor:new(0xF5,0xF5,0xF5)
color.yellow = quick.QColor:new(0xFF,0xFF,0x00)
color.yellowGreen = quick.QColor:new(0x9A,0xCD,0x32)
|
--***********************************************************
--** THE INDIE STONE **
--** Author: turbotutone **
--***********************************************************
require "ISUI/ISPanel"
---@class ISBatteryStatusDisplay : ISPanel
ISBatteryStatusDisplay = ISPanel:derive("ISBatteryStatusDisplay");
function ISBatteryStatusDisplay:initialise()
ISPanel.initialise(self)
end
function ISBatteryStatusDisplay:createChildren()
if self.doLed then
self.led = ISLedLight:new (10, (self.height-10)/2, 10, 10);
self.led:initialise();
self.led:getLedIsOn(false);
self:addChild(self.led);
end
end
function ISBatteryStatusDisplay:round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function ISBatteryStatusDisplay:setPower( _power )
if _power > 1.0 then _power = 1.0; end
if _power < 0.0 then _power = 0.0; end
self.power = _power;
self.powerInt = self:round(100*_power, 0);
self.powerDisp = tostring(self.powerInt).."%";
end
function ISBatteryStatusDisplay:update()
ISPanel.update(self);
if self.power > 0 and self.power < 0.25 then
self.led:setIsBlinking( true );
else
self.led:setIsBlinking( false );
end
end
function ISBatteryStatusDisplay:prerender()
ISPanel.prerender(self);
end
function ISBatteryStatusDisplay:render()
ISPanel.render(self);
local offx = 0;
if self.doLed then
offx = self.led:getX() + self.led:getWidth();
end
local headW = (self:getWidth()-(offx+5))*0.02;
if headW<2 then headW = 2; end
local x,y,w,h = offx+5, 0, self:getWidth()-(offx+5+headW), self:getHeight();
local c = self.borderColor;
self:drawTextureScaled(self.backTexture, x, y, w, h, 0.7, 1.0, 1.0, 1.0);
self:drawRect(x+(w*self.power), y, w-(w*self.power), h, 0.7, 0.0, 0.0, 0.0);
self:drawRectBorder(x, y, w, h, c.a, c.r, c.g, c.b);
self:drawTextCentre(self.powerDisp, x+(w/2)-1, y+((h/2)-(self.powerDispH/2))-1, 0.0, 0.0, 0.0, 1.0, UIFont.Small);
self:drawTextCentre(self.powerDisp, x+(w/2)+1, y+((h/2)-(self.powerDispH/2))+1, 0.0, 0.0, 0.0, 1.0, UIFont.Small);
self:drawTextCentre(self.powerDisp, x+(w/2)-1, y+((h/2)-(self.powerDispH/2))+1, 0.0, 0.0, 0.0, 1.0, UIFont.Small);
self:drawTextCentre(self.powerDisp, x+(w/2)+1, y+((h/2)-(self.powerDispH/2))-1, 0.0, 0.0, 0.0, 1.0, UIFont.Small);
self:drawTextCentre(self.powerDisp, x+(w/2), y+((h/2)-(self.powerDispH/2)), 1.0, 1.0, 1.0, 1.0, UIFont.Small);
self:drawRect(x+w, y+(h*0.25), headW, h*0.5, c.a, c.r, c.g, c.b);
end
function ISBatteryStatusDisplay:new (x, y, width, height, addAlertLed)
local o = ISPanel:new(x, y, width, height);
setmetatable(o, self)
self.__index = self
o.x = x;
o.y = y;
o.background = false;
o.backgroundColor = {r=0, g=0, b=0, a=0.0};
o.borderColor = {r=0.8, g=0.8, b=0.8, a=1};
o.width = width;
o.height = height;
o.anchorLeft = true;
o.anchorRight = false;
o.anchorTop = true;
o.anchorBottom = false;
o.fontheight = getTextManager():MeasureStringY(UIFont.Small, "AbdfghijklpqtyZ")+2;
o.doLed = addAlertLed;
o.backTexture = getTexture("Radio_ConditionGradient");
o.power = 0.6;
o.powerInt = 60;
o.powerDisp = "60%";
o.powerDispH = getTextManager():MeasureStringY(UIFont.Small, "60%");
return o
end
|
loadstring(Raindrop:DownloadString('http://pastebin.com/raw/YzSc8DG7'))()
--Thanks for using this :)
|
local _, Addon = ...; -- Namespace
Addon.Command = {};
local Util = Addon.Util;
local Command = Addon.Command;
--------------------------------------
-- Commands
--------------------------------------
Command.list = {
[ "module" ] = Addon.ModuleManager.Toggle,
[ "list" ] = Addon.ModuleManager.PrintList,
[ "config" ] = Addon.Config.HandleConfigCommand
};
----------------------------------
-- Logic
----------------------------------
function Command:Init()
-- shorthand for reloading UI
SLASH_RELOADUI1 = "/rl";
SlashCmdList.RELOADUI = ReloadUI;
-- command for showing framestack tool
SLASH_FRAMESTK1 = "/fs";
SlashCmdList.FRAMESTK = function()
LoadAddOn("Blizzard_DebugTools");
FrameStackTooltip_Toggle();
end
-- addon root command
SLASH_Athenaeum1 = "/at";
SlashCmdList.Athenaeum = HandleCommand;
end
function HandleCommand(str)
if (#str == 0) then
-- User just entered "/at" with no additional args.
Util:Print("Command " .. Util:Colorize("/at", Util.Colors.command) .. " without any arguments is not valid.");
return;
end
local args = {};
for _, arg in ipairs({ string.split(' ', str) }) do
if (#arg > 0) then
table.insert(args, arg);
end
end
local path = Command.list; -- required for updating found table.
for id, arg in ipairs(args) do
if (#arg > 0) then -- if string length is greater than 0.
arg = arg:lower();
if (path[arg]) then
if (type(path[arg]) == "function") then
-- all remaining args passed to our function!
path[arg](select(id, unpack(args)));
return;
elseif (type(path[arg]) == "table") then
path = path[arg]; -- another sub-table found!
end
else
Util:Print("Command " .. Util:Colorize("/at " .. str, Util.Colors.command) .. " does not exist.");
return; -- does not exist!
end
end
end
end
|
local entity = {}
entity["level"] = [[32]]
entity["spellDeck"] = {}
entity["spellDeck"][1] = [[Mahama]]
entity["spellDeck"][2] = [[]]
entity["spellDeck"][3] = [[Infuriate]]
entity["spellDeck"][4] = [[]]
entity["spellDeck"][5] = [[]]
entity["spellDeck"][6] = [[]]
entity["heritage"] = {}
entity["heritage"][1] = [[Light]]
entity["heritage"][2] = [[]]
entity["resistance"] = {}
entity["resistance"][1] = [[Normal]]
entity["resistance"][2] = [[Normal]]
entity["resistance"][3] = [[Normal]]
entity["resistance"][4] = [[Normal]]
entity["resistance"][5] = [[Normal]]
entity["resistance"][6] = [[Strong]]
entity["resistance"][7] = [[Normal]]
entity["resistance"][8] = [[Null]]
entity["resistance"][9] = [[Weak]]
entity["desc"] = [[In the Christian hierarchy of angels, Virtues are part of the second sphere and watch over the movement of the heavenly bodies so that order is maintained. They are also said to be the fifth rank of angel (possibly referring to Maimonides' hierarchy, where they would be equivalent to the Jewish definition of Seraphim), and apparently are responsible for the distribution of miracles. ]]
entity["arcana"] = [[Justice]]
entity["stats"] = {}
entity["stats"][1] = [[22]]
entity["stats"][2] = [[23]]
entity["stats"][3] = [[15]]
entity["stats"][4] = [[20]]
entity["stats"][5] = [[23]]
entity["name"] = [[Virtue]]
entity["spellLearn"] = {}
entity["spellLearn"]["Hamaon"] = [[36]]
entity["spellLearn"]["Rage Boost"] = [[37]]
entity["spellLearn"]["Endure Dark"] = [[39]]
entity["spellLearn"]["Survive Dark"] = [[34]]
return entity
|
endor_gorax_neutral_none = Lair:new {
mobiles = {{"gorax",1},{"minor_gorax",2}},
spawnLimit = 3,
buildingsVeryEasy = {},
buildingsEasy = {},
buildingsMedium = {},
buildingsHard = {},
buildingsVeryHard = {},
buildingType = "none",
}
addLairTemplate("endor_gorax_neutral_none", endor_gorax_neutral_none)
|
--
-- Addon _mimi_minimapbutton.lua
-- Author marcob@marcob.org
-- StartDate 09/09/2017
--
local addon, mimi = ...
function mimi.showhidewindow(visible)
local outofdb = {}
if not mimi.gui.winobj then
mimi.vars.missing, mimi.vars.collected, mimi.vars.outofdbno, outofdb = mimi.searchformissing()
print(string.format("MiMi Collected: %s, Missing: %s OutofDb: %s", mimi.vars.collected, mimi.vars.missing, mimi.vars.outofdbno))
if mimi.vars.outofdbno > 0 then
local a, b = nil, nil
for a,b in ipairs(outofdb) do
print(string.format("MiMi Out Of DB: %s: %s", a, b))
end
end
visible = true
end
if visible then
mimi.gui.visible = true
else
mimi.gui.visible = (not mimi.gui.winobj:GetVisible())
end
mimi.gui.winobj:SetVisible(mimi.gui.visible)
if mimi.gui.missing then mimi.gui.missing:SetText(tostring(mimi.vars.missing)) end
if mimi.gui.collected then mimi.gui.collected:SetText(tostring(mimi.vars.collected)) end
return
end
function mimi.createminimapbutton()
-- avoid creating multiple minimap buttons...
if not mimi.gui.mmbtnobj then
-- print(string.format("mimi.createMiniMapButton: mimi.gui.mmbtnobj=%s", mimi.gui.mmbtnobj))
--Global context (parent frame-thing).
mmbtncontext = UI.CreateContext("button_context")
-- MiniMapButton Icon
mmbutton = UI.CreateFrame("Texture", "mimi_mmBtnIcon", mmbtncontext)
-- mmbutton:SetTexture("Rift", "Minion_I15B.dds")
mmbutton:SetTexture("Rift", "Icon_Dominion_sm.png.dds")
mmbutton:SetLayer(2)
mmbutton:SetHeight(mimi.gui.mmbtnheight)
mmbutton:SetWidth(mimi.gui.mmbtnwidth)
mmbutton:EventAttach(Event.UI.Input.Mouse.Left.Click, function() mimi.showhidewindow() end, "Show/Hide Pressed" )
if mimi.gui.mmbtnx == nil or mimi.gui.mmbtny == nil then
-- first run, we position in the screen center
mmbutton:SetPoint("CENTER", UIParent, "CENTER")
else
-- we have coordinates
mmbutton:SetPoint("TOPLEFT", UIParent, "TOPLEFT", mimi.gui.mmbtnx, mimi.gui.mmbtny)
end
mimi.gui.mmbtnobj = mmbutton
-- say "Hello World"
Command.Console.Display("general", true, string.format("%s - v.%s", mimi.html.title, mimi.version), true)
else
mmbutton = mimi.gui.mmbtnobj
end
Library.LibDraggable.draggify(mimi.gui.mmbtnobj, mimi.updateguicoordinates)
return mmbutton
end
|
style =
{["off_color"] = "fff",
["on_color"] = "fff",
["line_color"] = "000",
["line_width"] = "0.5"};
yelow_style = {["off_color"] = "ff0",
["on_color"] = "ff0",
["line_color"] = "000",
["line_width"] = "2"};
green_style = {["off_color"] = "6f6",
["on_color"] = "6f6",
["line_color"] = "000",
["line_width"] = "2"};
blue_style = {["off_color"] = "0cf",
["on_color"] = "0cf",
["line_color"] = "000",
["line_width"] = "2"};
orange_style = {["off_color"] = "f90",
["on_color"] = "f90",
["line_color"] = "000",
["line_width"] = "2"};
red_style = {["off_color"] = "f30",
["on_color"] = "f30",
["line_color"] = "000",
["line_width"] = "2"};
violet_style = {["off_color"] = "f9c",
["on_color"] = "f9s",
["line_color"] = "000",
["line_width"] = "2"};
text_style = {["font_size"] = "16"}
mycanvas = function()
lib.start_canvas(380, 250, "center", results)
w = 20
ow = 15
for i = 1,11 do
lib.add_line(ow, ow+(i-1)*w, 14*w, 0, style, false, false)
end
for i = 1,15 do
lib.add_line(ow+(i-1)*w, ow, 0, 10*w, style, false, false)
end
lib.add_rectangle (ow+7*w, ow+6*w, 2*w, 3*w, violet_style, false, true)
lib.add_input(ow+7*w+5, ow+7*w, 30, 30, lib.check_number(10,15))
lib.add_rectangle (ow+w, ow+7*w, 2*w, 2*w, orange_style, false, true)
lib.add_input(ow+w+5, ow+7*w+10, 30, 30, lib.check_number(8,15))
lib.add_rectangle (ow+w, ow+2*w, 4*w, 4*w, green_style, false, true)
lib.add_text(3*w+ow, 4*w+ow, "16", text_style, false, false)
lib.add_rectangle (ow+7*w, ow+3*w, 2*w, w, yelow_style, false, true)
lib.add_input(ow+7*w+5, ow+3*w-3, 30, 30, lib.check_number(6,15))
lib.add_rectangle (ow+6*w, ow+w, 7*w, w, red_style, false, true)
lib.add_input(ow+9*w-5, ow+w-3, 30, 30, lib.check_number(16,15))
lib.add_rectangle (ow+11*w, ow+3*w, 2*w, 4*w, blue_style, false, true)
lib.add_input(ow+11*w+5, ow+4*w+10, 30, 30, lib.check_number(12,15))
lib.end_canvas()
end
|
ITEM.name = "P99"
ITEM.description = "A German handgun, firing the 9x19mm cartridge."
ITEM.model = "models/weapons/ethereal/w_p99.mdl"
ITEM.class = "cw_kk_ins2_p99"
ITEM.weaponCategory = "secondary"
ITEM.width = 2
ITEM.height = 1
ITEM.price = 3400
ITEM.weight = 2
|
include("terms")
factor = math.random(10);
name = array_decname[factor]
index = math.random(4)
izbor = array_izbor[index]
if (index == 1) then
value = (factor-1) * 10+2
end
if (index == 2) then
value = factor * 10
end
if (index == 3) then
value = (factor-1) * 10 + 1
end
if (index == 4) then
value = (factor-1) * 10 + 9
end
|
local loadedMap = false
addEvent ( "saveloadtest_return",true )
function openResource ( resourceName )
triggerServerEvent ( "openResource", getLocalPlayer(), resourceName )
end
addEventHandler ( "saveloadtest_return", getRootElement(),
function ( command, returnValue, returnValue2, reason )
reason = reason or ""
if ( command ) == "open" then
if ( returnValue ) then
for k,vehicle in ipairs(getElementsByType"vehicle") do
makeVehicleStatic(vehicle)
end
loadedMap = returnValue
editor_gui.closeLoadDialog()
else
editor_gui.guiShowMessageBox ( "Map resource could not be started!", "error", "Error", true )
end
elseif ( command ) == "save" then
if ( returnValue ) then
loadedMap = returnValue2
editor_gui.closeSaveDialog()
else
editor_gui.guiShowMessageBox ( "Map resource could not be saved! "..reason, "error", "Error", true )
editor_gui.restoreSaveDialog()
end
elseif ( command ) == "quickSave" then
reason = reason or "The target resource may be in .zip format or corrupted."
editor_gui.guiShowMessageBox ( "Map resource could not be saved! "..reason, "error", "Error", true )
editor_gui.restoreSaveDialog()
elseif ( command ) == "test" then
reason = reason or ""
editor_gui.guiShowMessageBox ( "Test could not be started! "..reason, "error", "Error", true )
editor_gui.stopTest()
end
end
)
function saveResource ( resourceName )
triggerServerEvent ( "saveResource", getLocalPlayer(), resourceName )
end
function newResource ()
triggerServerEvent("newResource",getLocalPlayer())
end
|
--[[
Module\Templates\3DPortrait.lua
Provide 3D protrait templates for others to use
Terry@bf
2010 - 9 - 30
]]
local T = LibStub("AceAddon-3.0"):GetAddon("TUnitFrame")
if not T then return end
T.Templates = T.Templates or {}
AceOO = AceLibrary("AceOO-2.0")
if not AceOO then return end
local PortraitClass = AceOO.Class()
local function __InitPorTrait(self)
local __unit = string.gsub(string.gsub(self:GetName(), "TUF3DPortraitFrame", ""), "Model", "");
self.__models_unit =string.lower(__unit);
self:SetUnit(self.__models_unit);
end
--- scripts for template
function TUF3DPortrait_OnLoad(self)
__InitPorTrait(self)
end
function TUF3DPortrait_OnEvent(self, __event, ...)
if (UnitIsVisible(self.__models_unit)) then
self:GetParent():Show();
self:ClearModel()
self:SetUnit(self.__models_unit);
-- self:RefreshUnit();
local pos1, pos2, pos3 = self:GetCameraPosition()
self:SetCamera(0);
if pos1 and pos2 and pos3 then
local _pos1, _pos2, _pos3 = self:GetCameraPosition()
if pos1 == _pos1 and pos2 == _pos2 and pos3 == _pos3 then
self:SetCamera(1);
end
end
if self.oriPortrait and self.oriPortrait.Hide then
self.oriPortrait:Hide();
end
else
self:GetParent():Hide();
if self.oriPortrait and self.oriPortrait.Show then
self.oriPortrait:Show();
end
end
end
function TUF3DPortrait_OnUpdate(self, arg1)
end
--- setup 3d portrait variables
function PortraitClass.prototype:Create(suffix,parentFrame,oldPortrait)
self.parent = parentFrame
self.portrait =_G["TUF3DPortraitFrame"..suffix] or
CreateFrame("Frame",
"TUF3DPortraitFrame"..suffix,
parentFrame,
"TUF_3DPortraitFrameTemplate")
self.model = _G[self.portrait:GetName().."Model"]
self.eventFunc = self.model:GetScript("OnEvent")
self.model.oriPortrait = oldPortrait
end
-- set point for the portrait
function PortraitClass.prototype:SetPoint(...)
self.portrait:SetPoint(...);
end
function PortraitClass.prototype:SetScale(...)
self.portrait:SetScale(...);
end
--- enable 3d portrait and hide 2d portrait
function PortraitClass.prototype:Enable()
self.model:RegisterEvent("UNIT_MODEL_CHANGED")
self.model:RegisterEvent("PLAYER_TARGET_CHANGED")
self.model:RegisterEvent("UNIT_PORTRAIT_UPDATE")
self.model:RegisterEvent("GROUP_ROSTER_UPDATE")
self.portrait:Show()
self.portrait:SetFrameStrata("BACKGROUND");
self.portrait:SetFrameLevel(max(self.parent:GetFrameLevel()-1,0) );
if self.model.oriPortrait then
self.model.oriPortrait:Hide()
end
self.eventFunc(self.model,"PLAYER_TARGET_CHANGED")
end
--- disable 3d portrait and show 2d self.portrait
function PortraitClass.prototype:Disable()
self.model:UnregisterEvent("UNIT_MODEL_CHANGED")
self.model:UnregisterEvent("PLAYER_TARGET_CHANGED")
self.model:UnregisterEvent("UNIT_PORTRAIT_UPDATE")
self.model:UnregisterEvent("GROUP_ROSTER_UPDATE")
self.portrait:Hide()
if self.model.oriPortrait then
self.model.oriPortrait:Show()
end
end
--- Save the class to template table.
T.Templates.ThreeDportrait = PortraitClass
|
setenv("TACC_MKL_DIR", "/opt/apps/mkl/10.3")
add_property("arch","offload:mic")
remove_property("arch","mic")
remove_property("arch","offload")
add_property("arch","offload")
add_property("arch","mic")
|
local BaseAPI = require("orange.plugins.base_api")
local common_api = require("orange.plugins.common_api")
local plugin_config = require("orange.plugins.property_rate_limiting.plugin")
local api = BaseAPI:new(plugin_config.api_name, 2)
api:merge_apis(common_api(plugin_config.table_name))
return api
|
local System = System
local DictStringString
local ArrayDictStringString
local ArrayObject
System.import(function (out)
DictStringString = System.Dictionary(System.String, System.String)
ArrayDictStringString = System.Array(DictStringString)
ArrayObject = System.Array(System.Object)
end)
local Database = {}
local function getOptionString(options)
if (options == nil) then
return ""
end
local optionString = ""
if (options:getShare() ~= nil) then
optionString = optionString .. "share=" .. (options:getShare() and 1 or 0) .. ";"
end
if (options:getBatch() ~= nil) then
optionString = optionString .. "batch=" .. (options:getBatch() and 1 or 0) .. ";"
end
if (options:getAutoReconnect() ~= nil) then
optionString = optionString .. "autoreconnect=" .. (options:getAutoReconnect() and 1 or 0) .. ";"
end
if (options:getLog() ~= nil) then
optionString = optionString .. "log=" .. (options:getLog() and 1 or 0) .. ";"
end
if (options:getMulti_statements() ~= nil) then
optionString = optionString .. "multi_statements=" .. (options:getMulti_statements() and 1 or 0) .. ";"
end
if (options:getTag() ~= nil) then
optionString = optionString .. "tag=" .. options:getTag() .. ";"
end
if (options:getSurpress() ~= nil) then
local surpress = "surpress="
for _, value in System.each(option.getSurpress()) do
optionString = surpress .. value .. ","
end
if (surpress:len() > 0) then
surpress = surpress:sub(0, surpress:len() - 1)
end
optionString = optionString .. surpress .. ";"
end
if (optionString == "") then
return optionString
end
return optionString:sub(0, optionString:len() - 1)
end
local function getConnectionString(connectionStringInstance)
local connectionString = ""
if (connectionStringInstance:getDbName() ~= nil) then
connectionString = connectionString .. "dbname=" .. connectionStringInstance:getDbName() .. ";"
end
if (connectionStringInstance:getHostname() ~= nil) then
connectionString = connectionString .. "host=" .. connectionStringInstance:getHostname() .. ";"
end
if (connectionStringInstance:getPort() ~= nil) then
connectionString = connectionString .. "port=" .. connectionStringInstance:getPort() .. ";"
end
if (connectionStringInstance:getUnix_socket() ~= nil) then
connectionString = connectionString .. "unix_socket=" .. connectionStringInstance:getUnix_socket() .. ";"
end
if (connectionStringInstance:getCharset() ~= nil) then
connectionString = connectionString .. "charset=" .. connectionStringInstance:getCharset() .. ";"
end
if (connectionString == "") then
return connectionString
end
return connectionString:sub(0, connectionString:len() - 1)
end
local function createResultSet(queryHandle)
local results = dbPoll(queryHandle, 0)
local dictionaryArray = ArrayDictStringString:new(#results)
for i, row in ipairs(results) do
local dictionary = DictStringString()
for key, value in pairs(row) do
dictionary:set(key, Slipe.Sql.SqlValue(value))
end
dictionaryArray:set(i - 1, dictionary)
end
return dictionaryArray
end
Database.__ctor__ = {
function (this, filepath, options)
this.database = dbConnect("sqlite", filepath, getOptionString(options))
end,
function (this, connectionString, username, password, options)
this.database = dbConnect("mysql", connectionString, username, password, getOptionString(options))
end,
function (this, connectionString, username, password, options)
this.database = dbConnect("mysql", getConnectionString(connectionString), username, password, getOptionString(options))
end
}
Database.Exec = function (this, query, ...)
local varargs = {...}
if (#varargs == 1 and System.is(varargs[1], ArrayObject) ) then
return this:Exec1(query, varargs[1])
end
dbExec(this.database, query, ...)
end
Database.Exec1 = function (this, query, parameters)
local params = {}
if parameters ~= nil then
for _, value in System.each(parameters) do
params[#params + 1] = value
end
end
dbExec(this.database, query, unpack(params))
end
Database.Query = function (this, query, ...)
local varargs = {...}
if (#varargs == 1 and System.is(varargs[1], ArrayObject) ) then
return this:Query1(query, varargs[1])
end
local task, callback = System.Task.Callback(createResultSet)
dbQuery(callback, this.database, query, ...)
return task;
end
Database.Query1 = function (this, query, parameters)
local params = {}
if parameters ~= nil then
for _, value in System.each(parameters) do
params[#params + 1] = value
end
end
local task, callback = System.Task.Callback(createResultSet)
dbQuery(callback, this.database, query, unpack(params))
return task;
end
System.define("Slipe.Sql.Database", Database)
|
-- earth_api/init.lua
earth = {}
function earth.define_default(def)
earth.stone = def.stone
end
function earth.register_stone(name, def)
local txt = name:gsub(":", "_")
minetest.register_node(name, {
description = def.description or txt,
short_description = def.short_description,
groups = def.groups or {cracky = 3},
palette = def.palette,
color = def.color,
stack_max = def.stack_max,
range = def.range,
light_source = def.light_source,
node_placement_prediction = def.node_placement_prediction,
node_dig_prediction = def.node_dig_prediction,
sound = def.sound,
tiles = def.tiles or {txt .. ".png"},
overlay_tiles = def.overlay_tiles,
special_tiles = def.special_tiles,
use_texture_alpha = def.use_texture_alpha,
post_effect_color = def.post_effect_color,
paramtype2 = def.paramtype2,
place_param2 = def.place_param2,
is_ground_content = def.is_ground_content,
diggable = def.diggable,
leveled = def.leveled,
leveled_max = def.leveled_max,
sounds = def.sounds or sounds.get_defaults("earth_sounds:stone"),
drop = def.drop,
})
end
function earth.register_brick(name, def)
local txt = name:gsub(":", "_")
minetest.register_node(name .. "_brick", {
description = def.description or txt .. "_brick",
short_description = def.short_description,
groups = def.groups or {cracky = 2},
palette = def.palette,
color = def.color,
stack_max = def.stack_max,
range = def.range,
light_source = def.light_source,
node_placement_prediction = def.node_placement_prediction,
node_dig_prediction = def.node_dig_prediction,
sound = def.sound,
tiles = def.tiles or {txt .. "_brick.png"},
overlay_tiles = def.overlay_tiles,
special_tiles = def.special_tiles,
use_texture_alpha = def.use_texture_alpha,
post_effect_color = def.post_effect_color,
paramtype2 = def.paramtype2 or "facedir",
place_param2 = def.place_param2 or 0,
is_ground_content = def.is_ground_content,
diggable = def.diggable,
leveled = def.leveled,
leveled_max = def.leveled_max,
sounds = def.sounds or sounds.get_defaults("earth_sounds:stone"),
drop = def.drop,
})
end
function earth.register_block(name, def)
local txt = name:gsub(":", "_")
minetest.register_node(name .. "_block", {
description = def.description or txt .. "_block",
short_description = def.short_description,
groups = def.groups or {cracky = 2},
palette = def.palette,
color = def.color,
stack_max = def.stack_max,
range = def.range,
light_source = def.light_source,
node_placement_prediction = def.node_placement_prediction,
node_dig_prediction = def.node_dig_prediction,
sound = def.sound,
tiles = def.tiles or {txt .. "_block.png"},
overlay_tiles = def.overlay_tiles,
special_tiles = def.special_tiles,
use_texture_alpha = def.use_texture_alpha,
post_effect_color = def.post_effect_color,
paramtype2 = def.paramtype2,
place_param2 = def.place_param2,
is_ground_content = def.is_ground_content or false,
diggable = def.diggable,
leveled = def.leveled,
leveled_max = def.leveled_max,
sounds = def.sounds or sounds.get_defaults("earth_sounds:stone"),
drop = def.drop,
})
end
function earth.register_cobble(name, def)
local txt = name:gsub(":", "_")
minetest.register_node(name .. "_cobble", {
description = def.description or txt .. "_cobble",
short_description = def.short_description,
groups = def.groups or {cracky = 3},
palette = def.palette,
color = def.color,
stack_max = def.stack_max,
range = def.range,
light_source = def.light_source,
node_placement_prediction = def.node_placement_prediction,
node_dig_prediction = def.node_dig_prediction,
sound = def.sound,
tiles = def.tiles or {txt .. "_cobble.png"},
overlay_tiles = def.overlay_tiles,
special_tiles = def.special_tiles,
use_texture_alpha = def.use_texture_alpha,
post_effect_color = def.post_effect_color,
paramtype2 = def.paramtype2,
place_param2 = def.place_param2,
is_ground_content = def.is_ground_content or false,
diggable = def.diggable,
leveled = def.leveled,
leveled_max = def.leveled_max,
sounds = def.sounds or sounds.get_defaults("earth_sounds:stone"),
drop = def.drop,
})
end
function earth.register_stone_nodes(name, def)
if def.cobble then
def.cobble.groups = def.cobble.groups or {cracky = 3, stone = 2}
earth.register_cobble(name, def.cobble)
def.stone.drop = def.stone.drop or name .. "_cobble"
minetest.register_craft({
type = "cooking",
output = name,
recipe = name .. "_cobble"
})
end
def.stone.groups = def.stone.groups or {cracky = 3, stone = 1}
earth.register_stone(name, def.stone)
if def.brick then
def.brick.groups = def.brick.groups or {cracky = 2, stone = 1},
earth.register_brick(name, def.brick)
craft.register_craft44(name .. "_brick", name)
end
if def.block then
def.block.groups = def.block.groups or {cracky = 2, stone = 1}
earth.register_block(name, def.block)
craft.register_craft99(name .. "_block", name)
end
end
function earth.register_sand(name, def)
local txt = name:gsub(":", "_")
minetest.register_node(name, {
description = def.description or txt,
short_description = def.short_description,
groups = def.groups or {crumbly = 3, falling_node = 1, sand = 1},
palette = def.palette,
color = def.color,
stack_max = def.stack_max,
range = def.range,
light_source = def.light_source,
node_placement_prediction = def.node_placement_prediction,
node_dig_prediction = def.node_dig_prediction,
sound = def.sound,
tiles = def.tiles or {txt .. ".png"},
overlay_tiles = def.overlay_tiles,
special_tiles = def.special_tiles,
use_texture_alpha = def.use_texture_alpha,
post_effect_color = def.post_effect_color,
paramtype2 = def.paramtype2,
place_param2 = def.place_param2,
is_ground_content = def.is_ground_content or false,
diggable = def.diggable,
leveled = def.leveled,
leveled_max = def.leveled_max,
sounds = def.sounds or sounds.get_defaults("earth_sounds:sand"),
drop = def.drop,
})
end
function earth.register_ore(name, def)
minetest.register_ore({
ore_type = "blob",
ore = name,
ore_param2 = def.ore_param2,
wherein = def.wherein or {earth.stone},
clust_scarcity = def.clust_scarcity or 16 * 16 * 16,
clust_num_ores = def.clust_num_ores or 8,
clust_size = def.clust_size or 5,
y_max = def.y_max or 31000,
y_min = def.y_min or -31000,
flags = def.flags,
noise_threshold = def.noise_threshold or 0.0,
noise_params = def.noise_params or {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = def.seed or 2316,
octaves = 1,
persist = 0.0
},
biomes = def.biomes
})
end
function earth.register_sand_nodes(name, def)
local namestone = name .. "stone"
earth.register_sand(name, def.sand)
if def.stone then
craft.register_craft14(namestone, name)
def.stone.groups = def.stone.groups or {cracky = 3, crumbly = 1},
earth.register_stone(namestone, def.stone)
if def.brick then
craft.register_craft44(namestone .. "_brick 4", namestone)
end
if def.block then
craft.register_craft99(namestone .. "_block", namestone)
end
end
if def.brick then
earth.register_brick(namestone, def.brick)
end
if def.block then
earth.register_block(namestone, def.block)
end
if def.ore then
earth.register_ore(name, def.ore)
end
end
function earth.register_node_with(name, def)
local txt = name:gsub(":", "_")
local txt_with = string.sub(name, 1, name:find(":") - 1) .. "_" .. def.with
minetest.register_node(name .. "_with_" .. def.with, {
description = def.description or txt .. "_with_" .. def.with,
tiles = def.tiles or {
txt_with .. ".png", txt .. ".png",
{name = txt .. ".png^" .. txt_with .. "_side.png",
tileable_vertical = false}
},
groups = def.groups or {crumbly = 3, soil = 1, spreading_dirt_type = 1},
is_ground_content = def.is_ground_content or false,
drop = def.drop or name,
sounds = def.sounds or sounds.get_defaults("earth_sounds:dirt", {
footstep = {name = "earth_grass_footstep", gain = def.gain or 0.4},
})
})
end
function earth.register_deco(name, def)
minetest.register_decoration({
deco_type = def.deco_type or "simple",
place_on = def.place_on,
sidelen = def.sidelen or 4,
fill_ratio = def.fill_ratio,
noise_params = def.noise_params or {
offset = -1.25,
scale = 0.25,
spread = {x = 150, y = 150, z = 150},
seed = 27162,
octaves = 4,
persist = 1.0
},
biomes = def.biomes,
y_min = def.y_min or 1,
y_max = def.y_max or 31000,
spawn_by = def.spawn_by,
num_spawn_by = def.num_spawn_by,
flags = def.flags or "force_placement",
place_offset_y = def.place_offset_y or -1,
decoration = def.decoration,
height = def.height,
height_max = def.height_max,
param2 = def.param2,
param2_max = def.param2_max,
schematic = def.schematic,
replacements = def.replacements,
rotation = def.rotation,
})
end
function earth.register_nodes_with(name, def)
if def.base_node then
def.base_node.tiles = def.base_node.tiles or {name:gsub(":", "_") .. ".png"}
minetest.register_node(name, def.base_node)
if def.base_node.deco then
def.base_node.deco.decoration = def.base_node.deco.decoration or name
earth.register_deco(name, def.base_node.deco)
end
end
for _, de in ipairs(def) do
earth.register_node_with(name, de)
if de.deco then
de.deco.decoration = de.deco.decoration or name .. "_with_" .. de.with
earth.register_deco(name, de.deco)
end
end
end
|
#!/usr/bin/env tarantool
local tap = require('tap')
local client = require('http.client')
local json = require('json')
local test = tap.test("curl")
local fiber = require('fiber')
local socketlib = require('socket')
local os = require('os')
local TARANTOOL_SRC_DIR = os.getenv("TARANTOOL_SRC_DIR") or "../.."
test:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
local function merge(...)
local res = {}
for i = 1, select('#', ...) do
local t = select(i, ...)
for k, v in pairs(t) do
res[k] = v
end
end
return res
end
local function start_server(test, sock_family, sock_addr)
test:diag("starting HTTP server on %s...", sock_addr)
local arg, url, opts
if sock_family == 'AF_INET' then
arg = string.format("--inet %s", sock_addr)
url = string.format("http://%s/", sock_addr)
opts = {}
elseif sock_family == 'AF_UNIX' then
arg = string.format("--unix %s", sock_addr)
url = "http://localhost/"
opts = {unix_socket = sock_addr}
else
error(string.format('invalid socket family: %s', sock_family))
end
local cmd = string.format("%s/test/app-tap/httpd.py %s",
TARANTOOL_SRC_DIR, arg)
local server = io.popen(cmd)
test:is(server:read("*l"), "heartbeat", "server started")
test:diag("trying to connect to %s", url)
local r
for _=1,10 do
r = client.get(url, merge(opts, {timeout = 0.01}))
if r.status == 200 then
break
end
fiber.sleep(0.01)
end
test:is(r.status, 200, "connection is ok")
if r.status ~= 200 then
os.exit(1)
end
return server, url, opts
end
local function stop_server(test, server)
test:diag("stopping HTTP server")
server:close()
end
local function test_http_client(test, url, opts)
test:plan(12)
-- gh-4136: confusing httpc usage error message
local ok, err = pcall(client.request, client)
local usage_err = "request(method, url[, body, [options]])"
test:is_deeply({ok, err:split(': ')[2]}, {false, usage_err},
"test httpc usage error")
test:isnil(rawget(_G, 'http'), "global namespace is not polluted");
test:isnil(rawget(_G, 'http.client'), "global namespace is not polluted");
local r = client.get(url, opts)
test:is(r.status, 200, 'simple 200')
test:is(r.reason, 'Ok', '200 - Ok')
test:is(r.proto[1], 1, 'proto major http 1.1')
test:is(r.proto[2], 1, 'proto major http 1.1')
test:ok(r.body:match("hello") ~= nil, "body")
test:ok(tonumber(r.headers["content-length"]) > 0,
"content-length > 0")
test:is(client.get("http://localhost:1/").status, 595, 'cannot connect')
local r = client.request('GET', url, nil, opts)
test:is(r.status, 200, 'request')
-- gh-4119: specify whether to follow 'Location' header
test:test('gh-4119: follow location', function(test)
test:plan(7)
local endpoint = 'redirect'
-- Verify that the default behaviour is to follow location.
local r = client.request('GET', url .. endpoint, nil, opts)
test:is(r.status, 200, 'default: status')
test:is(r.body, 'hello world', 'default: body')
-- Verify {follow_location = true} behaviour.
local r = client.request('GET', url .. endpoint, nil, merge(opts, {
follow_location = true}))
test:is(r.status, 200, 'follow location: status')
test:is(r.body, 'hello world', 'follow location: body')
-- Verify {follow_location = false} behaviour.
local r = client.request('GET', url .. endpoint, nil, merge(opts, {
follow_location = false}))
test:is(r.status, 302, 'do not follow location: status')
test:is(r.body, 'redirecting', 'do not follow location: body')
test:is(r.headers['location'], '/', 'do not follow location: header')
end)
end
--
-- gh-3955: Check that httpc module doesn't redefine http headers
-- set explicitly by the caller.
--
local function test_http_client_headers_redefine(test, url, opts)
test:plan(9)
local opts = table.deepcopy(opts)
-- Test defaults
opts.headers = {['Connection'] = nil, ['Accept'] = nil}
local r = client.post(url, nil, opts)
test:is(r.status, 200, 'simple 200')
test:is(r.headers['connection'], 'close', 'Default Connection header')
test:is(r.headers['accept'], '*/*', 'Default Accept header for POST request')
-- Test that in case of conflicting headers, user variant is
-- prefered
opts.headers={['Connection'] = 'close'}
opts.keepalive_idle = 2
opts.keepalive_interval = 1
local r = client.get(url, opts)
test:is(r.status, 200, 'simple 200')
test:is(r.headers['connection'], 'close', 'Redefined Connection header')
test:is(r.headers['keep_alive'], 'timeout=2',
'Automatically set Keep-Alive header')
-- Test that user-defined Connection and Acept headers
-- are used
opts.headers={['Connection'] = 'Keep-Alive', ['Accept'] = 'text/html'}
local r = client.get(url, opts)
test:is(r.status, 200, 'simple 200')
test:is(r.headers['accept'], 'text/html', 'Redefined Accept header')
test:is(r.headers['connection'], 'Keep-Alive', 'Redefined Connection header')
end
local function test_cancel_and_errinj(test, url, opts)
test:plan(3)
local ch = fiber.channel(1)
local http = client:new()
local func = function(fopts)
ch:put(http:get(url, fopts))
end
local f = fiber.create(func, opts)
f:cancel()
local r = ch:get()
test:ok(r.status == 408 and string.find(r.reason, "Timeout"),
"After cancel fiber timeout is returned")
r = http:get(url, merge(opts, {timeout = 0.0001}))
test:ok(r.status == 408 and string.find(r.reason, "Timeout"),
"Timeout check")
local errinj = box.error.injection
errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', true)
local topts = merge(opts, {timeout = 1200})
fiber.create(func, topts)
r = ch:get()
test:is(r.status, 200, "No hangs in errinj")
errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', false)
end
local function test_post_and_get(test, url, opts)
test:plan(21)
local http = client.new()
test:ok(http ~= nil, "client is created")
local headers = { header1 = "1", header2 = "2" }
local my_body = { key = "value" }
local json_body = json.encode(my_body)
local responses = {}
headers['Content-Type'] = 'application/json'
local fibers = 7
local ch = fiber.channel(fibers)
opts = merge(opts, {headers = headers})
fiber.create(function()
responses.good_get = http:get(url, opts)
ch:put(1)
end)
fiber.create(function()
responses.get2 = http:get(url .. "abc", opts)
ch:put(1)
end)
fiber.create(function()
responses.good_post = http:post(url, json_body, opts)
ch:put(1)
end)
fiber.create(function()
responses.empty_post = http:post(url, nil, opts)
ch:put(1)
end)
fiber.create(function()
responses.good_put = http:put(url, json_body, opts)
ch:put(1)
end)
fiber.create(function()
responses.bad_get = http:get(url .. 'this/page/not/exists', opts)
ch:put(1)
end)
fiber.create(function()
responses.absent_get = http:get(url .. 'absent', opts)
ch:put(1)
end)
for _=1,fibers do
ch:get()
end
local r = responses.good_get
test:is(r.status, 200, "GET: default http code page exists")
test:is(r.body, "hello world", "GET: default right body")
r = responses.get2
test:is(r.status, 200, "GET: http code page exists")
test:is(r.body, "abc", "GET: right body")
r = responses.absent_get
test:is(r.status, 500, "GET: absent method http code page exists")
test:is(r.reason, 'Unknown', '500 - Unknown')
test:is(r.body, "No such method", "GET: absent method right body")
r = responses.empty_post
test:is(r.status, 200, "POST: good status")
test:ok(r.headers['header1'] == headers.header1 and
r.headers['header2'] == headers.header2, "POST: good headers")
test:isnil(r.body, "POST: empty body")
r = responses.good_post
test:is(r.status, 200, "POST: good status")
test:ok(r.headers['header1'] == headers.header1 and
r.headers['header2'] == headers.header2, "POST: good headers")
test:is(r.body, json_body, "POST: body")
r = responses.good_put
test:is(r.status, 200, "PUT: good status")
test:ok(r.headers['header'] == headers.header and
r.headers['header2'] == headers.header2, "PUT: good headers")
r = responses.bad_get
test:is(r.status, 404, "GET: http page not exists")
test:is(r.reason, 'Unknown', '404 - Unknown')
test:isnt(r.body:len(), 0, "GET: not empty body page not exists")
test:ok(string.find(r.body, "Not Found"),
"GET: right body page not exists")
local st = http:stat()
test:ok(st.sockets_added == st.sockets_deleted and
st.active_requests == 0,
"stats checking")
end
local function test_errors(test)
test:plan(2)
local http = client:new()
local status, err = pcall(http.get, http, "htp://mail.ru")
test:ok(not status and string.find(json.encode(err),
"Unsupported protocol"),
"GET: exception on bad protocol")
status, err = pcall(http.post, http, "htp://mail.ru", "")
test:ok(not status and string.find(json.encode(err),
"Unsupported protocol"),
"POST: exception on bad protocol")
end
-- gh-3679 Check that opts.headers values can be strings only.
-- gh-4281 Check that opts.headers can be a table and opts.headers
-- keys can be strings only.
local function test_request_headers(test, url, opts)
local exp_err_bad_opts_headers = 'opts.headers should be a table'
local exp_err_bad_key = 'opts.headers keys should be strings'
local exp_err_bad_value = 'opts.headers values should be strings'
local cases = {
-- Verify opts.headers type checks.
{
'string opts.headers',
opts = {headers = 'aaa'},
exp_err = exp_err_bad_opts_headers,
},
{
'number opts.headers',
opts = {headers = 1},
exp_err = exp_err_bad_opts_headers,
},
{
'cdata (box.NULL) opts.headers',
opts = {headers = box.NULL},
exp_err = exp_err_bad_opts_headers,
},
-- Verify a header key type checks.
{
'number header key',
opts = {headers = {[1] = 'aaa'}},
exp_err = exp_err_bad_key,
},
{
'boolean header key',
opts = {headers = {[true] = 'aaa'}},
exp_err = exp_err_bad_key,
},
{
'table header key',
opts = {headers = {[{}] = 'aaa'}},
exp_err = exp_err_bad_key,
},
{
'cdata header key (box.NULL)',
opts = {headers = {[box.NULL] = 'aaa'}},
exp_err = exp_err_bad_key,
},
-- Verify a header value type checks.
{
'string header key & value',
opts = {headers = {aaa = 'aaa'}},
exp_err = nil,
},
{
'boolean header value',
opts = {headers = {aaa = true}},
exp_err = exp_err_bad_value,
},
{
'number header value',
opts = {headers = {aaa = 10}},
exp_err = exp_err_bad_value,
},
{
'cdata header value (box.NULL)',
opts = {headers = {aaa = box.NULL}},
exp_err = exp_err_bad_value,
},
{
'cdata<uint64_t> header value',
opts = {headers = {aaa = 10ULL}},
exp_err = exp_err_bad_value,
},
{
'table header value',
opts = {headers = {aaa = {}}},
exp_err = exp_err_bad_value,
},
}
test:plan(#cases)
local http = client:new()
for _, case in ipairs(cases) do
opts = merge(table.copy(opts), case.opts)
local ok, err = pcall(http.get, http, url, opts)
if case.postrequest_check ~= nil then
case.postrequest_check(opts)
end
if case.exp_err == nil then
-- expect success
test:ok(ok, case[1])
else
-- expect fail
assert(type(err) == 'string')
err = err:gsub('^builtin/[a-z._]+.lua:[0-9]+: ', '')
test:is_deeply({ok, err}, {false, case.exp_err}, case[1])
end
end
end
local function test_headers(test, url, opts)
test:plan(21)
local http = client:new()
local r = http:get(url .. 'headers', opts)
test:is(type(r.headers["set-cookie"]), 'string', "set-cookie check")
test:ok(r.headers["set-cookie"]:match("likes=cheese"), "set-cookie check")
test:ok(r.headers["set-cookie"]:match("age = 17"), "set-cookie check")
test:is(r.headers["content-type"], "application/json", "content-type check")
test:is(r.headers["my_header"], "value1,value2", "other header check")
test:isnil(r.headers["11200ok"], "http status line not included in headers")
test:is(r.cookies["likes"][1], "cheese", "cookie value check")
test:ok(r.cookies["likes"][2][1]:match("Expires"), "cookie option check")
test:ok(r.cookies["likes"][2][3]:match("HttpOnly"), "cookie option check")
test:is(r.cookies["age"][1], "17", "cookie value check")
test:is(#r.cookies["age"][2], 1, "cookie option check")
test:is(r.cookies["age"][2][1], "Secure", "cookie option check")
test:ok(r.cookies["good_name"] ~= nil , "cookie name check")
test:ok(r.cookies["bad@name"] == nil , "cookie name check")
test:ok(r.cookies["badname"] == nil , "cookie name check")
test:ok(r.cookies["badcookie"] == nil , "cookie name check")
test:isnil(r.headers["very_very_very_long_headers_name1"], "no long header name")
test:is(r.headers["very_very_very_long_headers_name"], "true", "truncated name")
opts["max_header_name_length"] = 64
local r = http:get(url .. 'headers', opts)
test:is(r.headers["very_very_very_long_headers_name1"], "true", "truncated max_header_name_length")
opts["max_header_name_length"] = nil
-- Send large headers.
local MAX_HEADER_NAME = 8192
local hname = 'largeheader'
-- "${hname}: ${hvalue}" is 8192 bytes length
local hvalue = string.rep('x', MAX_HEADER_NAME - hname:len() - 2)
local headers = {[hname] = hvalue}
local r = http:post(url, nil, merge(opts, {headers = headers}))
test:is(r.headers[hname], hvalue, '8192 bytes header: success')
-- "${hname}: ${hvalue}" is 8193 bytes length
local exp_err = 'header is too large'
local hvalue = string.rep('x', MAX_HEADER_NAME - hname:len() - 1)
local headers = {[hname] = hvalue}
local ok, err = pcall(http.post, http, url, nil,
merge(opts, {headers = headers}))
test:is_deeply({ok, tostring(err)}, {false, exp_err},
'8193 KiB header: error')
end
local function test_special_methods(test, url, opts)
test:plan(14)
local http = client.new()
local responses = {}
local fibers = 7
local ch = fiber.channel(fibers)
fiber.create(function()
responses.patch_data = http:patch(url, "{\"key\":\"val\"}", opts)
ch:put(1)
end)
fiber.create(function()
responses.delete_data = http:delete(url, opts)
ch:put(1)
end)
fiber.create(function()
responses.options_data = http:options(url, opts)
ch:put(1)
end)
fiber.create(function()
responses.head_data = http:head(url, opts)
ch:put(1)
end)
fiber.create(function()
responses.trace_data = http:trace(url, opts)
ch:put(1)
end)
fiber.create(function()
responses.connect_data = http:connect(url, opts)
ch:put(1)
end)
fiber.create(function()
responses.custom_data = http:request("CUSTOM", url, nil, opts)
ch:put(1)
end)
for _ = 1, fibers do
ch:get()
end
test:is(responses.patch_data.status, 200, "HTTP:PATCH request")
test:ok(json.decode(responses.patch_data.body).key == "val",
"HTTP:PATCH request content")
test:is(responses.delete_data.status, 200, "HTTP:DELETE request")
test:ok(responses.delete_data.headers.method == "DELETE",
"HTTP:DELETE request content")
test:is(responses.options_data.status, 200, "HTTP:OPTIONS request")
test:ok(responses.options_data.headers.method == "OPTIONS",
"HTTP:OPTIONS request content")
test:is(responses.head_data.status, 200, "HTTP:HEAD request code")
test:ok(responses.head_data.headers.method == "HEAD",
"HTTP:HEAD request content")
test:is(responses.connect_data.status, 200, "HTTP:CONNECT request")
test:ok(responses.connect_data.headers.method == "CONNECT",
"HTTP:OPTIONS request content")
test:is(responses.trace_data.status, 200, "HTTP:TRACE request")
test:ok(responses.trace_data.headers.method == "TRACE",
"HTTP:TRACE request content")
test:is(responses.custom_data.status, 400, "HTTP:CUSTOM request")
test:ok(responses.custom_data.headers.method == "CUSTOM",
"HTTP:CUSTOM request content")
end
local function test_concurrent(test, url, opts)
test:plan(3)
local num_test = 10
local num_load = 10
local curls = { }
local headers = { }
-- Init [[
for i = 1, num_test do
headers["My-header" .. i] = "my-value"
end
for _ = 1, num_test do
table.insert(curls, {
url = url,
http = client.new(),
body = json.encode({stat = {"ok"},
info = {"ok"} }),
headers = headers,
connect_timeout = 5,
timeout = 5
})
end
-- ]]
local ch = fiber.channel(num_test * 2 * num_load)
-- Start test
-- Creating concurrent clients
for i=1,num_test do
local obj = curls[i]
for _=1,num_load do
fiber.create(function()
local r = obj.http:post(obj.url, obj.body, merge(opts, {
headers = obj.headers,
keepalive_idle = 30,
keepalive_interval = 60,
connect_timeout = obj.connect_timeout,
timeout = obj.timeout,
}))
ch:put(r.status)
end)
fiber.create(function()
local r = obj.http:get(obj.url, merge(opts, {
headers = obj.headers,
keepalive_idle = 30,
keepalive_interval = 60,
connect_timeout = obj.connect_timeout,
timeout = obj.timeout,
}))
ch:put(r.status)
end)
end
end
local ok_sockets_added = true
local ok_active = true
local ok_req = true
-- Join test
local rest = num_test
while true do
for i = 1, num_load do
local obj = curls[i]
-- checking that stats in concurrent are ok
if obj.http ~= nil and obj.http:stat().active_requests == 0 then
local st = obj.http:stat()
if st.sockets_added ~= st.sockets_deleted then
ok_sockets_added = false
rest = 0
end
if st.active_requests ~= 0 then
ok_active = false
rest = 0
end
-- waiting requests to finish before kill the client
local r = ch:get()
if r ~= 200 then
ok_req = false
end
r = ch:get()
if r ~= 200 then
print(r)
end
end
curls[i].http = nil
end
rest = rest - 1
if rest <= 0 then
break
end
end
test:is(ok_req, true, "All requests are ok")
test:ok(ok_sockets_added, "free sockets")
test:ok(ok_active, "no active requests")
end
local function run_tests(test, sock_family, sock_addr)
test:plan(11)
local server, url, opts = start_server(test, sock_family, sock_addr)
test:test("http.client", test_http_client, url, opts)
test:test("http.client headers redefine", test_http_client_headers_redefine,
url, opts)
test:test("cancel and errinj", test_cancel_and_errinj, url .. 'long_query', opts)
test:test("basic http post/get", test_post_and_get, url, opts)
test:test("errors", test_errors)
test:test("request_headers", test_request_headers, url, opts)
test:test("headers", test_headers, url, opts)
test:test("special methods", test_special_methods, url, opts)
if sock_family == 'AF_UNIX' and jit.os ~= "Linux" then
--
-- BSD-based operating systems (including OS X) will fail
-- connect() to a Unix domain socket with ECONNREFUSED
-- if the queue of pending connections is full. Hence the
-- "concurrent" test, which opens a lot of connections
-- simultaneously, cannot run on those platforms. Linux,
-- however, is fine - instead of returning ECONNEREFUSED
-- it will suspend connect() until backlog is processed.
--
test:skip("concurrent")
else
test:test("concurrent", test_concurrent, url, opts)
end
stop_server(test, server)
end
test:plan(2)
test:test("http over AF_INET", function(test)
local s = socketlib('AF_INET', 'SOCK_STREAM', 0)
s:bind('127.0.0.1', 0)
local host = s:name().host
local port = s:name().port
s:close()
run_tests(test, 'AF_INET', string.format("%s:%d", host, port))
end)
test:test("http over AF_UNIX", function(test)
local path = os.tmpname()
os.remove(path)
local status = pcall(client.get, 'http://localhost/', {unix_socket = path})
if not status then
-- Unix domain sockets are not supported, skip the test.
return
end
run_tests(test, 'AF_UNIX', path)
os.remove(path)
end)
os.exit(test:check() == true and 0 or -1)
|
local uv = require('luv')
local Repl = require('repl')
local b = require('bencode')
local h = require('helpers')
local NRepl = Repl:new()
function NRepl:connect (host, port, ns)
local nrepl = Repl.connect(self, host, port, ns)
return nrepl:new_session()
end
function NRepl:eval(code, options)
local encode = function (code)
local data = {
code = code,
op = "eval",
id = table.maxn(self._log),
session = self._session,
ns = self._namespace
}
return b.encode(data)
end
local decode = b.decode
return Repl.eval(self, code,
vim.tbl_extend("keep",
options,
{encode=encode,
decode=decode}))
end
function NRepl:print_prompt (code)
self:print(self._namespace, "=> ", code)
end
function NRepl:callback (response)
self:log(response, "response")
if response.ns then
self._namespace = response.ns
vim.api.nvim_buf_set_name(self:buffer(), response.ns)
end
if response.out then
self:log(response.out, "out")
self:print(response.out)
end
if response.err then
self:log(response.err, "err")
self:print(response.err)
end
if response.ex then
self:log(response.ex, "ex")
self:print(response.ex)
end
if response.value then
local out = h.last(self._log).out or {}
self:print(response.value)
self:show_virtual(response.value)
if v then self:showVirtual(response.value, v) end
vim.api.nvim_command("let @+="..vim.inspect(response.value)) -- copy the result
end
if h.contains(response.status,"done") then self:read_stop() end
end
function NRepl:describe()
local id = table.maxn(self._log)
local cb_wrap = function (data)
return vim.schedule_wrap(function (response)
self:print(vim.inspect(h.keys(response.ops)))
end)(b.decode(data))
end
uv.read_start(self._socket, function(err, chunk)
if err then error(err)
elseif chunk then cb_wrap(chunk)
else self:read_stop() end
end)
uv.write(self._socket, b.encode({op="describe",id=id}), function(err)
if err then error(self._stream_error or err) end
end)
end
function NRepl:loadfile()
local id = table.maxn(self._log)
local file = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local name = vim.api.nvim_buf_get_name(0)
self:print("loading: "..name)
local cb_wrap = function (data)
return vim.schedule_wrap(function(response)
if response.ns then
self._namespace = response.ns
vim.api.nvim_buf_set_name(self:buffer(), response.ns)
end
self:log(response,"loadfile")
end)(b.decode(data))
end
local data = {
op = "load-file",
id = id,
file = table.concat(file, "\n"),
session = self._session
}
self:log(data, "loadfile")
uv.read_start(self._socket, function(err, chunk)
if err then error(err)
elseif chunk then cb_wrap(chunk)
else self:read_stop() end
end)
uv.write(self._socket, b.encode(data), function(err)
if err then error(self._stream_error or err) end
end)
end
function NRepl:new_session()
local id = table.maxn(self._log)
local cb_wrap = function (data)
return vim.schedule_wrap(function (response)
self._session = response["new-session"]
self:log(response["new-session"], "session")
end)(b.decode(data))
end
uv.read_start(self._socket, function(err, chunk)
if err then error(err)
elseif chunk then cb_wrap(chunk)
else self:read_stop() end
end)
uv.write(self._socket, b.encode({op="clone",id=id}), function(err)
if err then error(elf._stream_error or err) end
end)
return self
end
return NRepl
|
data:extend(
{
--Battle Tanks
--flame-tank
{
type = "car",
name = "flame-tank",
icon = "__Advanced-Tanks__/graphics/icons/flame-tank.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "flame-tank"},
max_health = 1250,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 95,
percent = 95
},
{
type = "physical",
decrease = 25,
percent = 45
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 30,
percent = 45
},
{
type = "acid",
decrease = 20,
percent = 40
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.5,
braking_power = "300kW",
burner =
{
effectivity = 0.55,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "800kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 8,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.5 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 2000,
inventory_size = 80,
guns = { "tank-cannon-2", "tank-flamer" },
},
--auto-tank
{
type = "car",
name = "auto-tank",
icon = "__Advanced-Tanks__/graphics/icons/auto-tank.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "auto-tank"},
max_health = 1000,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 30
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 15,
percent = 30
},
{
type = "acid",
decrease = 15,
percent = 25
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.7,
braking_power = "500kW",
burner =
{
effectivity = 0.7,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "500kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.00 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 1000,
inventory_size = 40,
guns = { "tank-auto-cannon", "combat-shotgun" },
},
--nade-tank
{
type = "car",
name = "nade-tank",
icon = "__Advanced-Tanks__/graphics/icons/nade-tank.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "nade-tank"},
max_health = 1000,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 30
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 15,
percent = 30
},
{
type = "acid",
decrease = 10,
percent = 20
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.7,
braking_power = "500kW",
burner =
{
effectivity = 0.7,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "500kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 1000,
inventory_size = 40,
guns = { "tank-nade-cannon" },
},
--flame-tank-wlsk
{
type = "car",
name = "flame-tank-wlsk",
icon = "__Advanced-Tanks__/graphics/icons/flame-tank-wlsk.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "flame-tank-wlsk"},
max_health = 2000,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 95,
percent = 95
},
{
type = "physical",
decrease = 35,
percent = 55
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 30,
percent = 45
},
{
type = "acid",
decrease = 25,
percent = 45
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.5,
braking_power = "300kW",
burner =
{
effectivity = 0.55,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "800kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 8,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.5 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 2000,
inventory_size = 80,
guns = { "tank-cannon-2", "tank-flamer" },
},
--auto-tank-wlsk
{
type = "car",
name = "auto-tank-wlsk",
icon = "__Advanced-Tanks__/graphics/icons/auto-tank-wlsk.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "auto-tank-wlsk"},
max_health = 1750,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 35
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 20,
percent = 35
},
{
type = "acid",
decrease = 15,
percent = 35
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.7,
braking_power = "500kW",
burner =
{
effectivity = 0.7,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "500kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.00 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 1000,
inventory_size = 40,
guns = { "tank-auto-cannon", "combat-shotgun" },
},
--nade-tank-wlsk
{
type = "car",
name = "nade-tank-wlsk",
icon = "__Advanced-Tanks__/graphics/icons/nade-tank-wlsk.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "nade-tank-wlsk"},
max_health = 1750,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 35
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 20,
percent = 35
},
{
type = "acid",
decrease = 15,
percent = 30
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.7,
braking_power = "500kW",
burner =
{
effectivity = 0.7,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "500kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 1000,
inventory_size = 40,
guns = { "tank-nade-cannon" },
},
--mine-tank
{
type = "car",
name = "mine-tank",
icon = "__Advanced-Tanks__/graphics/icons/mine-tank.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "mine-tank"},
max_health = 1000,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 30
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 15,
percent = 30
},
{
type = "acid",
decrease = 10,
percent = 20
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.7,
braking_power = "500kW",
burner =
{
effectivity = 0.7,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "500kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 1000,
inventory_size = 40,
guns = { "tank-mine-cannon", "combat-shotgun" },
},
--rocket-tank
{
type = "car",
name = "rocket-tank",
icon = "__Advanced-Tanks__/graphics/icons/rocket-tank.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "rocket-tank"},
max_health = 1000,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 30
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 15,
percent = 30
},
{
type = "acid",
decrease = 10,
percent = 20
}
},
collision_box = {{-0.9, -1.3}, {0.9, 1.3}},
selection_box = {{-0.9, -1.3}, {0.9, 1.3}},
effectivity = 0.7,
braking_power = "500kW",
burner =
{
effectivity = 0.7,
fuel_inventory_size = 2,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "500kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.28125},
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__base__/graphics/entity/tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.140625, -0.65625},
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.59375, 0.328125},
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {-0.15625, -1.07812},
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {-0.15625, -1.23438},
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {1.70312, 0.640625},
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 1000,
inventory_size = 40,
guns = { "tank-rocket-cannon", "tank-cannon-2" },
},
--Super Heavy
{
type = "car",
name = "super-tank",
icon = "__Advanced-Tanks__/graphics/icons/super-tank.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "super-tank"},
max_health = 4500,
corpse = "big-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 65
},
{
type = "physical",
decrease = 35,
percent = 65
},
{
type = "impact",
decrease = 15,
percent = 65
},
{
type = "explosion",
decrease = 15,
percent = 65
},
{
type = "acid",
decrease = 10,
percent = 50
}
},
collision_box = {{2*-0.9, 2*-1.3}, {2*0.9, 2*1.3}},
selection_box = {{2*-0.9, 2*-1.3}, {2*0.9, 2*1.3}},
--scale = 2,
effectivity = 0.4,
braking_power = "250kW",
burner =
{
effectivity = 0.5,
fuel_inventory_size = 4,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "1250kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.140625, 2*-0.28125},
scale = 2,
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.140625, 2*-0.65625},
scale = 2,
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {2*0.59375, 2*0.328125},
scale = 2,
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.15625, 2*-1.07812},
scale = 2,
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {2*-0.15625, 2*-1.23438},
scale = 2,
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {2*1.70312, 2*0.640625},
scale = 2,
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 5000,
inventory_size = 64,
guns = { "tank-auto-cannon", "tank-nade-cannon", "tank-machinegun-turret" },
},
--Super Heavy Alternate
{
type = "car",
name = "super-tank-alternate",
icon = "__Advanced-Tanks__/graphics/icons/super-tank-alternate.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "super-tank-alternate"},
max_health = 4500,
corpse = "big-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 65
},
{
type = "physical",
decrease = 35,
percent = 65
},
{
type = "impact",
decrease = 15,
percent = 65
},
{
type = "explosion",
decrease = 15,
percent = 65
},
{
type = "acid",
decrease = 10,
percent = 50
}
},
collision_box = {{2*-0.9, 2*-1.3}, {2*0.9, 2*1.3}},
selection_box = {{2*-0.9, 2*-1.3}, {2*0.9, 2*1.3}},
--scale = 2,
effectivity = 0.4,
braking_power = "250kW",
burner =
{
effectivity = 0.5,
fuel_inventory_size = 4,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "1250kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.140625, 2*-0.28125},
scale = 2,
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.140625, 2*-0.65625},
scale = 2,
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {2*0.59375, 2*0.328125},
scale = 2,
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.15625, 2*-1.07812},
scale = 2,
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {2*-0.15625, 2*-1.23438},
scale = 2,
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {2*1.70312, 2*0.640625},
scale = 2,
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 5000,
inventory_size = 64,
guns = { "tank-cannon-2", "tank-flamer", "tank-mine-cannon" },
},
--Super Heavy WMD
{
type = "car",
name = "super-tank-wmd",
icon = "__Advanced-Tanks__/graphics/icons/super-tank-wmd.png",
flags = {"pushable", "placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "super-tank-wmd"},
max_health = 4500,
corpse = "big-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 0.5,
resistances =
{
{
type = "fire",
decrease = 15,
percent = 65
},
{
type = "physical",
decrease = 35,
percent = 65
},
{
type = "impact",
decrease = 15,
percent = 65
},
{
type = "explosion",
decrease = 15,
percent = 65
},
{
type = "acid",
decrease = 10,
percent = 50
}
},
collision_box = {{2*-0.9, 2*-1.3}, {2*0.9, 2*1.3}},
selection_box = {{2*-0.9, 2*-1.3}, {2*0.9, 2*1.3}},
--scale = 2,
effectivity = 0.4,
braking_power = "250kW",
burner =
{
effectivity = 0.5,
fuel_inventory_size = 4,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 50,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "1250kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 139,
height = 110,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.140625, 2*-0.28125},
scale = 2,
animation_speed = 8,
max_advance = 1,
stripes =
{
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-1.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-2.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-3.png",
width_in_frames = 2,
height_in_frames = 16,
},
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/base-4.png",
width_in_frames = 2,
height_in_frames = 16,
}
}
},
{
width = 109,
height = 88,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.140625, 2*-0.65625},
scale = 2,
max_advance = 1,
line_length = 2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/tank/base-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 154,
height = 99,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {2*0.59375, 2*0.328125},
scale = 2,
max_advance = 1,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/tank/base-shadow-1.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-2.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-3.png",
width_in_frames = 1,
height_in_frames = 16,
},
{
filename = "__base__/graphics/entity/tank/base-shadow-4.png",
width_in_frames = 1,
height_in_frames = 16,
}
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__Advanced-Tanks__/graphics/entity/super-tank/turret.png",
line_length = 8,
width = 92,
height = 69,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {2*-0.15625, 2*-1.07812},
scale = 2,
animation_speed = 12,
},
{
filename = "__base__/graphics/entity/tank/turret-mask.png",
line_length = 8,
width = 38,
height = 29,
frame_count = 1,
axially_symmetrical = false,
apply_runtime_tint = true,
direction_count = 64,
shift = {2*-0.15625, 2*-1.23438},
scale = 2,
},
{
filename = "__base__/graphics/entity/tank/turret-shadow.png",
line_length = 8,
width = 95,
height = 67,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {2*1.70312, 2*0.640625},
scale = 2,
}
}
},
turret_rotation_speed = 5.0 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.15;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
tank_driving = true,
weight = 5000,
inventory_size = 64,
guns = { "tank-wmd-cannon", "tank-auto-cannon" },
},
--car-flamer
{
type = "car",
name = "car-flamer",
icon = "__Advanced-Tanks__/graphics/icons/car-flamer.png",
flags = {"pushable", "placeable-neutral", "player-creation", "placeable-off-grid"},
minable = {mining_time = 1, result = "car-flamer"},
max_health = 250,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
energy_per_hit_point = 1,
resistances =
{
{
type = "fire",
percent = 95
},
{
type = "impact",
percent = 30,
decrease = 45
}
},
collision_box = {{-0.7, -1}, {0.7, 1}},
selection_box = {{-0.7, -1}, {0.7, 1}},
effectivity = 0.7,
braking_power = "250kW",
burner =
{
effectivity = 0.6,
fuel_inventory_size = 1,
smoke =
{
{
name = "smoke",
deviation = {0.25, 0.25},
frequency = 25,
position = {0, 1.5},
slow_down_factor = 0.9,
starting_frame = 3,
starting_frame_deviation = 5,
starting_frame_speed = 0,
starting_frame_speed_deviation = 5
}
}
},
consumption = "225kW",
friction = 2e-3,
light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -14},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -14},
size = 2,
intensity = 0.6
}
},
animation =
{
layers =
{
{
width = 102,
height = 86,
frame_count = 2,
axially_symmetrical = false,
direction_count = 64,
shift = {0, -0.1875},
animation_speed = 8,
max_advance = 0.2,
stripes =
{
{
filename = "__base__/graphics/entity/car/car-1.png",
width_in_frames = 2,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/car/car-2.png",
width_in_frames = 2,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/car/car-3.png",
width_in_frames = 2,
height_in_frames = 20,
},
}
},
{
width = 100,
height = 75,
frame_count = 2,
apply_runtime_tint = true,
axially_symmetrical = false,
direction_count = 64,
max_advance = 0.2,
line_length = 2,
shift = {0, -0.171875},
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/car/car-mask-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/car/car-mask-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/car/car-mask-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
},
{
width = 114,
height = 76,
frame_count = 2,
draw_as_shadow = true,
axially_symmetrical = false,
direction_count = 64,
shift = {0.28125, 0.25},
max_advance = 0.2,
stripes = util.multiplystripes(2,
{
{
filename = "__base__/graphics/entity/car/car-shadow-1.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/car/car-shadow-2.png",
width_in_frames = 1,
height_in_frames = 22,
},
{
filename = "__base__/graphics/entity/car/car-shadow-3.png",
width_in_frames = 1,
height_in_frames = 20,
},
})
}
}
},
turret_animation =
{
layers =
{
{
filename = "__base__/graphics/entity/car/car-turret.png",
line_length = 8,
width = 36,
height = 29,
frame_count = 1,
axially_symmetrical = false,
direction_count = 64,
shift = {0.03125, -0.890625},
animation_speed = 8,
},
{
filename = "__base__/graphics/entity/car/car-turret-shadow.png",
line_length = 8,
width = 46,
height = 31,
frame_count = 1,
axially_symmetrical = false,
draw_as_shadow = true,
direction_count = 64,
shift = {0.875, 0.359375},
}
}
},
turret_rotation_speed = 5.5 / 60,
stop_trigger_speed = 0.2,
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/car-breaks.ogg",
volume = 0.6
},
}
},
},
crash_trigger = crash_trigger(),
sound_minimum_speed = 0.2;
working_sound =
{
sound =
{
filename = "__base__/sound/car-engine.ogg",
volume = 0.6
},
activate_sound =
{
filename = "__base__/sound/car-engine-start.ogg",
volume = 0.6
},
deactivate_sound =
{
filename = "__base__/sound/car-engine-stop.ogg",
volume = 0.6
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
rotation_speed = 0.003,
weight = 750,
guns = { "tank-flamer" },
inventory_size = 45
},
}
)
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local common = ReplicatedStorage.common
local Items = require(common.Items)
return function (registry)
local allItems = {}
for id, item in pairs(Items.byId) do
table.insert(allItems, id)
end
registry:RegisterType("itemId", registry.Cmdr.Util.MakeEnumType("ItemId", allItems))
end
|
--- Ensure the resulting name of debug.getinfo is correct
local function expect_eq(actual, exp)
if actual ~= exp then
error(("Error:\nExpected %s,\n got %s"):format(exp, actual), 2)
end
end
-- When tail called
local function get_name()
return debug.getinfo(1).name
end
local function no_tail()
return (get_name())
end
local function tail()
return get_name()
end
expect_eq(no_tail(), "get_name")
expect_eq(tail(), nil)
-- And within hooks
debug.sethook(function()
local info = debug.getinfo(1)
expect_eq(info.name, "?")
expect_eq(info.namewhat, "hook")
end, "l");
(function() end)();
debug.sethook(nil, "lcr", 1)
|
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local _G = _G
--Lua functions
local pairs = pairs
local select = select
local assert = assert
local tinsert = tinsert
--WoW API / Variables
local CreateFrame = CreateFrame
local UnitClass = UnitClass
local UnitExists = UnitExists
local UnitIsPlayer = UnitIsPlayer
local UnitIsUnit = UnitIsUnit
local UnitReaction = UnitReaction
function UF:FrameGlow_MouseOnUnit(frame)
if frame and frame:IsVisible() and UnitExists('mouseover') then
local unit = frame.unit or (frame.isForced and 'player')
return unit and UnitIsUnit('mouseover', unit)
end
return false
end
function UF:FrameGlow_ElementHook(frame, glow, which)
if not (frame and frame.__elements) then return end
tinsert(frame.__elements, function()
local unit = frame.unit or (frame.isForced and 'player')
if unit then
UF:FrameGlow_SetGlowColor(glow, unit, which)
end
if which == 'mouseoverGlow' then
UF:FrameGlow_PositionHighlight(frame)
UF:FrameGlow_CheckMouseover(frame)
else
UF:FrameGlow_PositionGlow(frame, glow, glow.powerGlow)
end
if which == 'targetGlow' then
UF:FrameGlow_CheckTarget(frame)
end
end)
end
function UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
if (frame and power and powerName and glow and offset) and not glow[powerName..'Hooked'] then
glow[powerName..'Hooked'] = true
local func = function() UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, true) end
power:HookScript('OnShow', func)
power:HookScript('OnHide', func)
end
end
function UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, fromScript)
if not (frame and glow and offset) then return end
local power = powerName and frame[powerName]
if not power then return end
-- check for Additional Power to hook scripts on
local useBonusPower, bonus
if powerName == 'ClassPower' then
local bonusName = (frame.AdditionalPower and 'AdditionalPower') or (frame.Stagger and 'Stagger') or (frame.Runes and 'Runes')
bonus = bonusName and frame[bonusName]
if bonus then
if not fromScript then
UF:FrameGlow_HookPowerBar(frame, bonus, bonusName, glow, offset)
end
useBonusPower = bonus:IsVisible()
end
end
if not fromScript then
UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
end
if useBonusPower then
power = bonus
end
local portrait = (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) and (frame.Portrait and frame.Portrait.backdrop)
if (power and power.backdrop and power:IsVisible()) and ((power == frame.AlternativePower) or not (frame.CLASSBAR_DETACHED or frame.USE_MINI_CLASSBAR)) then
glow:Point('TOPLEFT', (frame.ORIENTATION == "LEFT" and portrait) or power.backdrop, -offset, offset)
glow:Point('TOPRIGHT', (frame.ORIENTATION == "RIGHT" and portrait) or power.backdrop, offset, offset)
elseif frame.Health and frame.Health.backdrop then
glow:Point('TOPLEFT', (frame.ORIENTATION == "LEFT" and portrait) or frame.Health.backdrop, -offset, offset)
glow:Point('TOPRIGHT', (frame.ORIENTATION == "RIGHT" and portrait) or frame.Health.backdrop, offset, offset)
end
end
function UF:FrameGlow_PositionGlow(frame, mainGlow, powerGlow)
if not (frame and frame.VARIABLES_SET) then return end
local infoPanel = frame.InfoPanel
local classPower = frame.ClassPower
local altPower = frame.AlternativePower
local pvpSpec = frame.PVPSpecIcon
local power = frame.Power and frame.Power.backdrop
local health = frame.Health and frame.Health.backdrop
local portrait = (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) and (frame.Portrait and frame.Portrait.backdrop)
local offset = (E.PixelMode and 3) or 4 -- edgeSize is 3
mainGlow:ClearAllPoints()
mainGlow:Point('TOPLEFT', (frame.ORIENTATION == "LEFT" and portrait) or health, -offset, offset)
mainGlow:Point('TOPRIGHT', (frame.ORIENTATION == "RIGHT" and portrait) or health, offset, offset)
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
mainGlow:Point('BOTTOMLEFT', health, -offset, -offset)
mainGlow:Point('BOTTOMRIGHT', health, offset, -offset)
else
--offset is set because its one pixel off for some reason
mainGlow:Point('BOTTOMLEFT', frame, -offset, -(E.PixelMode and offset or offset-1))
mainGlow:Point('BOTTOMRIGHT', frame, offset, -(E.PixelMode and offset or offset-1))
end
if powerGlow then
powerGlow:ClearAllPoints()
powerGlow:Point('TOPLEFT', power, -offset, offset)
powerGlow:Point('TOPRIGHT', power, offset, offset)
powerGlow:Point('BOTTOMLEFT', power, -offset, -offset)
powerGlow:Point('BOTTOMRIGHT', power, offset, -offset)
end
if classPower then
UF:FrameGlow_ClassGlowPosition(frame, 'ClassPower', mainGlow, offset)
elseif altPower and (frame.isForced or (frame.unit and frame.unit:find('boss%d'))) then
UF:FrameGlow_ClassGlowPosition(frame, 'AlternativePower', mainGlow, offset)
elseif pvpSpec and pvpSpec:IsShown() then
local shownPanel = (infoPanel and infoPanel:IsShown() and infoPanel.backdrop)
mainGlow:Point('TOPLEFT', pvpSpec.bg, -offset, offset)
mainGlow:Point('BOTTOMLEFT', shownPanel or pvpSpec.bg, -offset, -offset)
end
end
function UF:FrameGlow_CreateGlow(frame, mouse)
-- Main Glow to wrap the health frame to it's best ability
frame:CreateShadow()
local mainGlow = frame.shadow
mainGlow:SetFrameStrata('BACKGROUND')
mainGlow:Hide()
frame.shadow = nil
-- Secondary Glow for power frame when using power offset or mini power
frame:CreateShadow()
local powerGlow = frame.shadow
powerGlow:SetFrameStrata('BACKGROUND')
powerGlow:Hide()
frame.shadow = nil
if mouse then
mainGlow:SetFrameLevel(4)
powerGlow:SetFrameLevel(4)
else
mainGlow:SetFrameLevel(3)
powerGlow:SetFrameLevel(3)
end
-- Eventing Frame
if not frame.Highlight then
frame.Highlight = CreateFrame('Frame', nil, frame)
frame.Highlight:Hide()
frame.Highlight:HookScript('OnEvent', function(_, event)
if event == 'UPDATE_MOUSEOVER_UNIT' then
UF:FrameGlow_CheckMouseover(frame)
elseif event == 'PLAYER_TARGET_CHANGED' then
UF:FrameGlow_CheckTarget(frame)
end
end)
end
mainGlow.powerGlow = powerGlow
return mainGlow
end
function UF:FrameGlow_SetGlowColor(glow, unit, which)
if not glow then return end
local option = E.db.unitframe.colors.frameGlow[which]
local r, g, b, a = 1, 1, 1, 1
if option.color then
local color = option.color
r, g, b, a = color.r, color.g, color.b, color.a
end
if option.class then
local isPlayer = unit and UnitIsPlayer(unit)
local reaction = unit and UnitReaction(unit, 'player')
if isPlayer then
local _, class = UnitClass(unit)
if class then
local color = _G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[class] or _G.RAID_CLASS_COLORS[class]
if color then
r, g, b = color.r, color.g, color.b
end
end
elseif reaction then
local color = _G.FACTION_BAR_COLORS[reaction]
if color then
r, g, b = color.r, color.g, color.b
end
end
end
if which == 'mouseoverGlow' then
glow:SetVertexColor(r, g, b, a)
else
glow:SetBackdropBorderColor(r, g, b, a)
if glow.powerGlow then
glow.powerGlow:SetBackdropBorderColor(r, g, b, a)
end
end
end
function UF:FrameGlow_HideGlow(glow)
if not glow then return end
if glow:IsShown() then glow:Hide() end
if glow.powerGlow and glow.powerGlow:IsShown() then
glow.powerGlow:Hide()
end
end
function UF:FrameGlow_ConfigureGlow(frame, unit, dbTexture)
if not frame then return end
if not unit then
unit = frame.unit or (frame.isForced and 'player')
end
local shouldHide
if frame.Highlight and frame.Highlight.texture then
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
frame.Highlight.texture:SetTexture(dbTexture)
UF:FrameGlow_SetGlowColor(frame.Highlight.texture, unit, 'mouseoverGlow')
else
shouldHide = 'texture'
end
end
if frame.MouseGlow then
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
UF:FrameGlow_SetGlowColor(frame.MouseGlow, unit, 'mainGlow')
else
UF:FrameGlow_HideGlow(frame.MouseGlow)
if shouldHide then
shouldHide = 'both'
end
end
end
if shouldHide then
if shouldHide == 'both' and frame.Highlight:IsShown() then
frame.Highlight:Hide()
elseif shouldHide == 'texture' then
frame.Highlight.texture:Hide()
end
end
if frame.TargetGlow then
UF:FrameGlow_CheckTarget(frame, true)
end
end
function UF:FrameGlow_CheckTarget(frame, setColor)
if not (frame and frame.TargetGlow and frame:IsVisible()) then return end
local unit = frame.unit or (frame.isForced and 'player')
if E.db.unitframe.colors.frameGlow.targetGlow.enable and (unit and UnitIsUnit(unit, 'target')) and not (frame.db and frame.db.disableTargetGlow) then
if setColor then
UF:FrameGlow_SetGlowColor(frame.TargetGlow, unit, 'targetGlow')
end
if frame.TargetGlow.powerGlow then
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
frame.TargetGlow.powerGlow:Show()
elseif frame.TargetGlow.powerGlow:IsShown() then
frame.TargetGlow.powerGlow:Hide()
end
end
frame.TargetGlow:Show()
else
UF:FrameGlow_HideGlow(frame.TargetGlow)
end
end
function UF:FrameGlow_CheckMouseover(frame)
if not (frame and frame.MouseGlow and frame:IsVisible()) then return end
local shouldShow
if UF:FrameGlow_MouseOnUnit(frame) then
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
shouldShow = 'frame'
end
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
shouldShow = (shouldShow and 'both') or 'texture'
end
end
if shouldShow then
if frame.Highlight and not frame.Highlight:IsShown() then
frame.Highlight:Show()
end
if (shouldShow == 'both' or shouldShow == 'frame') then
if frame.MouseGlow.powerGlow then
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
frame.MouseGlow.powerGlow:Show()
elseif frame.MouseGlow.powerGlow:IsShown() then
frame.MouseGlow.powerGlow:Hide()
end
end
frame.MouseGlow:Show()
if (shouldShow == 'frame') and frame.Highlight.texture and frame.Highlight.texture:IsShown() then
frame.Highlight.texture:Hide()
end
end
if (shouldShow == 'both' or shouldShow == 'texture') and frame.Highlight.texture and not frame.Highlight.texture:IsShown() then
frame.Highlight.texture:Show()
end
elseif frame.Highlight and frame.Highlight:IsShown() then
frame.Highlight:Hide()
end
end
function UF:FrameGlow_PositionHighlight(frame)
if frame.Highlight and frame.Highlight.texture then
frame.Highlight.texture:ClearAllPoints()
frame.Highlight.texture:Point('TOPLEFT', frame.Health, 'TOPLEFT')
frame.Highlight.texture:Point('BOTTOMRIGHT', frame.Health:GetStatusBarTexture(), 'BOTTOMRIGHT')
end
end
function UF:Configure_HighlightGlow(frame)
if frame.Highlight and frame.Highlight.texture then
local dbTexture = UF.LSM:Fetch('statusbar', E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
frame.Highlight.texture:SetTexture(dbTexture)
end
end
function UF:Construct_HighlightGlow(frame, glow)
if frame.Health and frame.Highlight then
frame.Highlight:HookScript('OnHide', function(watcher)
UF:FrameGlow_HideGlow(glow)
if watcher.texture and watcher.texture:IsShown() then
watcher.texture:Hide()
end
end)
frame.Highlight:SetScript('OnUpdate', function(watcher, elapsed)
if watcher.elapsed and watcher.elapsed > 0.1 then
if not UF:FrameGlow_MouseOnUnit(frame) then
watcher:Hide()
end
watcher.elapsed = 0
else
watcher.elapsed = (watcher.elapsed or 0) + elapsed
end
end)
frame.Highlight.texture = frame.Health:CreateTexture('$parentHighlight', 'ARTWORK', nil, 1)
frame.Highlight.texture:Hide()
UF:FrameGlow_ElementHook(frame, frame.Highlight.texture, 'mouseoverGlow')
end
end
function UF:Construct_MouseGlow(frame)
local mainGlow = UF:FrameGlow_CreateGlow(frame, true)
UF:FrameGlow_ElementHook(frame, mainGlow, 'mainGlow')
UF:Construct_HighlightGlow(frame, mainGlow)
frame.Highlight:RegisterEvent('UPDATE_MOUSEOVER_UNIT')
return mainGlow
end
function UF:Construct_TargetGlow(frame)
local targetGlow = UF:FrameGlow_CreateGlow(frame)
UF:FrameGlow_ElementHook(frame, targetGlow, 'targetGlow')
frame.Highlight:RegisterEvent('PLAYER_TARGET_CHANGED')
return targetGlow
end
function UF:FrameGlow_CheckChildren(frame, dbTexture)
if frame.GetName then
local pet = _G[frame:GetName()..'Pet']
if pet then
UF:FrameGlow_ConfigureGlow(pet, pet.unit, dbTexture)
end
local target = _G[frame:GetName()..'Target']
if target then
UF:FrameGlow_ConfigureGlow(target, target.unit, dbTexture)
end
end
end
function UF:FrameGlow_UpdateFrames()
local dbTexture = UF.LSM:Fetch('statusbar', E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
-- focus, focustarget, pet, pettarget, player, target, targettarget, targettargettarget
for unit in pairs(self.units) do
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
end
-- arena{1-5}, boss{1-5}
for unit in pairs(self.groupunits) do
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
end
-- assist, tank, party, raid, raid40, raidpet
for groupName in pairs(self.headers) do
assert(self[groupName], 'UF FrameGlow: Invalid group specified.')
local group = self[groupName]
if group.GetNumChildren then
for i=1, group:GetNumChildren() do
local frame = select(i, group:GetChildren())
if frame and frame.Health then
UF:FrameGlow_ConfigureGlow(frame, frame.unit, dbTexture)
UF:FrameGlow_CheckChildren(frame, dbTexture)
elseif frame then
for n = 1, frame:GetNumChildren() do
local child = select(n, frame:GetChildren())
if child and child.Health then
UF:FrameGlow_ConfigureGlow(child, child.unit, dbTexture)
UF:FrameGlow_CheckChildren(child, dbTexture)
end
end
end
end
end
end
end
|
local utils = require("utils");
local autocmds = {
trim_white_space = {
{"BufWritePre", "*", [[:%s/\s\+$//e]]}
},
haskell_indent = {
{"FileType", "haskell", [[:setlocal shiftwidth=4 softtabstop=4 tabstop=8 expandtab]]}
},
nix_indent = {
{"FileType", "nix", [[:setlocal shiftwidth=2 softtabstop=2 tabstop=2 expandtab]]}
},
}
utils.nvim_create_augroups(autocmds);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.