content
stringlengths 5
1.05M
|
|---|
-- Loads up a slew of objects to load into the screen, like how 3.9 does.
-- I prefer to keep these optional, incase another screen wants to hide
-- these elements.
return Def.ActorFrame {
StandardDecorationFromFileOptional("Header","Header");
StandardDecorationFromFileOptional("Footer","Footer");
StandardDecorationFromFileOptional( "Help", "Help" );
};
|
local Item = QuickCreateItemTable(BaseItem, "money", "Money", "It will bring you happy", "icons/item_cash")
Item.Model = "models/props/cs_assault/Money.mdl"
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "wood", "Wood", "Its wood?", "icons/item_wood")
Item.Model = "models/Gibs/wood_gib01d.mdl"
Item.SellPrice = 7
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_canmeat", "Can of Uncooked Meat", "Needs to be cooked", "icons/junk_metalcan1")
Item.Model = "models/props_junk/garbage_metalcan001a.mdl"
Item.SellPrice = 4
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_cardboard", "Pieace of cardboard", "Its a bit of cardboard used for many things", "icons/junk_metalcan1")
Item.Model = "models/props_junk/garbage_carboard002a.mdl"
Item.SellPrice = 10
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_bagofnoodles", "Bag of Uncooked Noodles", "A bag of uncooked noodles", "icons/junk_metalcan1")
Item.Model = "models/props_junk/garbage_bag001a.mdl"
Item.SellPrice = 20
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_chinese_box", "Chinese Box", "A Chinese Box of Chinese Noodles.", "icons/junk_metalcan1")
Item.Model = "models/Gibs/wood_gib01d.mdl"
Item.SellPrice = 40
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_firestarting_kit", "Fire Starting Kit", "A Kit to make a fire you can cook on.", "icons/junk_box1")
Item.Model = "models/Gibs/wood_gib01d.mdl"
Item.SellPrice = 40
Item.FireTime = 50
Item.Weight = 1
Item.Stackable = true
function Item:Use(usr, itemtable)
if not IsValid(usr) or usr:Health() <= 0 then return end
local Wood = ents.Create("prop_physics")
Wood:SetModel(itemtable.Model)
Wood:SetPos(usr:EyePos() + (usr:GetAimVector() * 50))
Wood:Spawn()
Wood:DropToFloor()
Wood:Ignite(itemtable.FireTime,0)
Wood:PhysicsInit(SOLID_VPHYSICS)
Wood:SetMoveType(MOVETYPE_NONE)
local Fire = ents.Create("env_fire")
Fire:SetParent(Wood)
Fire:SetKeyValue("health", itemtable.FireTime)
Fire:SetKeyValue("firesize", "0.1")
Fire:SetPos(Wood:GetPos())
Fire:Spawn()
timer.Simple(itemtable.FireTime, function() Wood:Remove() Fire:Remove() end)
usr:AddItem(itemtable.Name, -1)
end
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_spoilednoodles", "Spoiled Chinese Noodles", "A Chinese Box of Spoiled Chinese Noodles.", "icons/junk_metalcan1")
Item.Model = "models/props_junk/garbage_takeoutcarton001a.mdl"
Item.SellPrice = 60
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseFood, "item_package", "Package", "A package you can put food in.", "icons/junk_metalcan1")
Item.Model = "models/props_junk/garbage_takeoutcarton001a.mdl"
Item.SellPrice = 40
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_tincan", "Tin Can", "Rusty and old, black stuff in the bottom", "icons/junk_metalcan2")
Item.Model = "models/props_junk/garbage_metalcan002a.mdl"
Item.SellPrice = 10
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_methanol", "Methanol", "This is a cool fuel source", "icons/Quest_ZombieBlood")
Item.Model = "models/props_junk/garbage_metalcan001a.mdl"
Item.SellPrice = 25
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_fuel", "Fuel", "Used in many aplications for a flamable combustant.", "icons/Quest_ZombieBlood")
Item.Model = "models/props_junk/metalgascan.mdl"
Item.SellPrice = 80
Item.Weight = 1
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_charcoal", "Charcoal", "Not to be confused with coal", "icons/Quest_ZombieBlood")
Item.Model = "models/props_lab/box01a.mdl"
Item.SellPrice = 12
Item.Weight = 1
Item.Stackable = true
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_blackpowder", "Black Powder", "It's dry and finely ground, what to use it for ...", "icons/Quest_ZombieBlood")
Item.Model = "models/props_lab/box01a.mdl"
Item.SellPrice = 120
Item.Weight = 1
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_explosivespin", "Explosives Pin", "Small explosive charge in a pin.", "icons/Quest_ZombieBlood")
Item.Model = "models/props_junk/glassjug01.mdl"
Item.SellPrice = 210
Item.Weight = 1
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "weapon_melee_wrench", "Wrench", "Tool used for making things", "icons/tool_wrench")
Item.Model = "models/props_c17/tools_wrench01a.mdl"
Item.SellPrice = 250
Item.Weight = 1
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_antlionblood", "Antlion Blood", "Its yellow, and kida smells like raspberries", "icons/Quest_ZombieBlood")
Item.Model = "models/props_junk/glassjug01.mdl"
Item.SellPrice = 460
Item.Weight = 1
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_trade_pliers", "Pliers", "Would be useful for making things", "icons/tool_wrench")
Item.Model = "models/props_c17/tools_pliers01a.mdl"
Item.SellPrice = 500
Item.Weight = 1
Register.Item(Item)
local Item = QuickCreateItemTable(BaseItem, "item_grenade", "Grenade", "Use to throw.", "icons/Quest_ZombieBlood")
Item.Model = "models/props_junk/glassjug01.mdl"
Item.Stackable = true
Item.SellPrice = 40
Item.Weight = 1
function Item:Use(usr, itemtable)
if not IsValid(usr) or usr:Health() <= 0 then return end
if (usr.NextNade or CurTime()) > CurTime() then return end
usr:RestartGesture(ACT_ITEM_THROW)
local Nade = ents.Create("npc_grenade_frag")
timer.Simple(1, function()
if IsValid(Nade) and IsValid(usr) then
local vecNadePos = usr:EyePos() + (usr:GetAimVector() * 50)
local intNadeDur = 3
Nade:SetOwner(usr)
Nade:Fire("SetTimer", intNadeDur)
Nade.OverrideDamge = 50
Nade:SetPos(vecNadePos)
Nade:SetAngles(usr:EyeAngles())
Nade:Spawn()
Nade:GetPhysicsObject():ApplyForceCenter(usr:GetAimVector():GetNormalized() * 600)
end
end)
usr.NextNade = CurTime() + 2
usr:AddItem(itemtable.Name, -1)
end
Register.Item(Item)
|
-- Copyright (C) 2011-2015 Anton Burdinuk
-- clark15b@gmail.com
-- https://tsdemuxer.googlecode.com/svn/trunk/xupnpd
http_mime={}
http_err={}
http_vars={}
-- http_mime types
http_mime['html']='text/html'
http_mime['htm']='text/html'
http_mime['xml']='text/xml; charset="UTF-8"'
http_mime['txt']='text/plain'
http_mime['srt']='video/subtitle'
http_mime['cpp']='text/plain'
http_mime['h']='text/plain'
http_mime['lua']='text/plain'
http_mime['jpg']='image/jpeg'
http_mime['png']='image/png'
http_mime['ico']='image/vnd.microsoft.icon'
http_mime['mpeg']='video/mpeg'
http_mime['css']='text/css'
http_mime['json']='application/json'
http_mime['js']='application/javascript'
http_mime['m3u']='audio/x-mpegurl'
-- http http_error list
http_err[100]='Continue'
http_err[101]='Switching Protocols'
http_err[200]='OK'
http_err[201]='Created'
http_err[202]='Accepted'
http_err[203]='Non-Authoritative Information'
http_err[204]='No Content'
http_err[205]='Reset Content'
http_err[206]='Partial Content'
http_err[300]='Multiple Choices'
http_err[301]='Moved Permanently'
http_err[302]='Moved Temporarily'
http_err[303]='See Other'
http_err[304]='Not Modified'
http_err[305]='Use Proxy'
http_err[400]='Bad Request'
http_err[401]='Unauthorized'
http_err[402]='Payment Required'
http_err[403]='Forbidden'
http_err[404]='Not Found'
http_err[405]='Method Not Allowed'
http_err[406]='Not Acceptable'
http_err[407]='Proxy Authentication Required'
http_err[408]='Request Time-Out'
http_err[409]='Conflict'
http_err[410]='Gone'
http_err[411]='Length Required'
http_err[412]='Precondition Failed'
http_err[413]='Request Entity Too Large'
http_err[414]='Request-URL Too Large'
http_err[415]='Unsupported Media Type'
http_err[416]='Requested range not satisfiable'
http_err[500]='Internal Server http_error'
http_err[501]='Not Implemented'
http_err[502]='Bad Gateway'
http_err[503]='Out of Resources'
http_err[504]='Gateway Time-Out'
http_err[505]='HTTP Version not supported'
http_vars['fname']=cfg.name
http_vars['manufacturer']=util.xmlencode('Anton Burdinuk <clark15b@gmail.com>')
http_vars['manufacturer_url']=''
http_vars['description']=ssdp_server
http_vars['name']='xupnpd'
http_vars['version']=cfg.version
http_vars['url']='http://xupnpd.org'
http_vars['uuid']=ssdp_uuid
http_vars['interface']=ssdp.interface()
http_vars['port']=cfg.http_port
http_vars['uptime']=core.uptime
http_templ=
{
'/dev.xml',
'/wmc.xml',
'/index.html'
}
dofile('xupnpd_soap.lua')
dofile('xupnpd_webapp.lua')
function compile_templates()
local path=cfg.tmp_path..'xupnpd-cache'
os.execute('mkdir -p '..path)
for i,fname in ipairs(http_templ) do
http.compile_template(cfg.www_root..fname,path..fname,http_vars)
end
end
function http_send_headers(err,ext,len)
http.send(
string.format(
'HTTP/1.1 %i %s\r\nPragma: no-cache\r\nCache-control: no-cache\r\nDate: %s\r\nServer: %s\r\nAccept-Ranges: none\r\n'..
'Connection: close\r\nContent-Type: %s\r\nEXT:\r\n',
err,http_err[err] or 'Unknown',os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,http_mime[ext] or 'application/x-octet-stream')
)
if len then http.send(string.format("Content-Length: %s\r\n",len)) end
http.send("\r\n")
if cfg.debug>0 and err~=200 then print('http error '..err) end
end
function get_soap_method(s)
local i=string.find(s,'#',1,true)
if not i then return s end
return string.sub(s,i+1)
end
function plugin_sendurl_from_cache(url,range)
local c=cache[url]
if c==nil or c.value==nil then return false end
if cfg.debug>0 then print('Cache URL: '..c.value) end
local rc,location,l
location=c.value
for i=1,5,1 do
rc,l=http.sendurl(location,1,range)
if l then
location=l
core.sendevent('store',url,location)
if cfg.debug>0 then print('Redirect #'..i..' to: '..location) end
else
if rc~=0 then return true end
if cfg.debug>0 then print('Retry #'..i..' location: '..location) end
end
end
return false
end
function plugin_sendurl(url,real_url,range)
local rc,location,l
location=real_url
core.sendevent('store',url,real_url)
for i=1,5,1 do
rc,l=http.sendurl(location,1,range)
if l then
location=l
core.sendevent('store',url,location)
if cfg.debug>0 then print('Redirect #'..i..' to: '..location) end
else
if rc~=0 then return true end
if cfg.debug>0 then print('Retry #'..i..' location: '..location) end
end
end
return false
end
function plugin_sendfile(path)
local len=util.getflen(path)
if len then
http.send(string.format('Content-Length: %s\r\n\r\n',len))
http.sendfile(path)
else
http.send('\r\n')
end
end
function plugin_download(url)
local data,location
location=url
for i=1,5,1 do
data,location=http.download(location)
if not location then
return data
else
if cfg.debug>0 then print('Redirect #'..i..' to: '..location) end
end
end
return nil
end
function plugin_get_length(url)
local len,location
location=url
for i=1,5,1 do
len,location=http.get_length(location)
if not location then
return len
else
if cfg.debug>0 then print('Redirect #'..i..' to: '..location) end
end
end
return 0
end
function http_get_action(url)
local t=split_string(url,'/')
return t[1] or '', string.match(t[2] or '','^([%w_]+)%.?%w*') or ''
end
local http_ui_main=cfg.ui_path..'xupnpd_ui.lua'
if not util.getflen(http_ui_main) then
http_ui_main=nil
end
function http_handler(what,from,port,msg)
if not msg or not msg.reqline then return end
local pr_name=nil
if cfg.profiles then
pr_name=profile_change(msg['user-agent'],msg)
if msg.reqline[2]=='/dev.xml' then msg.reqline[2]=cfg.dev_desc_xml end
end
if msg.reqline[2]=='/' then
if http_ui_main then msg.reqline[2]='/ui' else msg.reqline[2]='/index.html' end
end
local head=false
local f=util.geturlinfo(cfg.www_root,msg.reqline[2])
if not f or (msg.reqline[3]~='HTTP/1.0' and msg.reqline[3]~='HTTP/1.1') then
http_send_headers(400)
return
end
if cfg.debug>0 then print(string.format('%s %s %s "%s" [%s]',from,msg.reqline[1],msg.reqline[2],msg['user-agent'] or '',pr_name or 'generic')) end
local from_ip=string.match(from,'(.+):.+')
if string.find(f.url,'^/ui/?') then
if not http_ui_main then
http_send_headers(404)
else
dofile(http_ui_main)
ui_handler(f.args,msg.data or '',from_ip,f.url)
end
return
elseif string.find(f.url,'^/app/?') then
webapp_handler(f.args,msg.data or '',from_ip,f.url)
return
end
if msg.reqline[1]=='HEAD' then head=true msg.reqline[1]='GET' end
local url,object=http_get_action(f.url)
-- UPnP SOAP Exchange
if url=='soap' then
if not msg.soapaction then msg.soapaction=f.args.action end
if cfg.debug>0 then print(from..' SOAP '..(msg.soapaction or '')) end
local err=true
local s=services[object ]
if s then
local func_name=get_soap_method(msg.soapaction or '')
local func=s[func_name]
if func then
if cfg.debug>1 then print(msg.data) end
local r=soap.find('Envelope/Body/'..func_name,soap.parse(msg.data or ''))
if not r then r=f.args end
r=func(r or {},from_ip)
if r then
local resp=
string.format(
'<?xml version=\"1.0\" encoding=\"utf-8\"?>'..
'<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">'..
'<s:Body><u:%sResponse xmlns:u=\"%s\">%s</u:%sResponse></s:Body></s:Envelope>',
func_name,s.schema,soap.serialize_vector(r),func_name)
local resp_len=resp:len() if cfg.soap_length==false then resp_len=nil end
http_send_headers(200,'xml',resp_len)
http.send(resp)
if cfg.debug>2 then print(resp) end
err=false
end
end
end
if err==true then
local resp=
'<?xml version=\"1.0\" encoding=\"utf-8\"?>'..
'<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">'..
'<s:Body>'..
'<s:Fault>'..
'<faultcode>s:Client</faultcode>'..
'<faultstring>UPnPError</faultstring>'..
'<detail>'..
'<u:UPnPError xmlns:u=\"urn:schemas-upnp-org:control-1-0\">'..
'<u:errorCode>501</u:errorCode>'..
'<u:errorDescription>Action Failed</u:errorDescription>'..
'</u:UPnPError>'..
'</detail>'..
'</s:Fault>'..
'</s:Body>'..
'</s:Envelope>'
local resp_len=resp:len() if cfg.soap_length==false then resp_len=nil end
http_send_headers(200,'xml',resp_len)
http.send(resp)
if cfg.debug>0 then print('upnp error 501') end
end
-- UPnP Events
elseif url=='event' then
if msg.reqline[1]=='SUBSCRIBE' then
local ttl=cfg.dlna_subscribe_ttl
local sid=nil
local callback=nil
if msg.sid then sid=string.match(msg.sid,'uuid:(.+)') else sid=core.uuid() end
if msg.callback then callback=string.match(msg.callback,'<(.+)>') end
if object~='' then
core.sendevent('subscribe',object,sid,callback,ttl)
end
http.send(
string.format(
'HTTP/1.1 200 OK\r\nPragma: no-cache\r\nCache-control: no-cache\r\nDate: %s\r\nServer: %s\r\nAccept-Ranges: none\r\n'..
'Connection: close\r\nEXT:\r\nSID: uuid:%s\r\nTIMEOUT: Second-%d\r\n\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,sid,ttl))
elseif msg.reqline[1]=='UNSUBSCRIBE' then
if msg.sid then
core.sendevent('unsubscribe',string.match(msg.sid,'uuid:(.+)'))
end
http.send(
string.format(
'HTTP/1.1 200 OK\r\nPragma: no-cache\r\nCache-control: no-cache\r\nDate: %s\r\nServer: %s\r\nAccept-Ranges: none\r\n'..
'Connection: close\r\nEXT:\r\n\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server))
else
http_send_headers(404)
end
-- UPnP Streaming
elseif url=='proxy' then
local pls=find_playlist_object(object)
if not pls then http_send_headers(404) return end
local mtype,extras=playlist_item_type(pls)
http.send(string.format(
'HTTP/1.1 200 OK\r\nPragma: no-cache\r\nCache-control: no-cache\r\nDate: %s\r\nServer: %s\r\n'..
'Connection: close\r\nContent-Type: %s\r\nEXT:\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,mtype[3]))
if cfg.dlna_headers==true then http.send('TransferMode.DLNA.ORG: Streaming\r\nContentFeatures.DLNA.ORG: '..extras..'\r\n') end
if cfg.content_disp==true then
http.send(string.format('Content-Disposition: attachment; filename=\"%s.%s\"\r\n',pls.objid,pls.type)) -- string.gsub(pls.name,"[\/#|@&*`']","_")
end
if head==true then
http.send('\r\n')
http.flush()
else
if pls.event then core.sendevent(pls.event,pls.url) end
if cfg.debug>0 then print(from..' PROXY '..pls.url..' <'..mtype[3]..'>') end
core.sendevent('status',util.getpid(),from_ip..' '..pls.name)
if pls.plugin then
http.send('Accept-Ranges: bytes\r\n')
http.flush()
local p=plugins[pls.plugin]
if p and p.disabled~=true then p.sendurl(pls.url,msg.range) end
else
if cfg.wdtv==true then
http.send('Content-Size: 65535\r\n')
http.send('Content-Length: 65535\r\n')
end
http.send('Accept-Ranges: none\r\n\r\n')
if string.find(pls.url,'^udp://@') then
http.sendmcasturl(string.sub(pls.url,8),cfg.mcast_interface,2048)
else
local rc,location
location=pls.url
for i=1,5,1 do
rc,location=http.sendurl(location)
if not location then
break
else
if cfg.debug>0 then print('Redirect #'..i..' to: '..location) end
end
end
end
end
end
-- UPnP AlbumArt
elseif url=='logo' then
local pls=find_playlist_object(object)
if not pls or not pls.logo then http_send_headers(404) return end
http.send(string.format(
'HTTP/1.1 200 OK\r\nDate: %s\r\nServer: %s\r\nConnection: close\r\nAccept-Ranges: none\r\nContent-Type: %s\r\nEXT:\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,http_mime['jpg']))
if cfg.dlna_headers==true then http.send('ContentFeatures.DLNA.ORG: DLNA.ORG_PN=JPEG_TN\r\n') end
if head==true then
http.send('\r\n')
else
if cfg.debug>0 then print(from..' LOGO '..pls.logo) end
http.sendurl(pls.logo,1)
end
-- Subtitle
elseif url=='sub' then
local pls=find_playlist_object(object)
if not pls or not pls.path then http_send_headers(404) return end
local path=string.gsub(pls.path,'.%w+$','.srt')
local flen=util.getflen(path)
if not flen then http_send_headers(404) return end
http.send(string.format(
'HTTP/1.1 200 OK\r\nDate: %s\r\nServer: %s\r\nConnection: close\r\nAccept-Ranges: none\r\nContent-Type: %s\r\nContent-Length: %s\r\nEXT:\r\n\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,http_mime['srt'],flen))
if head~=true then
if cfg.debug>0 then print(from..' SUB '..path) end
http.sendfile(path)
end
-- UPnP Local files streaming
elseif url=='stream' then
local pls=find_playlist_object(object)
if not pls or not pls.path then http_send_headers(404) return end
local flen=pls.length
local ffrom=0
local flen_total=flen
if msg.range and flen and flen>0 then
local f,t=string.match(msg.range,'bytes=(.*)-(.*)')
f=tonumber(f)
t=tonumber(t)
if not f then f=0 end
if not t then t=flen-1 end
if f>t or t+1>flen then http_send_headers(416) return end
ffrom=f
flen=t-f+1
end
local mtype,extras=playlist_item_type(pls)
http.send(string.format(
'HTTP/1.1 200 OK\r\nPragma: no-cache\r\nCache-control: no-cache\r\nDate: %s\r\nServer: %s\r\n'..
'Connection: close\r\nContent-Type: %s\r\nEXT:\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,mtype[3]))
if flen then
http.send(string.format('Accept-Ranges: bytes\r\nContent-Length: %s\r\n',flen))
else
http.send('Accept-Ranges: none\r\n')
end
if cfg.dlna_headers==true then http.send('TransferMode.DLNA.ORG: Streaming\r\nContentFeatures.DLNA.ORG: '..extras..'\r\n') end
if cfg.content_disp==true then
http.send(string.format('Content-Disposition: attachment; filename=\"%s.%s\"\r\n',pls.objid,pls.type))
end
if msg.range and flen and flen>0 then
http.send(string.format('Content-Range: bytes %s-%s/%s\r\n',ffrom,ffrom+flen-1,flen_total))
end
http.send('\r\n')
http.flush()
if head~=true then
if pls.event then core.sendevent(pls.event,pls.path) end
if cfg.debug>0 then print(from..' STREAM '..pls.path..' <'..mtype[3]..'>') end
core.sendevent('status',util.getpid(),from_ip..' '..pls.name)
http.sendfile(pls.path,ffrom,flen)
end
else
if f.type=='none' then http_send_headers(404) return end
if f.type~='file' then http_send_headers(403) return end
local tmpl_name=nil
for i,fname in ipairs(http_templ) do
if f.url==fname then tmpl_name=cfg.tmp_path..'xupnpd-cache'..fname break end
end
local len=nil
if not tmpl_name then len=f.length else len=util.getflen(tmpl_name) end
http.send(
string.format(
'HTTP/1.1 200 OK\r\nDate: %s\r\nServer: %s\r\nAccept-Ranges: none\r\nConnection: close\r\nContent-Type: %s\r\nEXT:\r\n',
os.date('!%a, %d %b %Y %H:%M:%S GMT'),ssdp_server,http_mime[f.ext] or 'application/x-octet-stream'))
if len then
http.send(string.format('Content-Length: %s\r\n',len))
end
http.send('\r\n')
if head~=true then
if cfg.debug>0 then print(from..' FILE '..f.path) end
if tmpl_name~=nil then
if len then http.sendfile(tmpl_name) else http.sendtfile(f.path,http_vars) end
else
http.sendfile(f.path)
end
end
end
http.flush()
end
compile_templates()
events["http"]=http_handler
http.listen(cfg.http_port,"http")
|
local base = {}
function base:new( parent )
local instance = {}
setmetatable( instance, self.meta )
instance:setparent( parent )
instance.visible = true
instance.children = {}
instance.AABB = {0,0,0,0}
instance.x = 0
instance.y = 0
instance.w = 0
instance.h = 0
instance.hoverstate = 'off'
goo.newinstance( instance, parent )
instance:init( parent )
return instance
end
function base:setparent( parent )
if not parent then return end
if self.parent then self.parent:removechild( self ) end
self.parent = parent
self.parent:addchild( self )
end
function base:addchild( child )
table.insert( self.children, child )
end
function base:removechild( child )
for k, existing_child in ipairs( self.children ) do
if existing_child == child then table.remove( self.children, k ) end
end
end
function base:init()
end
function base:update(dt)
self:updatebounds()
local mx, my = love.mouse.getPosition()
local m_left = love.mouse.isDown('l')
if self:inbounds( mx, my ) then
if self.hoverstate ~= 'click' then
self.hoverstate = 'over'
end
else
self.hoverstate = 'off'
end
end
function base:draw() end
function base:drawall()
self:draw()
for k, child in ipairs( self.children ) do
child:drawall()
end
end
function base:mousepressed() self.hoverstate = 'click' end
function base:mousereleased() self.hoverstate = 'off' end
function base:keypressed() end
function base:keyreleased() end
function base:inbounds( x, y )
local ax, ay = self.AABB[1], self.AABB[2]
local bx, by = self.AABB[3], self.AABB[4]
if x > ax and x < bx and y > ay and y < by then
return true
else
return false
end
end
function base:setbounds( ax, ay, bx, by )
self.AABB = {ax,ay,bx,by}
self.x = ax
self.y = ay
self.w = bx-ax
self.h = by-ay
end
function base:updatebounds()
local ax, ay = self.x, self.y
local bx, by = self.x + self.w, self.y + self.h
self.AABB = {ax,ay,bx,by}
end
function base:setpos( x, y )
self.x = x
self.y = y
end
function base:setsize( w, h )
self.w = w
self.h = h
end
function base:setcolor( colorname )
love.graphics.setColor( unpack( goo.skin[ self.name ][ colorname ] ) )
end
function base:getskinvar( varname )
return goo.skin[ self.name ][ varname ]
end
return base
|
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Genarated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
local colors = {
color0 = "#282c34",
color1 = "#61afef",
color2 = "#dcdfe4",
color3 = "#5d677a",
color4 = "#313640",
color5 = "#98c379",
color6 = "#e5c07b",
color7 = "#e06c75",
}
local onehalfdark = {
insert = {
a = { fg = colors.color0, bg = colors.color1 , "bold", },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color1, bg = colors.color4 },
},
normal = {
a = { fg = colors.color0, bg = colors.color5 , "bold", },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color5, bg = colors.color4 },
},
inactive = {
a = { fg = colors.color2, bg = colors.color3 , "bold", },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color2, bg = colors.color4 },
},
visual = {
a = { fg = colors.color0, bg = colors.color6 , "bold", },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color6, bg = colors.color4 },
},
replace = {
a = { fg = colors.color0, bg = colors.color7 , "bold", },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color7, bg = colors.color4 },
},
}
return onehalfdark
|
--imports--
local api = require"novus.api"
local util = require"novus.snowflakes.helpers"
local snowflake = require"novus.snowflakes"
local permission = require"novus.util.permission"
local modifiable = require"novus.snowflakes.mixins.modifiable"
local cqueues = require"cqueues"
local null = require"cjson".null
local setmetatable = setmetatable
local gettime = cqueues.monotime
local running = cqueues.running
local snowflakes = snowflake.snowflakes
--start-module--
local _ENV = snowflake "role"
schema {
"guild_id" --4
,"name" --5
,"color" --6
,"hoisted" --7
,"position" --8
,"permissions" --9
,"managed" --10
,"is_mentionable" -- 11
}
function new_from( state, payload )
return setmetatable({
util.uint(payload.id)
,gettime()
,state.cache.methods.role
,util.uint(payload.guild_id)
,payload.name
,payload.color
,payload.hoist
,payload.position
,payload.permissions
,payload.managed
,payload.mentionable
}, _ENV)
end
function methods.delete(role)
local state = running():novus()
local success, data, err = api.delete_guild_role(state.api, role[4], role[1])
if success and data then
return true
else
return false, err
end
end
_ENV = modifiable(_ENV, api.modify_guild_role) -- endow with modify
function methods.set_name(role, name)
return modify(role, {name = name or null})
end
function methods.set_color(role, color)
return modify(role, {color = color or null})
end
function methods.set_permissions(role, p)
return modify(role, {permissions = p or null})
end
function methods.hoist(role)
return modify(role, {hoist = true})
end
function methods.unhoist(role)
return modify(role, {hoist = false})
end
function methods.mentionable(role)
return modify(role, {mentionable = true})
end
function methods.unmentionable(role)
return modify(role, {mentionable = true})
end
function methods.enable(role, ...)
return methods.set_permissions(role, permission.enable(role[9], ...))
end
function methods.disable(role, ...)
return methods.set_permissions(role, permission.disable(role[9], ...))
end
function methods.can(role, ...)
return permission.contains(role[9], ...)
end
function methods.move_up(role, by)
return role.guild:move_role_up(role, by)
end
function methods.move_down(role, by)
return role.guild:move_role_down(role, by)
end
methods.move = methods.move_up
function properties.guild(role)
local parent = snowflakes.guild.get(role[4])
return parent
end
function properties.mention(role)
return "<@&%s>" % role[1]
end
function get_from(state, guild_id, id)
local cache = state.cache.role
if cache[id] then return cache[id]
else
local guild = state.cache.guild[guild_id]
return guild:loadget_role(id)
end
end
--end-module--
return _ENV
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.BogeyDistance = 650 -- Needed for gm trainspawner
--------------------------------------------------------------------------------
function ENT:Initialize()
-- Defined train information
self.SubwayTrain = {
Type = "E",
Name = "Ema508T",
}
-- Set model and initialize
self:SetModel("models/metrostroi/81/ema508t.mdl")
self.BaseClass.Initialize(self)
self:SetPos(self:GetPos() + Vector(0,0,140))
-- Create bogeys
self.FrontBogey = self:CreateBogey(Vector( 325-20,0,-80),Angle(0,180,0),true)
self.RearBogey = self:CreateBogey(Vector(-325-10,0,-80),Angle(0,0,0),false)
self.InteractionZones = {
{ Pos = Vector(458,-30,-55),
Radius = 16,
ID = "FrontBrakeLineIsolationToggle" },
{ Pos = Vector(458, 30,-55),
Radius = 16,
ID = "FrontTrainLineIsolationToggle" },
{ Pos = Vector(-482,30,-55),
Radius = 16,
ID = "RearBrakeLineIsolationToggle" },
{ Pos = Vector(-482, -30,-55),
Radius = 16,
ID = "RearTrainLineIsolationToggle" },
{ Pos = Vector(154,62.5,-65),
Radius = 16,
ID = "GVToggle" },
{ Pos = Vector(446.0,0.0,50),
Radius = 16,
ID = "VBToggle" },
{ Pos = Vector(-180,68.5,-50),
Radius = 20,
ID = "AirDistributorDisconnectToggle" },
}
-- Lights
self.Lights = {
-- Head
[1] = { "headlight", Vector(465,0,-20), Angle(0,0,0), Color(176,161,132), fov = 100 },
[2] = { "glow", Vector(460, 51,-23), Angle(0,0,0), Color(255,255,255), brightness = 2 },
[3] = { "glow", Vector(460,-51,-23), Angle(0,0,0), Color(255,255,255), brightness = 2 },
[4] = { "glow", Vector(460,-8, 55), Angle(0,0,0), Color(255,255,255), brightness = 0.3 },
[5] = { "glow", Vector(460,-8, 55), Angle(0,0,0), Color(255,255,255), brightness = 0.3 },
[6] = { "glow", Vector(460, 2, 55), Angle(0,0,0), Color(255,255,255), brightness = 0.3 },
[7] = { "glow", Vector(460, 2, 55), Angle(0,0,0), Color(255,255,255), brightness = 0.3 },
-- Reverse
[8] = { "light", Vector(458,-45, 55), Angle(0,0,0), Color(255,0,0), brightness = 10, scale = 1.0 },
[9] = { "light", Vector(458, 45, 55), Angle(0,0,0), Color(255,0,0), brightness = 10, scale = 1.0 },
-- Cabin
[10] = { "dynamiclight", Vector( 420, 0, 35), Angle(0,0,0), Color(255,255,255), brightness = 0.1, distance = 550 },
-- Interior
--[11] = { "dynamiclight", Vector( 250, 0, 5), Angle(0,0,0), Color(255,255,255), brightness = 3, distance = 250 },
[12] = { "dynamiclight", Vector( 0, 0, 5), Angle(0,0,0), Color(255,255,255), brightness = 3, distance = 400 },
--[13] = { "dynamiclight", Vector(-250, 0, 5), Angle(0,0,0), Color(255,255,255), brightness = 3, distance = 250 },
-- Side lights
[14] = { "light", Vector(-50, 68, 51.9), Angle(0,0,0), Color(255,0,0), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[15] = { "light", Vector(6, 68, 51.9), Angle(0,0,0), Color(150,255,255), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[16] = { "light", Vector(3, 68, 51.9), Angle(0,0,0), Color(50,255,0), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[17] = { "light", Vector(-0, 68, 51.9), Angle(0,0,0), Color(255,255,0), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[18] = { "light", Vector(-50, -69, 51.9), Angle(0,0,0), Color(255,0,0), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[19] = { "light", Vector(6, -69, 51.9), Angle(0,0,0), Color(150,255,255), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[20] = { "light", Vector(3, -69, 51.9), Angle(0,0,0), Color(50,255,0), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
[21] = { "light", Vector(-0, -69, 51.9), Angle(0,0,0), Color(255,255,0), brightness = 0.9, scale = 0.10, texture = "models/metrostroi_signals/signal_sprite_002.vmt" },
-- Green RP
[22] = { "light", Vector(439.4,12.5-9.6,-5.7), Angle(0,0,0), Color(100,255,0), brightness = 1.0, scale = 0.020 },
-- AVU
[23] = { "light", Vector(441.2,12.5-20.3,-3.7), Angle(0,0,0), Color(255,40,0), brightness = 1.0, scale = 0.020 },
-- LKTP
[24] = { "light", Vector(441.2,12.5-23.0,-3.7), Angle(0,0,0), Color(255,40,0), brightness = 1.0, scale = 0.020 },
}
-- Cross connections in train wires
self.TrainWireCrossConnections = {
[5] = 4, -- Reverser F<->B
[31] = 32, -- Doors L<->R
}
-- Setup door positions
self.LeftDoorPositions = {}
self.RightDoorPositions = {}
for i=0,3 do
table.insert(self.LeftDoorPositions,Vector(353.0 - 35*0.5 - 231*i,65,-1.8))
table.insert(self.RightDoorPositions,Vector(353.0 - 35*0.5 - 231*i,-65,-1.8))
end
end
--------------------------------------------------------------------------------
function ENT:Think()
local retVal = self.BaseClass.Think(self)
self.Electric:TriggerInput("TrainMode",1)
-- Interior/cabin lights
-- self:SetLightPower(10, (self.Panel["CabinLight"] > 0.5))
self:SetLightPower(12, self.PowerSupply.XT3_4 > 65.0)
-- self:SetLightPower(13, self.PowerSupply.XT3_4 > 65.0)
-- Side lights
self:SetLightPower(15, self.Panel["TrainDoors"] > 0.5)
self:SetLightPower(19, self.Panel["TrainDoors"] > 0.5)
self:SetLightPower(16, (self.Panel["GreenRP"] or 0) > 0.5)
self:SetLightPower(20, (self.Panel["GreenRP"] or 0) > 0.5)
self:SetLightPower(17, self.Panel["TrainBrakes"] > 0.5)
self:SetLightPower(21, self.Panel["TrainBrakes"] > 0.5)
-- Switch and button states
self:SetPackedBool(0,self:IsWrenchPresent())
self:SetPackedBool(5,self.GV.Value == 1.0)
self:SetPackedBool(7,self.VB.Value == 1.0)
self:SetPackedBool(20,self.Pneumatic.Compressor == 1.0)
self:SetPackedBool(21,self.Pneumatic.LeftDoorState[1] > 0.5)
self:SetPackedBool(22,self.Pneumatic.LeftDoorState[2] > 0.5)
self:SetPackedBool(23,self.Pneumatic.LeftDoorState[3] > 0.5)
self:SetPackedBool(24,self.Pneumatic.LeftDoorState[4] > 0.5)
self:SetPackedBool(25,self.Pneumatic.RightDoorState[1] > 0.5)
self:SetPackedBool(26,self.Pneumatic.RightDoorState[2] > 0.5)
self:SetPackedBool(27,self.Pneumatic.RightDoorState[3] > 0.5)
self:SetPackedBool(28,self.Pneumatic.RightDoorState[4] > 0.5)
self:SetPackedBool(112,(self.RheostatController.Velocity ~= 0.0))
-- Signal if doors are open or no to platform simulation
self.LeftDoorsOpen =
(self.Pneumatic.LeftDoorState[1] > 0.5) or
(self.Pneumatic.LeftDoorState[2] > 0.5) or
(self.Pneumatic.LeftDoorState[3] > 0.5) or
(self.Pneumatic.LeftDoorState[4] > 0.5)
self.RightDoorsOpen =
(self.Pneumatic.RightDoorState[1] > 0.5) or
(self.Pneumatic.RightDoorState[2] > 0.5) or
(self.Pneumatic.RightDoorState[3] > 0.5) or
(self.Pneumatic.RightDoorState[4] > 0.5)
-- BPSN
self:SetPackedBool(52,self.PowerSupply.XT3_1 > 0)
-- AV states
for i,v in ipairs(self.Panel.AVMap) do
if tonumber(v)
then self:SetPackedBool(64+(i-1),self["A"..v].Value == 1.0)
else self:SetPackedBool(64+(i-1),self[v].Value == 1.0)
end
end
-- Feed packed floats
self:SetPackedRatio(0, 1-self.Pneumatic.DriverValvePosition/5)
--self:SetPackedRatio(1, (self.KV.ControllerPosition+3)/7)
--self:SetPackedRatio(2, 1-(self.KV.ReverserPosition+1)/2)
self:SetPackedRatio(4, self.Pneumatic.ReservoirPressure/16.0)
self:SetPackedRatio(5, self.Pneumatic.TrainLinePressure/16.0)
self:SetPackedRatio(6, self.Pneumatic.BrakeCylinderPressure/6.0)
self:SetPackedRatio(7, self.Electric.Power750V/1000.0)
self:SetPackedRatio(8, math.abs(self.Electric.I24)/1000.0)
--self:SetPackedRatio(9, self.Pneumatic.BrakeLinePressure_dPdT or 0)
if self.Pneumatic.TrainLineOpen then
self:SetPackedRatio(9, (self.Pneumatic.TrainLinePressure_dPdT or 0)*6)
else
self:SetPackedRatio(9, self.Pneumatic.BrakeLinePressure_dPdT or 0)
end
--self:SetPackedRatio(10,(self.Panel["V1"] * self.Battery.Voltage) / 100.0)
-- RUT test
local weightRatio = 2.00*math.max(0,math.min(1,(self:GetPassengerCount()/300)))
if math.abs(self:GetAngles().pitch) > 2.5 then weightRatio = weightRatio + 1.00 end
self.YAR_13A:TriggerInput("WeightLoadRatio",math.max(0,math.min(2.50,weightRatio)))
-- Exchange some parameters between engines, pneumatic system, and real world
self.Engines:TriggerInput("Speed",self.Speed)
if IsValid(self.FrontBogey) and IsValid(self.RearBogey) then
self.FrontBogey.MotorForce = 35300
self.FrontBogey.Reversed = (self.RKR.Value > 0.5)
self.RearBogey.MotorForce = 35300
self.RearBogey.Reversed = (self.RKR.Value < 0.5)
-- These corrections are required to beat source engine friction at very low values of motor power
local A = 2*self.Engines.BogeyMoment
local P = math.max(0,0.04449 + 1.06879*math.abs(A) - 0.465729*A^2)
if math.abs(A) > 0.4 then P = math.abs(A) end
if math.abs(A) < 0.05 then P = 0 end
if self.Speed < 10 then P = P*(1.0 + 0.5*(10.0-self.Speed)/10.0) end
self.RearBogey.MotorPower = P*0.5*((A > 0) and 1 or -1)
self.FrontBogey.MotorPower = P*0.5*((A > 0) and 1 or -1)
-- Apply brakes
self.FrontBogey.PneumaticBrakeForce = 40000.0
self.FrontBogey.BrakeCylinderPressure = self.Pneumatic.BrakeCylinderPressure
self.FrontBogey.BrakeCylinderPressure_dPdT = -self.Pneumatic.BrakeCylinderPressure_dPdT
self.RearBogey.PneumaticBrakeForce = 40000.0
self.RearBogey.BrakeCylinderPressure = self.Pneumatic.BrakeCylinderPressure
self.RearBogey.BrakeCylinderPressure_dPdT = -self.Pneumatic.BrakeCylinderPressure_dPdT
end
-- Send networked variables
self:SendPackedData()
return retVal
end
--------------------------------------------------------------------------------
function ENT:OnCouple(train,isfront)
self.BaseClass.OnCouple(self,train,isfront)
if isfront
then self.FrontBrakeLineIsolation:TriggerInput("Open",1.0)
else self.RearBrakeLineIsolation:TriggerInput("Open",1.0)
end
end
function ENT:OnButtonPress(button)
if button == "AirDistributorDisconnectToggle" then return end
if button == "VBToggle" then
if self.VB.Value == 1 then
self:PlayOnce("vu22_on",nil)
else
self:PlayOnce("vu22_off",nil)
end
return
end
if button == "GVToggle" then
if self.GV.Value > 0.5 then
self:PlayOnce("revers_f",nil,0.7)
else
self:PlayOnce("revers_b",nil,0.7)
end
return
end
-- Generic button or switch sound
if string.find(button,"Set") then
self:PlayOnce("switch")
end
if string.find(button,"Toggle") then
self:PlayOnce("switch2")
end
end
|
-- scaffold geniefile for ascii_art
ascii_art_script = path.getabsolute(path.getdirectory(_SCRIPT))
ascii_art_root = path.join(ascii_art_script, "ascii_art")
ascii_art_includedirs = {
path.join(ascii_art_script, "config"),
ascii_art_root,
}
ascii_art_libdirs = {}
ascii_art_links = {}
ascii_art_defines = {}
----
return {
_add_includedirs = function()
includedirs { ascii_art_includedirs }
end,
_add_defines = function()
defines { ascii_art_defines }
end,
_add_libdirs = function()
libdirs { ascii_art_libdirs }
end,
_add_external_links = function()
links { ascii_art_links }
end,
_add_self_links = function()
links { "ascii_art" }
end,
_create_projects = function()
project "ascii_art"
kind "StaticLib"
language "C++"
flags {}
includedirs {
ascii_art_includedirs,
}
defines {}
files {
path.join(ascii_art_script, "config", "**.h"),
path.join(ascii_art_root, "**.h"),
path.join(ascii_art_root, "**.cpp"),
}
end, -- _create_projects()
}
---
|
----
-- Handles test functionality.
--
-- Shouldn't be loaded in production and most only be used for testing. It requires Busted unit
-- testing framework to be loaded and when it's found it will automatically add all corresponding
-- functions globally when SDK is loaded.
--
-- **Source Code:** [https://github.com/dstmodders/dst-mod-sdk](https://github.com/dstmodders/dst-mod-sdk)
--
-- @module SDK.Test
-- @see SDK
--
-- @author [Depressed DST Modders](https://github.com/dstmodders)
-- @copyright 2020
-- @license MIT
-- @release 0.1
----
local Test = {}
local SDK
local _DEBUG_SPY = {}
--- General
-- @section general
--- Dumps a table.
-- @see SDK.Dump.Table
-- @tparam table obj
-- @tparam number indent
-- @tparam number recurse_levels
-- @tparam table visit_table
-- @tparam boolean is_terse
function Test.dumptable(obj, indent, recurse_levels, visit_table, is_terse)
SDK.Dump.Table(obj, indent, recurse_levels, visit_table, is_terse)
end
--- Copies a table in a shallow mode.
--
-- Copies the top level value and its direct children.
--
-- [http://lua-users.org/wiki/CopyTable](http://lua-users.org/wiki/CopyTable)
--
-- @tparam table src Source table
-- @tparam[opt] table dest Destination table
-- @treturn table
function Test.shallowcopy(src, dest)
local copy
if type(src) == "table" then
copy = dest or {}
for k, v in pairs(src) do
copy[k] = v
end
else -- number, string, boolean, etc
copy = src
end
return copy
end
--- Creates a userdata from table.
-- @tparam table t
-- @treturn table
function Test.userdata(t)
local proxy = newproxy(true)
getmetatable(proxy).__index = function(_, key)
return t[key]
end
return proxy
end
--- Asserts
-- @section asserts
--- Asserts a function with chained nil fields.
-- @tparam function fn Function
-- @tparam table src Source itself
-- @tparam string ... Chained fields that will be "nilled"
function Test.AssertChainNil(fn, src, ...)
if src and (type(src) == "table" or type(src) == "userdata") then
local args = { ... }
local start = src
local previous, key
for i = 1, #args do
if start[args[i]] then
previous = start
key = args[i]
start = start[key]
end
end
if previous and src then
previous[key] = nil
args[#args] = nil
fn()
Test.AssertChainNil(fn, src, unpack(args))
end
end
end
--- Asserts a class having a getter.
-- @tparam table class Class to assert
-- @tparam string field Field name
-- @tparam string fn_name Function name
-- @tparam[opt] string test_data Test data (by default: "test")
function Test.AssertClassGetter(class, field, fn_name, test_data)
test_data = test_data ~= nil and test_data or "test"
Test.AssertHasFunction(class, fn_name)
local fn = class[fn_name]
local msg = string.format(
"Class getter %s() doesn't return value: %s",
tostring(fn_name),
tostring(field)
)
local assert = require("busted").assert
local value = class[field]
assert.is_equal(class[field], fn(class), msg)
class[field] = test_data
assert.is_equal(test_data, fn(class), msg)
class[field] = value
end
--- Asserts a class having a setter.
-- @tparam table class Class to assert
-- @tparam string field Field name
-- @tparam string fn_name Function name
-- @tparam[opt] boolean is_return_self Assert setter returning self
-- @tparam[opt] string test_data Test data (by default: "test")
function Test.AssertClassSetter(class, field, fn_name, is_return_self, test_data)
test_data = test_data ~= nil and test_data or "test"
Test.AssertHasFunction(class, fn_name)
local fn = class[fn_name]
local assert = require("busted").assert
local value = class[field]
fn(class, test_data)
assert.is_equal(
test_data,
class[field],
string.format("Class setter %s() doesn't set value: %s", tostring(fn_name), tostring(field))
)
if is_return_self then
assert.is_equal(
class,
fn(class, test_data),
string.format("Class setter %s() doesn't return self", tostring(fn_name))
)
end
class[field] = value
end
--- Asserts if a debug spy was called.
--
-- Just a convenience wrapper for:
--
-- SDK.Test.DebugSpyAssert(name).was_called(calls)
-- SDK.Test.DebugSpyAssert(name).was_called_with(match.is_not_nil(), unpack(args))
--
-- @usage SDK.Test.AssertDebugSpyWasCalled("DebugString", 1, "Loaded")
--
-- @usage SDK.Test.AssertDebugSpyWasCalled("DebugError", 1, { "Error:", "not loaded" })
--
-- @tparam string name Spy name
-- @tparam number calls Number of calls
-- @tparam string|table args A single argument as a string or multiple as a table
function Test.AssertDebugSpyWasCalled(name, calls, args)
local match = require("luassert.match")
calls = calls ~= nil and calls or 0
args = args ~= nil and args or {}
args = type(args) == "string" and { args } or args
Test.DebugSpyAssert(name).was_called(calls)
if calls > 0 then
Test.DebugSpyAssert(name).was_called_with(match.is_not_nil(), unpack(args))
end
end
--- Asserts a module having a function.
-- @tparam table module Module to assert
-- @tparam string fn_name Function name
function Test.AssertHasFunction(module, fn_name)
local assert = require("busted").assert
assert.is_not_nil(module[fn_name], string.format("%s() is missing", tostring(fn_name)))
end
--- Asserts a module not having a function.
-- @tparam table module Module to assert
-- @tparam string fn_name Function name
function Test.AssertHasNoFunction(module, fn_name)
local assert = require("busted").assert
assert.is_nil(module[fn_name], string.format("%s() exists", fn_name))
end
--- Asserts a module having a getter.
-- @tparam table module Module to assert
-- @tparam string field Field name
-- @tparam string fn_name Function name
-- @tparam[opt] string test_data Test data (by default: "test")
function Test.AssertModuleGetter(module, field, fn_name, test_data)
test_data = test_data ~= nil and test_data or "test"
Test.AssertHasFunction(module, fn_name)
local fn = module[fn_name]
local msg = string.format(
"Module getter %s() doesn't return value: %s",
tostring(fn_name),
tostring(field)
)
local assert = require("busted").assert
local value = module[field]
assert.is_equal(module[field], fn(), msg)
module[field] = test_data
assert.is_equal(test_data, fn(), msg)
module[field] = value
end
--- Asserts a module having a setter.
-- @tparam table module Module to assert
-- @tparam string field Field name
-- @tparam string fn_name Function name
-- @tparam[opt] boolean is_return_self Assert setter returning self
-- @tparam[opt] string test_data Test data (by default: "test")
function Test.AssertModuleSetter(module, field, fn_name, is_return_self, test_data)
test_data = test_data ~= nil and test_data or "test"
Test.AssertHasFunction(module, fn_name)
local fn = module[fn_name]
local assert = require("busted").assert
local value = module[field]
fn(test_data)
assert.is_equal(
test_data,
module[field],
string.format(
"Module setter %s() doesn't set value: %s",
tostring(fn_name),
tostring(field)
)
)
if is_return_self then
assert.is_equal(
module,
fn(test_data),
string.format("Module setter %s() doesn't return self", tostring(fn_name))
)
end
module[field] = value
end
--- Asserts a module returning self.
-- @tparam table module Module to assert
-- @tparam string fn_name Function name
-- @tparam any ... Function arguments
function Test.AssertReturnSelf(module, fn_name, ...)
local assert = require("busted").assert
assert.is_equal(
module,
module[fn_name](unpack({ ... })),
string.format("Module function %s() doesn't return self", fn_name)
)
end
--- Debug
-- @section debug
--- Gets a debug spy.
-- @usage assert.spy(SDK.Test.DebugSpy("DebugString")).was_not_called()
-- @tparam string name Spy name
-- @treturn table
function Test.DebugSpy(name)
for k, spy in pairs(_DEBUG_SPY) do
if k == name then
return spy
end
end
end
--- Gets a debug spy assert.
--
-- Just a convenience wrapper for:
--
-- assert.spy(SDK.Test.DebugSpy(name))
--
-- @usage SDK.Test.DebugSpyAssert("DebugString").was_not_called()
-- @tparam string name Spy name
-- @treturn table
function Test.DebugSpyAssert(name)
local assert = require("luassert.assert")
return assert.spy(Test.DebugSpy(name))
end
--- Clears a single debug spy or all of them.
-- @tparam[opt] string name Spy name
function Test.DebugSpyClear(name)
if name ~= nil then
for _name, method in pairs(_DEBUG_SPY) do
if _name == name then
method:clear()
return
end
end
end
for _, method in pairs(_DEBUG_SPY) do
method:clear()
end
end
--- Initializes debug spies.
function Test.DebugSpyInit()
local spy = require("luassert.spy")
local functions = {
"Error",
"Init",
"ModConfigs",
"String",
"StringStart",
"StringStop",
"Term",
}
Test.DebugSpyTerm()
for _, fn in pairs(functions) do
if SDK.Debug[fn] and not _DEBUG_SPY[fn] then
_DEBUG_SPY[fn] = spy.new(Test.Empty)
end
end
SDK.Debug.AddMethods = function(self)
for _, fn in pairs(functions) do
if SDK.Debug[fn] and _DEBUG_SPY[fn] and not self["Debug" .. fn] then
self["Debug" .. fn] = _DEBUG_SPY[fn]
_DEBUG_SPY["Debug" .. fn] = self["Debug" .. fn]
end
end
end
end
--- Terminates debug spies.
function Test.DebugSpyTerm()
for name, _ in pairs(_DEBUG_SPY) do
_DEBUG_SPY[name] = nil
end
end
--- Returns
-- @section returns
--- Returns nothing.
-- @treturn nil
function Test.Empty() end
--- Returns a function which returns a value.
-- @tparam any value Value to return
-- @treturn function
function Test.ReturnValueFn(value)
return function()
return value
end
end
--- Returns a function which returns values.
-- @tparam any ... Values to return
-- @treturn function
function Test.ReturnValuesFn(...)
local args = { ... }
return function()
return unpack(args)
end
end
--- Table
-- @section table
--- Counts the number of elements inside a table.
-- @see SDK.Utils.Table.Count
-- @tparam table t Table
-- @treturn number
function Test.TableCount(t)
return SDK.Utils.Table.Count(t)
end
--- Checks if a table has the provided value.
-- @see SDK.Utils.Table.HasValue
-- @tparam table t Table
-- @tparam string value
-- @treturn boolean
function Test.TableHasValue(t, value)
return SDK.Utils.Table.HasValue(t, value)
end
--- Test
-- @section test
--- Tests if returns false.
-- @tparam function fn
function Test.TestReturnFalse(fn)
local assert = require("busted").assert
local it = require("busted").it
it("should return false", function()
assert.is_false(fn())
end)
end
--- Tests if returns true.
-- @tparam function fn
function Test.TestReturnTrue(fn)
local assert = require("busted").assert
local it = require("busted").it
it("should return true", function()
assert.is_true(fn())
end)
end
--- Tests if returns nil.
-- @tparam function fn
function Test.TestReturnNil(fn)
local assert = require("busted").assert
local it = require("busted").it
it("should return nil", function()
assert.is_nil(fn())
end)
end
--- Lifecycle
-- @section lifecycle
--- Initializes.
-- @tparam SDK sdk
-- @treturn SDK.Test
function Test._DoInit(sdk)
SDK = sdk
local module = SDK._DoInitModule(SDK, Test, "Test")
local mt = getmetatable(module)
local __index = mt.__index
mt.__index = function(...)
if not package.loaded.busted then
SDK._Error(tostring(module) .. ":", "Busted testing framework is not loaded")
return function()
return nil
end
end
return __index(...)
end
if package.loaded.busted then
_G.AssertChainNil = Test.AssertChainNil
_G.AssertClassGetter = Test.AssertClassGetter
_G.AssertClassSetter = Test.AssertClassSetter
_G.AssertDebugSpyWasCalled = Test.AssertDebugSpyWasCalled
_G.AssertHasFunction = Test.AssertHasFunction
_G.AssertHasNoFunction = Test.AssertHasNoFunction
_G.AssertModuleGetter = Test.AssertModuleGetter
_G.AssertModuleSetter = Test.AssertModuleSetter
_G.AssertReturnSelf = Test.AssertReturnSelf
_G.DebugSpy = Test.DebugSpy
_G.DebugSpyAssert = Test.DebugSpyAssert
_G.DebugSpyClear = Test.DebugSpyClear
_G.DebugSpyInit = Test.DebugSpyInit
_G.DebugSpyTerm = Test.DebugSpyTerm
_G.dumptable = Test.dumptable
_G.Empty = Test.Empty
_G.ReturnValueFn = Test.ReturnValueFn
_G.ReturnValuesFn = Test.ReturnValuesFn
_G.shallowcopy = Test.shallowcopy
_G.TableCount = Test.TableCount
_G.TableHasValue = Test.TableHasValue
_G.TestReturnFalse = Test.TestReturnFalse
_G.TestReturnNil = Test.TestReturnNil
_G.TestReturnTrue = Test.TestReturnTrue
_G.userdata = Test.userdata
end
return module
end
return Test
|
---@diagnostic disable-next-line: lowercase-global
-- Aliases
o = vim.o
g = vim.g
wo = vim.wo
bo = vim.bo
fn = vim.fn
exec = vim.api.nvim_exec
cmd = vim.api.nvim_command
feedkeys = vim.api.nvim_feedkeys
-- Module managing
loaded_modules = {}
function load(modules)
if type(modules) ~= 'table' then
modules = {modules}
end
if #modules == 1 then
module = modules[1]
loaded_modules[module] = true
return require(module)
end
for _, v in ipairs(modules) do
loaded_modules[v] = true
require(v)
end
end
function unload(modules)
if type(modules) ~= 'table' then
modules = {modules}
end
for _, v in ipairs(modules) do
loaded_modules[v] = nil
package.loaded[v] = nil
end
end
function reload(modules)
if type(modules) ~= 'table' then
modules = {modules}
end
for _, v in ipairs(modules) do
loaded_modules[v] = true
package.loaded[v] = nil
require(v)
end
end
-- Configs
local function configurable(tbl)
return setmetatable(tbl, {
__index = function(self, key)
if self[key] ~= nil then
return self[key]
end
local member = configurable({})
self[key] = member
return member
end
})
end
cfg = configurable({})
-- Packer
local function ensure_packer_installed()
local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
cmd('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
end
end
local function add_packer()
cmd [[packadd packer.nvim]]
exec([[
augroup Packer
autocmd!
autocmd BufWritePost plugins.lua PackerCompile
augroup end
]], false)
end
ensure_packer_installed()
add_packer()
packer = require('packer')
use = packer.use
-- Load
load 'main'
|
--[[
File: damage.lua
Author: toneo
Realm: Server
Damage module. Handles modifiers for damage dealt by NPCs and dealt to players.
]]--
util.AddNetworkString( "DamageNotify" )
local avoidRecursion = false -- Used for hunter v hunter damage workaround
-- Modify npc damage
function GM:EntityTakeDamage( ent, dmginfo )
if ent:IsPlayer() then return true end -- No player damage
if avoidRecursion then return end
if ent:IsNPC() then
local attacker = dmginfo:GetAttacker()
local attackerSettings = attacker.DamageSettings
local defenderSettings = ent.DamageSettings
local isMelee = dmginfo:IsDamageType( DMG_SLASH ) or dmginfo:IsDamageType( DMG_CLUB )
-- Scale all explosion damage down to 50%
if dmginfo:IsDamageType( DMG_BLAST ) then
dmginfo:ScaleDamage( 0.5 )
end
-- TODO: Hunters cannot damage each other. RIP
-- Attacker may modify their ranged/melee damage
if attackerSettings then
local meleeDamage = attackerSettings.MeleeDamage
local rangedDamage = attackerSettings.RangedDamage
if isMelee then
if meleeDamage then
dmginfo:SetDamage( meleeDamage )
end
elseif rangedDamage then
dmginfo:SetDamage( rangedDamage )
end
end
-- Defender may resist a portion of damage
if defenderSettings then
local meleeResist = defenderSettings.MeleeResist
local rangedResist = defenderSettings.RangedResist
if isMelee then
if meleeResist then
dmginfo:ScaleDamage( meleeResist )
end
elseif rangedResist then
dmginfo:ScaleDamage( rangedResist )
end
end
-- Hunters cannot damage hunters without this workaround.
if ent:GetClass() == "npc_hunter" and attacker:GetClass() == "npc_hunter" then
avoidRecursion = true
ent:TakeDamage( dmginfo:GetDamage(), attacker )
avoidRecursion = false
end
net.Start( "DamageNotify" )
net.WriteEntity( ent )
net.WriteVector( dmginfo:GetDamagePosition() )
net.WriteInt( dmginfo:GetDamage(), 17 )
net.WriteInt( ent:Health(), 17 )
net.Broadcast()
end
return false
end
|
WIRE_DIRECTIONAL_RADIO_KIT = true -- Use this in your own Lua code to check for the presence of the Wire Directional Radio Kit
CreateConVar("sv_wdrk_scale", 180.0) -- Map Scale Adjustment factor
CreateConVar("sv_wdrk_max_tx_power", 1000.0) -- Maximum transmit power in Watts
CreateConVar("sv_wdrk_rx_sensitivity_threshold", -90.0) -- Receive sensitivity in dbm
|
local S = homedecor.gettext
local bedcolors = {
{ "black", "#000000:200" }, --new cg72
{ "brown", "#603010:175" },
{ "blue", "#0000d0:150" },
{ "cyan", "#009fa7:150" }, --new cg72
{ "darkgrey", "#101010:175" },
{ "dark_green", "#007000:150" },
{ "green", "#00d000:150" }, --new cg72
{ "grey", "#101010:100" }, --new cg72
{ "magenta", "#e0048b:150" }, --new cg72
{ "orange", "#ff3000:150" },
{ "pink", "#ff80b0:150" },
{ "red", "#d00000:150" },
{ "violet", "#7000e0:150" },
{ "white", "#000000:000" }, --new cg72
{ "yellow", "#ffe000:150" }
}
local bed_sbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 1.5 }
}
local bed_cbox = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.05, 1.5 },
{ -0.5, -0.5, 1.44, 0.5, 0.5, 1.5 },
{ -0.5, -0.5, -0.5, 0.5, 0.18, -0.44 },
}
}
local kbed_sbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 1.5 }
}
local kbed_cbox = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 1.5, -0.05, 1.5 },
{ -0.5, -0.5, 1.44, 1.5, 0.5, 1.5 },
{ -0.5, -0.5, -0.5, 1.5, 0.18, -0.44 },
}
}
for i in ipairs(bedcolors) do
local color = bedcolors[i][1]
local color2=color
local hue = bedcolors[i][2]
if color == "darkgrey" then
color2 = "dark_grey"
end
homedecor.register("bed_"..color.."_regular", {
mesh = "homedecor_bed_regular.obj",
tiles = {
"homedecor_bed_frame.png",
"default_wood.png",
"wool_white.png",
"wool_"..color2..".png",
"homedecor_bed_bottom.png",
"wool_"..color2..".png^[brighten", -- pillow
},
inventory_image = "homedecor_bed_inv.png^(homedecor_bed_overlay_inv.png^[colorize:"..hue..")",
description = S("Bed (%s)"):format(color),
groups = {snappy=3},
selection_box = bed_sbox,
collision_box = bed_cbox,
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if not placer:get_player_control().sneak then
return homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, color)
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
homedecor.unextend_bed(pos, color)
if minetest.get_modpath("beds") then -- MFF (crabman 7/04/2016) remove bed spawn on dig
local name = digger:get_player_name()
if not name or name == "" then return end
beds.spawn[name] = nil
beds.save_spawns()
end
end,
on_rightclick = function(pos, node, clicker)
if minetest.get_modpath("beds") then
beds.on_rightclick(pos, clicker)
else return end
end
})
homedecor.register("bed_"..color.."_extended", {
mesh = "homedecor_bed_extended.obj",
tiles = {
"homedecor_bed_frame.png",
"default_wood.png",
"wool_white.png",
"wool_"..color2..".png",
"homedecor_bed_bottom.png",
"wool_"..color2..".png^[brighten",
},
selection_box = bed_sbox,
collision_box = bed_cbox,
sounds = default.node_sound_wood_defaults(),
expand = { forward = "air" },
on_rotate = screwdriver.disallow,
after_dig_node = function(pos)
homedecor.unextend_bed(pos, color)
end,
on_rightclick = function(pos, node, clicker)
if minetest.get_modpath("beds") then
beds.on_rightclick(pos, clicker)
else return end
end,
drop = "homedecor:bed_"..color.."_regular"
})
homedecor.register("bed_"..color.."_kingsize", {
mesh = "homedecor_bed_kingsize.obj",
tiles = {
"homedecor_bed_frame.png",
"default_wood.png",
"wool_white.png",
"wool_"..color2..".png",
"homedecor_bed_bottom.png",
"wool_"..color2..".png^[brighten",
},
inventory_image = "homedecor_bed_kingsize_inv.png^(homedecor_bed_kingsize_overlay_inv.png^[colorize:"..hue..")",
groups = {snappy=3, not_in_creative_inventory=1},
description = S("Bed (%s, king sized)"):format(color),
groups = {snappy=3, not_in_creative_inventory=1},
selection_box = kbed_sbox,
collision_box = kbed_cbox,
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local inv = digger:get_inventory()
if digger:get_player_control().sneak and inv:room_for_item("main", "bed_"..color.."_regular 1") then
inv:remove_item("main", "homedecor:bed_"..color.."_kingsize 1")
inv:add_item("main", "homedecor:bed_"..color.."_regular 2")
end
end,
on_rightclick = function(pos, node, clicker)
if minetest.get_modpath("beds") then
beds.on_rightclick(pos, clicker)
else return end
end
})
minetest.register_alias("homedecor:bed_"..color.."_foot", "homedecor:bed_"..color.."_regular")
minetest.register_alias("homedecor:bed_"..color.."_footext", "homedecor:bed_"..color.."_extended")
minetest.register_alias("homedecor:bed_"..color.."_head", "air")
end
for _, w in pairs({"mahogany", "oak"}) do
homedecor.register("nightstand_"..w.."_one_drawer", {
description = S("Nightstand with One Drawer ("..w..")"),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
'homedecor_nightstand_'..w..'_lr.png',
'homedecor_nightstand_'..w..'_back.png',
'homedecor_nightstand_'..w..'_1_drawer_front.png'},
node_box = {
type = "fixed",
fixed = {
{ -8/16, 0, -30/64, 8/16, 8/16, 8/16 }, -- top half
{ -7/16, 1/16, -32/64, 7/16, 7/16, -29/64}, -- drawer face
{ -8/16, -8/16, -30/64, -7/16, 0, 8/16 }, -- left
{ 7/16, -8/16, -30/64, 8/16, 0, 8/16 }, -- right
{ -8/16, -8/16, 7/16, 8/16, 0, 8/16 }, -- back
{ -8/16, -8/16, -30/64, 8/16, -7/16, 8/16 } -- bottom
}
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = { type = "regular" },
infotext=S("One-drawer Nightstand"),
inventory = {
size=8,
lockable=true,
},
})
homedecor.register("nightstand_"..w.."_two_drawers", {
description = S("Nightstand with Two Drawers ("..w..")"),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
'homedecor_nightstand_'..w..'_lr.png',
'homedecor_nightstand_'..w..'_back.png',
'homedecor_nightstand_'..w..'_2_drawer_front.png'},
node_box = {
type = "fixed",
fixed = {
{ -8/16, -8/16, -30/64, 8/16, 8/16, 8/16 }, -- main body
{ -7/16, 1/16, -32/64, 7/16, 7/16, -29/64 }, -- top drawer face
{ -7/16, -7/16, -32/64, 7/16, -1/16, -29/64 }, -- bottom drawer face
}
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = { type = "regular" },
infotext=S("Two-drawer Nightstand"),
inventory = {
size=16,
lockable=true,
},
})
end
|
local rfWork = const.rfWork
local rfSupply = const.rfSupply
local rfWaitToFill = const.rfWaitToFill
local rfDemand = const.rfDemand
local rfCanExecuteAlone = const.rfCanExecuteAlone
local rfSupplyDemand = rfSupply + rfDemand
local rfDemandOrWork = rfDemand + rfWork
local rfPostInQueueFlags = rfDemand + rfWork + rfCanExecuteAlone + const.rfPostInQueue
local rfStorageDepot = const.rfStorageDepot
local rfConstruction = const.rfConstruction
local rfSpecialDemandPairing = const.rfSpecialDemandPairing
local rfSpecialSupplyPairing = const.rfSpecialSupplyPairing
local MaxBuildingPriority = const.MaxBuildingPriority
local TaskPriorityBoost = const.TaskPriorityBoost
local table_insert = table.insert
local table_remove = table.remove
local remove_entry = table.remove_entry
local IsFlagSet = IsFlagSet
local rfRestrictorRocket = const.rfRestrictorRocket
local rfRestrictorWasteRockDump = const.rfRestrictorWasteRockDump
function FindClosest(list, pt)
if not list then return end
local dist_func = "GetDist2D"
local min_obj = nil
local min_dist = nil
local idx = nil
local invalid_pos = InvalidPos()
for i = 1, #list do
local obj = list[i]
if IsValid(obj) and obj:IsValidPos() then
local dist = obj[dist_func](obj, pt)
if not min_dist or min_dist > dist then
min_obj = obj
min_dist = dist
idx = i
end
end
end
return min_obj, min_dist, idx
end
DefineClass.DroneNode = {
__parents = { "Object" },
properties = {
{template = true, id = "work_radius", editor = "number", name = Untranslated("Work radius"), default = const.CommandCenterDefaultRadius, modifiable = true},
},
working = false,
linked_extenders = false,
}
function DroneNode:Done()
for _,extender in ipairs(self.linked_extenders or empty_table) do
extender:SetUplink(false)
end
end
function DroneNode:GetCommandCenter()
return self
end
function GetSignalBoostersSelectionRadiusScale(node)
if not IsValid(node) then
return node.work_radius + (UIColony:IsTechResearched("SignalBoosters") and const.SignalBoostersBuff or 0)
else
return node.work_radius
end
end
function DroneNode:GetSelectionRadiusScale()
return self.work_radius
end
DefineClass.DroneControl = {
__parents = { "DroneNode", "TaskRequestHub" },
properties = {
{template = true,id = "starting_drones", name = T(642, "Starting Drones"),editor = "number", default = 4, modifiable = true},
{template = true, id = "show_service_area", name = T(13599, "Show Service Area"), editor = "bool", default = true, modifiable = true},
-- make sure UIWorkRadius and work_radius share the same default value
{id = "UIWorkRadius", name = T(643, "Range"), editor = "number", default = const.CommandCenterDefaultRadius, min=const.CommandCenterMinRadius, max=const.CommandCenterDefaultRadius, no_edit = true, dont_save = true,}, -- prop only for UI purposes
},
building_update_time = const.HourDuration,
distance_to_provoke_go_home_cmd = 50*guim,
drones = false,
constructions = false,
under_construction = false,
update_constructions_thread = false,
surface_deposits = false,
no_requests_time = 0,
serviced_rockets = false,
serviced_wasterock_dumps = false,
restrictor_update_thread = false,
restrictor_tables = false, --[rfRestritcorFlag] = {[resource] = request,..}
restrictor_update_mask = 0,
deficit_table = false, --sums up total deficits so shuttles know what to deliver
deficit_thread = false,
unreachable_buildings = false,
can_control_drones = true,
promoted_trees = false,
veg_management_thread = false,
}
function DroneControl:UpdateDeficits()
local t = self.deficit_thread
if IsValidThread(t) then
Wakeup(t)
else
self.deficit_thread = CreateGameTimeThread(function(self)
while IsValid(self) do
self:UpdateDeficitsInternal()
WaitWakeup()
end
end, self)
end
end
function DroneControl:UpdateDeficitsInternal()
return Request_UpdateDeficits(self, StorableResources)
end
--[[
function DroneControl:UpdateDeficitsInternal_Lua()
local t = {}
local s = self.supply_queues
local d = self.demand_queues
local storables = StorableResources
for j = MaxBuildingPriority, -1, -1 do
local ps = s[j]
local pd = d[j]
for _, resource in ipairs(storables) do
local total = 0
local reqs = pd[resource]
for i = 1, #(reqs or "") do
if not reqs[i]:IsAnyFlagSet(const.rfSpecialDemandPairing) then --special dmnd can only be accomodate by special supply so no need to count toward deficit
if not reqs[i]:IsAnyFlagSet(const.rfStorageDepot) then
total = total + reqs[i]:GetTargetAmount()
else
--handle storage demands
local d = reqs[i]:GetActualAmount() - reqs[i]:GetTargetAmount() --incoming amount of d
if d > 0 then
total = total - d
end
end
end
end
reqs = ps[resource]
for i = 1, #(reqs or "") do
total = total - reqs[i]:GetTargetAmount()
end
t[resource] = (t[resource] or 0) + total
end
end
return t
end
function DroneControl:UpdateDeficitsInternal()
local t = Request_UpdateDeficits(self, StorableResources)
local t_lua = self:UpdateDeficitsInternal_Lua()
assert(compare(t, t_lua))
return t
end
--]]
function DroneControl:InitRocketRestrictors()
self.serviced_rockets = {}
self.restrictor_tables = self.restrictor_tables or {}
self.restrictor_tables[rfRestrictorRocket] = {}
end
function DroneControl:InitDumpRestrictors()
self.serviced_wasterock_dumps = self.serviced_wasterock_dumps or {}
self.restrictor_tables = self.restrictor_tables or {}
self.restrictor_tables[rfRestrictorWasteRockDump] = {}
end
function DroneControl:Init()
self.drones = {}
self.constructions = {}
self:InitRocketRestrictors()
self:InitDumpRestrictors()
end
function DroneControl:GameInit()
self.city:AddToLabel("DroneControl", self)
--delay until GameInit is completed
--we need this so any descendant in a label can modify the number
self:Notify("SpawnDrones")
end
function DroneControl:SpawnDrones()
for i = 1, self.starting_drones do
self:SpawnDrone()
end
end
function DroneControl:SpawnDronesAround(amount)
for i = 1, amount do
local drone = self.city:CreateDrone()
drone:SetHolder(self)
drone:SetCommandCenter(self)
local drone_control_pos = self:GetPos()
local spawn_pos = GetRandomPassableAroundOnMap(self:GetMapID(), drone_control_pos, 25 * guim) or drone_control_pos
drone:SetPos(spawn_pos)
end
end
function DroneControl:GatherOrphanedDrones()
if not self.working then return end
while self:CanHaveMoreDrones() do
local drone, _, idx = FindClosest(g_OrphanedDrones[self:GetMapID()], self)
if not drone then return end
DiscardNewObjsNotif(g_OrphanedDrones, drone, drone:GetMapID())
drone:SetCommandCenter(self)
if self == SelectedObj then
SelectionArrowAdd(drone)
end
end
end
function SavegameFixups.DisableInteractionWithDestroyedDroneControllers()
MapForEach("map", "DroneControl", function(o)
if o.destroyed then
o:Finalize()
end
end)
end
function DroneControl:Finalize()
self.can_control_drones = false
if self.are_requesters_connected then
self:DisconnectTaskRequesters()
end
for i = #self.drones, 1, -1 do
local drone = self.drones[i]
if drone:GetParent() == self then
drone:Detach()
drone:SetCommand("Idle") --attached drone in embark
end
drone:SetCommandCenter(false)
SelectionArrowRemove(drone)
end
DeleteThread(self.update_constructions_thread)
self.city:RemoveFromLabel("DroneControl", self)
end
function DroneControl:AddLabelsToCity()
self.city:AddToLabel("DroneControl", self)
end
function DroneControl:RemoveLabelsFromCity()
self.city:RemoveFromLabel("DroneControl", self)
end
function DroneControl:Done()
self:Finalize()
end
function DroneControl:OnDestroyed()
self:Finalize()
end
function DroneControl:BuildingUpdate(delta, day, hour)
assert(not self.working or self.are_requesters_connected or delta == 0) --deposits may retain us as cc, if not first tick
self:UpdateConstructions()
self:UpdateAllRestrictors()
self:UpdateDeficits()
self:UpdateHeavyLoadNotification()
end
--[[local function SetConstructionSiteSign(building, add, sign)
if building.command_centers and #building.command_centers == 0 then
if IsKindOf(building, "ConstructionSite") then
building:AttachSign(add, sign)
elseif building:HasMember("parent_construction") and type(building.parent_construction) == "table" and #building.parent_construction > 0 then
for k,v in ipairs(building.parent_construction) do
v:AttachSign(add, sign)
end
end
end
end]]
--zz so it fires last and expected containers are initialized
function SavegameFixups.zzConstructionSiteCleanupReconnectTaskRequesters()
--bug: 137698
MapForEach("map", "DroneControl", DroneControl.ReconnectTaskRequesters)
end
function FindTaskRequesters(node)
local realm = GetRealm(node)
local taskrequesters = realm:MapGet(node, "hex", node.work_radius, "TaskRequester")
for _,extender in ipairs(node.linked_extenders or empty_table) do
taskrequesters = table.iappend(taskrequesters, FindTaskRequesters(extender))
end
return taskrequesters
end
PromoteTrees = empty_func
function DroneControl:ConnectTaskRequesters()
if self.are_requesters_connected then return end
local resource_search = function (building, center)
--SetConstructionSiteSign(building, false, "SignNoPower")
if building.auto_connect and not GameInitThreads[building] then
building:AddCommandCenter(center)
building:ForEachAttach("ResourceStockpileBase", function(stock)
stock:AddCommandCenter(center)
end)
elseif not building.auto_connect and IsKindOf(building, "ConstructionSite") and building.working then
local l = building.waste_rocks_underneath or ""
for i = 1, #l do
l[i]:AddCommandCenter(center)
end
l = building.waste_rocks_underneath or ""
for i = 1, #l do
l[i]:AddCommandCenter(center)
end
end
end
local taskrequesters = FindTaskRequesters(self)
for _, building in ipairs(taskrequesters) do
resource_search(building, self)
end
if self.city.colony:IsTechResearched("MartianVegetation") and #(self.promoted_trees or empty_table) <= 0 then
local twidth, theight = GetTerrain(self):GetMapSize()
PromoteTrees(self, twidth, theight, max_int)
end
self:ConnectLandscapeConstructions()
if #(self.city.labels.ToxicPool or "") > 0 then
self:ConnectToxicPools()
end
self.are_requesters_connected = true
end
local function HexConnectLandscapeConstructions(q, r, self, passed, qq, rr, landscape_grid)
local mark = LandscapeCheck(landscape_grid, q, r, true)
if not mark or HexAxialDistance(qq, rr, q, r) > self.work_radius or passed[mark] then
return
end
passed[mark] = true
local ls = Landscapes[mark]
local cs = ls and ls.site
local command_center = self:GetCommandCenter()
if cs and cs.auto_connect and not table.find(cs.command_centers, command_center) then
cs:AddCommandCenter(command_center)
end
end
function DroneNode:ConnectLandscapeConstructions()
if not self.accept_requester_connects then return false end
local passed = {}
local x, y = self:GetVisualPosXYZ()
local hs = const.HexSize + self.work_radius * const.GridSpacing
local box = box(x - hs, y - hs, x + hs, y + hs)
local qq, rr = WorldToHex(x, y)
local landscape_grid = GetLandscapeGrid(self)
return LandscapeForEachHex(self:GetMapID(), box, HexConnectLandscapeConstructions, self, passed, qq, rr, landscape_grid)
end
function DroneControl:ConnectToxicPools()
if not self.accept_requester_connects then return false end
local p = self:GetPos()
if p ~= InvalidPos() then
local game_map = GetGameMap(self)
local object_hex_grid = game_map.object_hex_grid
local twidth, theight = game_map.terrain:GetMapSize()
local margin = 100 * guim
local passed = {}
ForEachHexInHexCircle(p, self.work_radius, function(q, r, self, twidth, theight, margin, passed, object_hex_grid)
local wx, wy = HexToWorld(q, r)
if not (wx < margin or wy < margin
or (twidth - wx) < margin or (theight - wy) < margin) then
local o = object_hex_grid:GetObject(q, r, "ToxicPool")
if not o or passed[o] then
return
end
passed[o] = true
if o.auto_connect and not table.find(o.command_centers, self) then
o:AddCommandCenter(self)
end
end
end, self, twidth, theight, margin, passed, object_hex_grid)
end
end
function DroneControl:DelayedPromotedTreeManagement()
if IsValidThread(self.veg_management_thread) then
DeleteThread(self.veg_management_thread)
end
if self.promoted_trees and #(self.promoted_trees or "") > 0 then
self.veg_management_thread = CreateGameTimeThread(function(self)
Sleep(1000)
for i = #self.promoted_trees, 1, -1 do
local pt = self.promoted_trees[i]
if #pt.command_centers <= 0 then
DoneObject(pt)
elseif not table.find(pt.command_centers, self) then
for j = 1, #pt.command_centers do
local cc = pt.command_centers[j]
if #(cc.promoted_trees or "") < max_promoted_trees_per_hub then
pt:Repossess(cc, i)
break
end
end
if pt.cc == self then
DoneObject(pt)
end
end
end
end, self)
end
end
function DroneControl:DisconnectTaskRequesters()
while #self.connected_task_requesters > 0 do
local bld = self.connected_task_requesters[#self.connected_task_requesters]
if bld then
bld:RemoveCommandCenter(self)
end
end
self:DelayedPromotedTreeManagement()
self.are_requesters_connected = false
end
----- Constructions
function DroneControl:UpdateConstructions()
local thread = self.update_constructions_thread
if thread then
Wakeup(thread)
else
self.update_constructions_thread = CreateGameTimeThread(function(self)
while IsValid(self) do
self:UpdateConstructionsInternal()
WaitWakeup()
end
end, self)
end
end
function DroneControl:ForEachDrone(func, ...)
for i = 1, #self.drones do
if func(self.drones[i], ...) == "break" then
break
end
end
end
function DroneControl:IsConstructionUnreachableByDrones(construction, n)
n = n or 2
local c = 0
self:ForEachDrone(function(drone, construction)
if drone.unreachable_buildings and drone.unreachable_buildings[construction] then
c = c + 1
if c >= n then
return "break"
end
end
end, construction)
return c >= n
end
function DroneControl:UpdateConstructionsInternal()
local supply_queues = self.supply_queues
local under_construction = {}
self.under_construction = under_construction
for _, construction in ipairs(self.constructions) do
local construction_found
if not self:IsConstructionUnreachableByDrones(construction) then
for resource, request in pairs(construction.construction_resources) do
if request:GetTargetAmount() > 0 and not under_construction[resource] then
under_construction[resource] = request
if not construction_found then
-- check if the construction resource is available
-- if so do not consider lower priority construction sites until all resources are brought to this one
for j = -1, MaxBuildingPriority do
local supply_requests = supply_queues[j][resource] or empty_table
for k = 1,#supply_requests do
if supply_requests[k]:GetTargetAmount() > (band(supply_requests[k]:GetFlags(), const.rfWaitToFill) == const.rfWaitToFill and const.ResourceScale - 1 or 0) then
construction_found = true
break
end
end
if construction_found then
break
end
end
end
end
end
end
if construction_found then
return
end
end
end
function DroneControl:AddConstruction(construction)
if not construction.use_control_construction_logic then
return
end
local priority = construction.priority
local counter = construction.counter
local constructions = self.constructions
local i = #constructions + 1
while i > 1 and (constructions[i - 1].priority < priority or constructions[i - 1].priority == priority and constructions[i - 1].counter > counter) do
i = i - 1
end
table_insert(constructions, i, construction)
self:UpdateConstructions()
end
function DroneControl:RemoveConstruction(construction)
if not construction.use_control_construction_logic then
return
end
local idx = remove_entry(self.constructions, construction)
assert(idx)
self:UpdateConstructions()
end
---------------------------------------------------------------------------
---------------------------------------------------------------------------
function SavegameFixups.InitWasteRockDumpRestrictor()
MapForEach(true, "DroneControl", function(obj)
obj:FillDumpTablesFromConnectedRequestors()
obj:KillRestrictorThread()
obj:InitDumpRestrictors()
end)
end
function DroneControl:FillDumpTablesFromConnectedRequestors()
assert(not self.serviced_wasterock_dumps or #self.serviced_wasterock_dumps <= 0)
if not self.connected_task_requesters or #self.connected_task_requesters <= 0 then return end
self.serviced_wasterock_dumps = table.ifilter(self.connected_task_requesters, function(i, o)
return IsKindOf(o, "WasteRockDumpSite")
end)
end
function DroneControl:KillRestrictorThread()
if self.restrictor_update_thread then
if IsValidThread(self.restrictor_update_thread) then
DeleteThread(self.restrictor_update_thread)
end
self.restrictor_update_thread = false
end
end
function DroneControl:UpdateRestrictors()
local t = self.restrictor_update_thread
if IsValidThread(t) then
Wakeup(t)
else
self.restrictor_update_thread = CreateGameTimeThread(function(self)
self:RestrictorThreadBody()
end, self)
end
end
function DroneControl:RestrictorThreadBody()
while IsValid(self) do
local m = self.restrictor_update_mask
if band(m, rfRestrictorRocket) ~= 0 then
self:UpdateRocketsInternal()
end
if band(m, rfRestrictorWasteRockDump) ~= 0 then
self:UpdateDumpsInternal()
end
self.restrictor_update_mask = 0
WaitWakeup()
end
end
function DroneControl:UpdateRockets()
self.restrictor_update_mask = bor(self.restrictor_update_mask, rfRestrictorRocket)
self:UpdateRestrictors()
end
function DroneControl:UpdateDumps()
self.restrictor_update_mask = bor(self.restrictor_update_mask, rfRestrictorWasteRockDump)
self:UpdateRestrictors()
end
function DroneControl:UpdateAllRestrictors()
self.restrictor_update_mask = -1
self:UpdateRestrictors()
end
function DroneControl:UpdateDumpsInternal()
local r_t = self.restrictor_tables[rfRestrictorWasteRockDump]
r_t.WasteRock = nil
local min = max_int
local found_req
for i = 1, #(self.serviced_wasterock_dumps or "") do
local d = self.serviced_wasterock_dumps[i]
local dr = d.demand.WasteRock
local a = dr:GetTargetAmount()
if a > 0 and a < min then
min = a
found_req = dr
end
end
if found_req then
r_t["WasteRock"] = found_req
end
end
function DroneControl:UpdateRocketsInternal()
local r_t = self.restrictor_tables[rfRestrictorRocket]
r_t.Fuel = nil
for i = 1, #(self.serviced_rockets or "") do
local r = self.serviced_rockets[i]
local rr = r.refuel_request
if rr and rr:GetTargetAmount() > 0 then
r_t["Fuel"] = rr
break
end
local rr = r:GetExportRequest(r, "Fuel")
if rr and rr:GetTargetAmount() > 0 then
r_t["Fuel"] = rr
break
end
end
end
function DroneControl:AddRocket(rocket)
local need_fuel = g_LandedRocketsInNeedOfFuel
local r_i = table.find(need_fuel, rocket) or max_int
local r_p = rocket.priority
local rockets = self.serviced_rockets
local i = #rockets + 1
while i > 1 and (rockets[i - 1].priority < r_p
or rockets[i - 1].priority == r_p and (table.find(need_fuel, rockets[i - 1]) or max_int) > r_i) do
i = i - 1
end
table.insert(rockets, i, rocket)
self:UpdateRockets()
end
function DroneControl:RemoveRocket(rocket)
table.remove_entry(self.serviced_rockets, rocket)
self:UpdateRockets()
end
---------------------------------------------------------------------------
---------------------------------------------------------------------------
function DroneControl:IsRestrictingDroneWorkRadius()
return true
end
function DroneControl:SpawnDrone()
--override me.
end
function DroneControl:KillDrone(drone)
local idx = remove_entry(self.drones, drone)
assert(idx)
DoneObject(drone)
end
function DroneControl:GetMaxDrones()
return 0
end
function DroneControl:CanHaveMoreDrones()
return #self.drones < self:GetMaxDrones()
end
----- TaskRequests
function DroneControl:AddBuilding(building)
local supply_queues = self.supply_queues
local demand_queues = self.demand_queues
local priority_queue = self.priority_queue
for _, request in ipairs(building.task_requests or empty_table) do
assert(request and building == request:GetBuilding())
local resource = request:GetResource()
local priority = building:GetPriorityForRequest(request)
if request:IsAnyFlagSet(rfSupplyDemand) then
local queue = request:IsAnyFlagSet(rfSupply) and supply_queues[priority] or demand_queues[priority]
local rqueue = queue[resource]
if rqueue then
rqueue[#rqueue + 1] = request
else
queue[resource] = { request }
end
end
if request:IsAnyFlagSet(rfPostInQueueFlags) then
local p_queue = priority_queue[priority]
p_queue[#p_queue + 1] = request
end
end
table.insert(self.connected_task_requesters, building)
building:OnAddedByControl(self)
self:UpdateDeficits()
if IsKindOf(building, "WasteRockDumpSite") then
self.serviced_wasterock_dumps = self.serviced_wasterock_dumps or {}
table.insert(self.serviced_wasterock_dumps, building)
self:UpdateDumps()
end
end
function DroneControl:OnRemoveBuilding(building, oldp, newp)
if oldp and newp and newp > oldp then
return
end
for _, drone in ipairs(self.drones) do
if BuildingFromGotoTarget(drone.goto_target) == building then
drone:SetCommand("Idle")
end
end
end
function DroneControl:RemoveBuilding(building, oldp, newp)
self:OnRemoveBuilding(building, oldp, newp)
local task_requests = building.task_requests or empty_table
for priority = -1, MaxBuildingPriority do
local s_requests = self.supply_queues[priority]
local d_requests = self.demand_queues[priority]
local priority_queue = self.priority_queue[priority]
for _, request in ipairs(task_requests) do
local resource = request and request:GetResource()
remove_entry(s_requests[resource] or empty_table, request)
remove_entry(d_requests[resource] or empty_table, request)
remove_entry(priority_queue, request)
end
end
table.remove_entry(self.connected_task_requesters, building)
building:OnRemovedByControl(self)
self:UpdateDeficits()
if IsKindOf(building, "WasteRockDumpSite") then
if self.serviced_wasterock_dumps then
table.remove_entry(self.serviced_wasterock_dumps, building)
end
self:UpdateDumps()
end
end
-- radius
function DroneControl:SetWorkRadius(radius)
if radius == self.work_radius then return end
local is_new_greater = radius > self.work_radius
self.work_radius = radius
if self == SelectedObj then
PlayFX("Select", "end", self)
PlayFX("Select", "start", self)
--play sound
PlayFX("RangeChange", "end", self)
DelayedCall(100, PlayFX, "RangeChange", "start", self)
end
if is_new_greater then
local realm = GetRealm(self)
local extenders = realm:MapGet(self, "hex", radius, "DroneHubExtender")
for _,extender in ipairs(extenders) do
if extender.uplink == self then
extender:SetWorking(true)
end
end
else
for _,extender in ipairs(self.linked_extenders or empty_table) do
extender:SetWorking(HexAxialDistance(self, extender) <= radius)
end
end
DelayedCall(300, self.ReconnectTaskRequesters, self, is_new_greater)
end
function DroneControl:ReconnectTaskRequesters(gather_drones)
self:DisconnectTaskRequesters()
if gather_drones then --otherwise it should already be gathered.
self:GatherOrphanedDrones()
end
self:ConnectTaskRequesters()
end
function DroneControl:SetUIWorkRadius(value)
self.UIWorkRadius = value
self:SetWorkRadius(value)
local rxs = g_HexRanges[self] or empty_table
for _, range in ipairs(rxs) do
range:SetScale(self[range.bind_to](self))
end
end
function DroneControl:OnSelected()
local re1 = GetStateIdx("roverEnter")
local re2 = GetStateIdx("roverEnter2")
local drones = table.ifilter(self.drones, function(idx, drone)
return IsValid(drone) and drone.command ~= "Embark" and drone:GetState() ~= re1 and drone:GetState() ~= re2
end)
SelectionArrowAdd(drones)
end
function DroneControl:Abandon(drone)
drone:SetCommandCenter(false)
if not drone:IsDisabled() then
drone:SetCommand("WaitingCommand")
end
end
function DroneControl:AbandonAllDrones()
for i = #self.drones, 1, -1 do
local drone = self.drones[i]
self:Abandon(drone)
SelectionArrowRemove(drone)
end
end
function DroneControl:UseDronePrefab(bulk)
bulk = bulk and 5 or 1
while bulk > 0 do
if self.city and self.city.drone_prefabs > 0 then
if self:SpawnDrone() then
self.city.drone_prefabs = self.city.drone_prefabs - 1
end
else
break
end
bulk = bulk - 1
end
end
function DroneControl:FindDroneToConvertToPrefab()
if #self.drones <= 0 then return false end
local idles = {}
local all = {}
for i = 1, #self.drones do
local d = self.drones[i]
if not d:IsDisabled() then
table.insert(all, d)
if d.command == "Idle" then
table.insert(idles, d)
end
end
end
if #idles > 0 then
return FindNearestObject(idles, self)
elseif #all > 0 then
return FindNearestObject(all, self)
end
end
function DroneControl:ConvertDroneToPrefab(bulk)
bulk = bulk and 5 or 1
while bulk > 0 do
local drone = self:FindDroneToConvertToPrefab()
if drone then
if drone.demolishing then
drone:ToggleDemolish()
end
drone.can_demolish = false
self.city.drone_prefabs = self.city.drone_prefabs + 1
table.remove_entry(self.drones, drone)
SelectionArrowRemove(drone)
drone:SetCommand("DespawnAtHub")
else
break
end
bulk = bulk - 1
end
end
function DroneControl:ProvidesRemoteBatteryCharging()
return false
end
function DroneControl:SetWaitingDronesIdle()
for _, drone in ipairs(self.drones) do
if drone.command == "WaitingCommand" then
drone:SetCommand("Idle")
end
end
end
function DroneControl:NotifyWorkingChanged(buildings)
for i = 1, #(buildings or "") do
local bld = buildings[i]
if bld:HasMember("OnCommandCenterWorkingChanged") then
bld:OnCommandCenterWorkingChanged(self)
end
end
end
--------------- interface
--drones count
function DroneControl:GetDronesCount() return #self.drones end
function DroneControl:GetMaxDrones() return g_Consts.CommandCenterMaxDrones end
function DroneControl:GetMiningDronesCount() return table.array_count(self.drones, "resource", "mine") end
function DroneControl:GetBrokenDronesCount() return table.array_count(self.drones, "command", "Malfunction") end
function DroneControl:GetIdleDronesCount()
local count = 0
for i=1, #self.drones do
local cmd = self.drones[i].command
if cmd == "Idle" or cmd == "WaitCommand" then
count = count + 1
end
end
return count
end
function DroneControl:GetDischargedDronesCount()
local count = 0
for i=1, #self.drones do
local cmd = self.drones[i].command
if cmd == "NoBattery" or cmd == "EmergencyPower" then
count = count + 1
end
end
return count
end
function OnMsg.GatherLabels(labels)
labels["DroneControl"] = true
end
GlobalVar("g_HeavyLoadDroneHubs", {})
GlobalGameTimeThread("HeavyLoadDroneHubsNotif", function()
Sleep(100)
if not g_Tutorial or g_Tutorial.EnableTransportProblemNotif then
HandleNewObjsNotif(g_HeavyLoadDroneHubs, "TransportationDroneOverload")
end
end)
function DroneControl:CalcLapTime()
return #self.drones == 0 and 0 or Max(self.lap_time, GameTime() - self.lap_start)
end
function DroneControl:UpdateHeavyLoadNotification()
if self.working and self:CalcLapTime() >= const.DroneLoadMediumThreshold then
RequestNewObjsNotif(g_HeavyLoadDroneHubs, self, self:GetMapID())
else
DiscardNewObjsNotif(g_HeavyLoadDroneHubs, self, self:GetMapID())
end
end
function DroneControl:ShouldShowAvailableDronePrefabInfo()
return false
end
function DroneControl:GetDronesStatusText()
local ret
local brokenDrones = self:GetBrokenDronesCount()
local broken =
brokenDrones == 1 and T(648, "There is <red>1</red> malfunctioning Drone</red>") .. "\n"
or brokenDrones > 1 and T{649, "There are <red><number></red> malfunctioning Drones</red>", number = brokenDrones} .. "\n"
or ""
local LoadTexts = {
T(935141416351, "Drones load <right><green>Low</green><left>"),
T(935141416352, "Drones load <right><yellow>Medium</yellow><left>"),
T(935141416353, "Drones load <right><red>Heavy</red><left>"),
T(8662, "Drones load <right>N/A<left>"),
}
local t = table.ifilter(self.drones, function(i, o) return not o:IsDisabled() end)
if #t <= 0 then
ret = broken .. LoadTexts[4]
else
local lap_time = self:CalcLapTime()
if lap_time < const.DroneLoadLowThreshold then
ret = broken .. LoadTexts[1]
elseif lap_time < const.DroneLoadMediumThreshold then
ret = broken .. LoadTexts[2]
else
ret = broken .. LoadTexts[3]
end
end
if self:ShouldShowAvailableDronePrefabInfo() then
ret = ret .. "\n" .. T(9757, "Available Prefabs <right><drone(available_drone_prefabs)>")
end
return ret
end
function DoesAnyDroneControlServiceAtPoint(map_id, pt)
local realm = GetRealmByID(map_id)
return realm:MapCount(pt, "hex", const.CommandCenterMaxRadius, "DroneNode",
function(center)
return (IsKindOfClasses(center, "DroneHub") or center.working) and HexAxialDistance(center, pt) <= center.work_radius
end) > 0
end
|
-- Base panel for all elements.
-- @panel MPanel
local PANEL = {}
table.Merge(PANEL, sKore.elevationGAS)
table.Merge(PANEL, sKore.shadowGAS)
table.Merge(PANEL, sKore.enabledGAS)
function PANEL:Init()
self:SetElevation(2)
self:SetShadowOffsetX(1)
self:SetShadowOffsetY(1)
self:SetPaintShadow(true)
self:SetDrawShadows(true)
self:SetDrawGlobalShadows(true)
self:SetEnabled(true)
local parent = self:GetParent()
if parent.AddShadow then parent:AddShadow(self) end
self.frame = sKore.getFrame(self)
end
--- Returns the background color. If this panels has a transparent background,
-- invoke this on the parent and return its value.
--
-- If no background color is found, the default color is returned.
-- @treturn Color The background color.
function PANEL:GetBackgroundColor()
end
--- Sets the background color.
--
-- If set to nil, then the panel is considered transparent.
-- @tparam Color|nil color The background color.
function PANEL:SetBackgroundColor(color)
end
derma.DefineControl("MPanel", "", PANEL, "Panel")
|
--Custom Jedi Crystal Boss Loots
includeFile("custom_loot/groups/crystals/crystal_kuns_blood.lua")
--Custom Jedi Lightsaber Groups
includeFile("custom_loot/groups/lightsabers/exar_kun_ls_group.lua")
includeFile("custom_loot/groups/lightsabers/g_jinzu_razor_loot_deed.lua")
includeFile("custom_loot/groups/lightsabers/ls_gen5_group.lua")
--Custom Jedi Robe
includeFile("custom_loot/groups/clothing/jedi_robe_black_01_group.lua")
includeFile("custom_loot/groups/clothing/jedi_robe_black_02_group.lua")
includeFile("custom_loot/groups/clothing/jedi_robe_tan_01_group.lua")
includeFile("custom_loot/groups/clothing/jedi_robe_tan_02_group.lua")
includeFile("custom_loot/groups/clothing/jedi_robe_gray_01_group.lua")
includeFile("custom_loot/groups/clothing/jedi_robe_gray_02_group.lua")
--Referral Crate
includeFile("custom_loot/groups/ref_crate/ref_crate.lua")
--Custom Vehicle Components
includeFile("custom_loot/groups/vehicle_components/custom_vehicle_rare.lua")
--Vehicle Schematics
includeFile("custom_loot/groups/vehicle_schematics/rare_vehicles.lua")
--Default
includeFile("custom_loot/groups/backpacks/backpacks_b01.lua")
includeFile("custom_loot/groups/backpacks/backpacks_b02.lua")
includeFile("custom_loot/groups/wearables/goggles_all.lua")
--Halloween
includeFile("custom_loot/groups/outbreak/outbreak.lua")
--Jedi Belt Components
includeFile("custom_loot/groups/clothing/jedi_belt_comp_group.lua")
includeFile("custom_loot/groups/clothing/jedi_belt_group.lua")
--Hoth
includeFile("custom_loot/groups/hoth/wampa.lua")
--Event
includeFile("custom_loot/groups/events/event3.lua")
--Lifeday
includeFile("custom_loot/groups/lifeday/lifeday.lua")
|
--[[ Copyright (c) 2020 robot256 (MIT License)
* Project: Multiple Unit Train Control
* File: control.lua
* Description: Runtime operation script for replacing locomotives and balancing fuel.
* Functions:
* => On Train Created (any built, destroyed, coupled, or uncoupled rolling stock)
* ===> Check if forwards_locomotives and backwards_locomotives contain matching pairs
* =====> Replace them with MU locomotives, add to global list of MU pairs, reconnect train, etc.
* ===> Check if train contains existing MU pairs, and if those pairs are intact.
* =====> Replace any partial MU pairs with normal locomotives, remove from global list, reconnect trains
*
* => On Mod Settings Changed (disabled flag changes to true)
* ===> Read through entire global list of MU pairs and replace them with normal locomotives
* => On Nth Tick (once per ~10 seconds)
* ===> Read through entire global list of MU pairs.
* ===> Move among each pair if one has more of any item than the other.
*
--]]
replaceCarriage = require("__Robot256Lib__/script/carriage_replacement").replaceCarriage
blueprintLib = require("__Robot256Lib__/script/blueprint_replacement")
filterLib = require("__Robot256Lib__/script/event_filters")
require("script.balanceInventories")
require("script.checkModuleMatching")
require("script.processTrainPurge")
require("script.processTrainBasic")
require("script.processTrainWireless")
require("script.addPairToGlobal")
require("script.purgeLocoFromPairs")
local settings_mode = settings.global["multiple-unit-train-control-mode"].value
local settings_nth_tick = settings.global["multiple-unit-train-control-on_nth_tick"].value
local settings_debug = settings.global["multiple-unit-train-control-debug"].value
local current_nth_tick = settings_nth_tick
local train_queue_semaphore = false
------------------------- GLOBAL TABLE INITIALIZATION ---------------------------------------
-- Interacts with other mods based on what MU locomotives were created
local function CallRemoteInterface()
-- Make sure FuelTrainStop plays nice with magu's ElectricTrain in the MU versions
if remote.interfaces["FuelTrainStop"] then
for std,mu in pairs(global.upgrade_pairs) do
if std:match("^et%-electric%-locomotive%-%d$") or
std:match("^fusion%-locomotive%-%d$") then
remote.call("FuelTrainStop", "exclude_from_fuel_schedule", mu)
end
end
end
-- Add MU versions of Fluid Trains locomotives to the mod's update list
if remote.interfaces["fluidTrains_hook"] then
if global.upgrade_pairs["SteamTrains-locomotive"] then
remote.call("fluidTrains_hook", "addLocomotive", global.upgrade_pairs["SteamTrains-locomotive"], 20000)
end
if global.upgrade_pairs["Diesel-Locomotive-fluid-locomotive"] then
remote.call("fluidTrains_hook", "addLocomotive", global.upgrade_pairs["Diesel-Locomotive-fluid-locomotive"], 1500)
end
end
end
-- Set up the mapping between normal and MU locomotives
-- Extract from the game prototypes list what MU locomotives are enabled
local function InitEntityMaps()
global.upgrade_pairs = {}
global.downgrade_pairs = {}
-- Retrieve entity names from dummy technology, store in global variable
for _,effect in pairs(game.technology_prototypes["multiple-unit-train-control-locomotives"].effects) do
if effect.type == "unlock-recipe" then
local recipe = game.recipe_prototypes[effect.recipe]
local std = recipe.products[1].name
local mu = recipe.ingredients[1].name
global.upgrade_pairs[std] = mu
global.downgrade_pairs[mu] = std
------------
-- RET Compatibility for this Loco
local mod_name = ""
if remote.interfaces["realistic_electric_trains"] then
-- Check if this is an RET loco, and what fuel the std version uses
local fuel_item = remote.call("realistic_electric_trains", "get_locomotive_fuel", std)
if fuel_item then
-- Add the MU version to RET's global map. Use custom fuel item if specified.
if recipe.ingredients[2] then fuel_item = recipe.ingredients[2].name end
remote.call("realistic_electric_trains", "register_locomotive_type", mu, fuel_item)
mod_name = "Realistic Electric Trains "
end
end
if settings_debug == "info" then
game.print({"debug-message.mu-mapping-message",mod_name,game.entity_prototypes[std].localised_name,game.entity_prototypes[mu].localised_name})
elseif settings_debug == "debug" then
game.print({"debug-message.mu-mapping-message",mod_name,std,mu})
end
end
end
-- Mod compatibility setup
CallRemoteInterface()
end
------------------------- FUEL BALANCING CODE --------------------------------------
-- Takes inventories from the queue and process them, one per tick
local function ProcessInventoryQueue()
local idle = true
if global.inventories_to_balance and next(global.inventories_to_balance) then
--game.print("Taking from inventory queue, " .. #global.inventories_to_balance .. " remaining")
local inventories = table.remove(global.inventories_to_balance, 1)
balanceInventories(inventories[1], inventories[2])
idle = false -- Tell OnTick that we did something useful
end
return idle
end
------------------------- LOCOMOTIVE REPLACEMENT CODE -------------------------------
-- Process replacement order immediately
-- Need to preserve mu_pairs across replacement
local function ProcessReplacement(r)
if r[1] and r[1].valid then
-- Replace the locomotive
local errorString = ""
if settings_debug == "info" then
game.print({"debug-message.mu-replacement-message",r[1].localised_name,r[1].backer_name,game.entity_prototypes[r[2]].localised_name})
errorString = {"debug-message.mu-replacement-failed",r[1].localised_name,r[1].backer_name,r[1].position.x,r[1].position.y}
elseif settings_debug == "debug" then
game.print({"debug-message.mu-replacement-message",r[1].name,r[1].backer_name,r[2]})
errorString = {"debug-message.mu-replacement-failed",r[1].name,r[1].backer_name,r[1].position.x,r[1].position.y}
end
local newLoco = replaceCarriage(r[1], r[2])
-- Find which mu_pair the old one was in and put the new one instead
for _,p in pairs(global.mu_pairs) do
if p[1] == r[1] then
p[1] = newLoco
break
elseif p[2] == r[1] then
p[2] = newLoco
break
end
end
-- Make sure it was actually replaced, show error message if not.
if not newLoco and (settings_debug ~= "none") then
game.print(errorString)
end
end
end
-- Read train state and determine if it is safe to replace
local function isTrainStopped(train)
local state = train.state
local state_ok = train.speed==0 and (
(state == defines.train_state.wait_station) or
(state == defines.train_state.wait_signal) or
(state == defines.train_state.no_path) or
(state == defines.train_state.no_schedule) or
(state == defines.train_state.manual_control)
)
if state_ok then
-- Do an additional checks to make sure the train isn't currently being manipulated by another mod
----------------------
-- ** Compatibility with Space Exploration Space Elevators **
if game.entity_prototypes["se-space-elevator-energy-interface"] then
local space_elevator_hypertrain_radius = 12
local front_pos = train.front_stock.position
local front_structs = train.front_stock.surface.find_entities_filtered{position=front_pos, radius=space_elevator_hypertrain_radius, name="se-space-elevator-energy-interface"}
if front_structs and #front_structs>0 then
state_ok = false
else
local back_pos = train.back_stock.position
local back_structs = train.back_stock.surface.find_entities_filtered{position=back_pos, radius=space_elevator_hypertrain_radius, name="se-space-elevator-energy-interface"}
if back_structs and #back_structs>0 then
state_ok = false
end
end
end
-- ** Compatibility with Train Tunnels **
if game.entity_prototypes["traintunnel"] then
local tunnel_radius = game.entity_prototypes["traintunnel"].radius
local front_structs = train.front_stock.surface.find_entities_filtered{position=train.front_stock.position, radius=tunnel_radius+train.front_stock.get_radius()+3, name={"traintunnel","traintunnelup"}}
if front_structs and #front_structs>0 then
game.print("skipping tunnel "..tostring(game.tick))
state_ok = false
else
local back_structs = train.back_stock.surface.find_entities_filtered{position=train.back_stock.position, radius=tunnel_radius+train.back_stock.get_radius()+3, name={"traintunnel","traintunnelup"}}
if back_structs and #back_structs>0 then
game.print("skipping tunnel "..tostring(game.tick))
state_ok = false
end
end
end
----------------------
end
return state_ok
end
-- Read the mod settings and technology of the given force to decide what mode we're in
local function getAllowedMode(force)
if settings_mode ~= "tech-unlock" then
return settings_mode
elseif force.technologies["adv-multiple-unit-train-control"] and force.technologies["adv-multiple-unit-train-control"].researched then
return "advanced"
elseif force.technologies["multiple-unit-train-control"] and force.technologies["multiple-unit-train-control"].researched then
return "basic"
else
return "disabled"
end
end
------------
-- Process one valid train. Do replacemnts immediately.
local function ProcessTrain(t)
local found_pairs = {}
local upgrade_locos = {}
local unpaired_locos = {}
local mode = getAllowedMode(t.carriages[1].force)
if mode=="advanced" then
found_pairs,upgrade_locos,unpaired_locos = processTrainWireless(t)
elseif mode=="basic" then
found_pairs,upgrade_locos,unpaired_locos = processTrainBasic(t)
else
-- Mod disabled, go through the process of reverting every engine
found_pairs,upgrade_locos,unpaired_locos = processTrainPurge(t)
end
-- Remove pairs involving the now-unpaired locos.
for _,entry in pairs(unpaired_locos) do
purgeLocoFromPairs(entry)
end
-- Add pairs to the pair lists. (pairs will need to be updated when the replacements are made)
for _,entry in pairs(found_pairs) do
addPairToGlobal(entry)
end
-- Replace locomotives immediately
for _,entry in pairs(upgrade_locos) do
ProcessReplacement(entry)
end
end
----------------------------------------------
------ EVENT HANDLING ---
--== ON_TRAIN_CHANGED_STATE EVENT ==--
-- Fires when train pathfinder changes state, executes if the train is in the update list.
-- Use this to replace locomotives at a safe (stopped) time.
local function OnTrainChangedState(event)
local id = event.train.id
--game.print("Train ".. id .. " In OnTrainChangedState!")
-- Event contains train, old_train_state
-- If this train is queued for replacement, check state and maybe process now
if global.moving_trains[id] then
local t = event.train
-- We are waitng to process it, check everything!
if t and t.valid then
-- Check if this train is in a safe state
if isTrainStopped(t) then
-- Immediately replace these locomotives
--game.print("Train " .. id .. " being processed.")
if train_queue_semaphore == false then
train_queue_semaphore = true
ProcessTrain(t)
global.moving_trains[id] = nil
train_queue_semaphore = false
elseif (settings_debug ~= "none") then
game.print("OnChange Train " .. id .. " event ignored because semaphore is occupied (this is weird!)")
end
end
end
end
if not next(global.moving_trains) then
script.on_event(defines.events.on_train_changed_state, nil)
end
--game.print("Train " .. id .. " Exiting OnTrainChangedState")
end
--== ON_NTH_TICK (longer duration) EVENT ==--
-- Periodically purges global.moving_trains because some mods make train ids
-- go invalid while still in motion, that would otherwise never be deleted.
-- This could probably happen if trains get attacked and partially destroyed as well.
local function OnNthTickPurgeMovingList(event)
local purged = 0
local saved = 0
for id,train in pairs(global.moving_trains) do
if not train or not train.valid then
global.moving_trains[id] = nil
purged = purged + 1
else
saved = saved + 1
end
end
if settings_debug == "debug" then
if purged > 1 then
if saved > 0 then
game.print("MUTC Purged "..tostring(purged).." dead trains from global.moving_trains. "..tostring(saved).." moving trains are still valid.")
else
game.print("MUTC Purged "..tostring(purged).." dead trains from global.moving_trains.")
end
end
end
end
-------------
-- Enables the on_train_changed_state event according to current variables
local function StartTrainWatcher()
if global.moving_trains and next(global.moving_trains) then
-- Set up the action to process train after it comes to a stop
script.on_event(defines.events.on_train_changed_state, OnTrainChangedState)
else
script.on_event(defines.events.on_train_changed_state, nil)
end
end
----------
-- Try to process newly created trains immediately
local function ProcessTrainQueue()
-- Check if we are already processing a train.
-- Don't execute this again if it was triggered by an intermediate on_train_created event.
if train_queue_semaphore==false then
train_queue_semaphore = true
if global.created_trains then
--game.print("ProcessTrainQueue has a train in the queue")
-- Keep looping until we discard all the invalid intermediate trains
while next(global.created_trains) do
local t = table.remove(global.created_trains,1)
if t and t.valid then
-- Check if this train is in a safe state
if isTrainStopped(t) then
-- Immediately replace these locomotives
--game.print("Train " .. id .. " being processed.")
ProcessTrain(t)
-- Don't process any more trains this tick
break
else
-- Flag this train to be processed on a ChangedState event
global.moving_trains[t.id] = t
--game.print("Train " .. id .. " still moving.")
end
end
end
end
train_queue_semaphore = false
return true
else
--game.print("Queue already being processed")
return false
end
end
--== ONTICK EVENT ==--
-- Process items queued up by other actions
-- Only one action allowed per tick
local function OnTick(event)
-- Process created trains one per tick
ProcessTrainQueue()
-- Enable state change handler if we found moving trains
StartTrainWatcher()
-- Balancing inventories has third priority
ProcessInventoryQueue()
if (not next(global.inventories_to_balance)) and
(not next(global.created_trains)) then
-- All on_tick queues are empty, unsubscribe from OnTick to save UPS
--game.print("Turning off OnTick")
script.on_event(defines.events.on_tick, nil)
end
end
--== ON_TRAIN_CREATED EVENT ==--
-- Record every new train in global queue, so we can process them one at a time.
-- Many of these events will be triggered by our own replacements, and those
-- "intermediate" trains will be invalid by the time we pull them from the queue.
-- This is the desired behavior.
local function OnTrainCreated(event)
-- Event contains train, old_train_id_1, old_train_id_2
local id = event.train.id
--game.print("Train "..id.." In OnTrainCreated!")
-- Add this train to the train processing list, wait for it to stop
table.insert(global.created_trains, event.train)
-- Remove old trains from moving_trains list
-- When using Renai transportation Train Jumps, this will take care of 99% of the spurious entries
-- from long trains that get disconnected and reconnected while in motion.
if global.moving_trains then
if event.old_train_id_1 then
if global.moving_trains[event.old_train_id_1] then
--game.print("Removed old train "..tostring(event.old_train_id_1).." from moving_trains list")
global.moving_trains[event.old_train_id_1] = nil
end
end
if event.old_train_id_2 then
if global.moving_trains[event.old_train_id_2] then
--game.print("Removed old train "..tostring(event.old_train_id_2).." from moving_trains list")
global.moving_trains[event.old_train_id_2] = nil
end
end
end
--game.print("Train " .. event.train.id .. " queued.")
-- Try to process it immediately. Will exit if we are already processing stuff
script.on_event(defines.events.on_tick, OnTick)
--game.print("Train "..id.." Exiting OnTrainCreated!")
end
--== ON_GUI_CLOSED and ON_PLAYER_FAST_TRANSFERRED ==--
-- Events trigger when player changes module contents of a modular locomotive
local function OnModuleChanged(event)
local e = event.entity
if e and e.valid and e.type=="locomotive" then
table.insert(global.created_trains, e.train)
script.on_event(defines.events.on_tick, OnTick)
end
end
--== ON_NTH_TICK EVENT ==--
-- Initiates balancing of fuel inventories in every MU consist
local function OnNthTick(event)
if global.mu_pairs and next(global.mu_pairs) then
local numInventories = 0
local n = #global.mu_pairs
local done = false
for i=1,n do
local entry = global.mu_pairs[i]
if (entry[1] and entry[2] and entry[1].valid and entry[2].valid) then
-- This pair is good, balance if there are burner fuel inventories (only check one, since they are identical prototypes)
if entry[1].burner then
local inventoryOne = entry[1].burner.inventory
local inventoryTwo = entry[2].burner.inventory
if inventoryOne.valid and inventoryOne.valid and #inventoryOne > 0 then
table.insert(global.inventories_to_balance, {inventoryOne, inventoryTwo})
numInventories = numInventories + 1
-- if it burns stuff, it might have a result
inventoryOne = entry[1].burner.burnt_result_inventory
inventoryTwo = entry[2].burner.burnt_result_inventory
if inventoryOne.valid and inventoryOne.valid and #inventoryOne > 0 then
table.insert(global.inventories_to_balance, {inventoryOne, inventoryTwo})
numInventories = numInventories + 1
end
end
end
else
-- This pair has one or more invalid locomotives, or they don't have burners at all, remove it from the list
global.mu_pairs[i] = nil
end
end
local j=0
for i=1,n do -- Condense the list
if global.mu_pairs[i] ~= nil then
j = j+1
global.mu_pairs[j] = global.mu_pairs[i]
end
end
for i=j+1,n do
global.mu_pairs[i] = nil
end
-- Set up the on_tick action to process trains
--game.print("Nth tick starting OnTick")
if next(global.inventories_to_balance) then
script.on_event(defines.events.on_tick, OnTick)
-- Update the Nth tick interval to make sure we have enough time to update all the trains
local newVal = current_nth_tick
if numInventories+10 > current_nth_tick then
-- If we have fewer than 10 spare ticks per update cycle, give ourselves 50% margin
newVal = (numInventories*3)/2
elseif numInventories < current_nth_tick / 2 then
-- If we have more than 100% margin, reduce either to the min setting or to just 50% margin
newVal = math.max((numInventories*3)/2, settings_nth_tick)
end
if newVal ~= current_nth_tick then
--game.print("Changing MU Control Nth Tick duration to " .. newVal)
if settings_debug == "info" or settings_debug == "debug" then
game.print({"debug-message.mu-changing-tick-message",newVal})
end
current_nth_tick = newVal
global.current_nth_tick = current_nth_tick
RefreshNthTickHandlers()
end
end
end
end
-- Make this a global function so it can be called inside OnNthTick up above
function RefreshNthTickHandlers()
script.on_nth_tick(nil)
if not (settings_nth_tick == 0 or settings_mode == "disabled") then
script.on_nth_tick(current_nth_tick, OnNthTick)
end
script.on_nth_tick(math.max(current_nth_tick*2, 600), OnNthTickPurgeMovingList)
end
--== ON_PLAYER_CONFIGURED_BLUEPRINT EVENT ==--
-- ID 70, fires when you select a blueprint to place
--== ON_PLAYER_SETUP_BLUEPRINT EVENT ==--
-- ID 68, fires when you select an area to make a blueprint or copy
local function OnPlayerSetupBlueprint(event)
blueprintLib.mapBlueprint(event,global.downgrade_pairs)
end
--== ON_PLAYER_PIPETTE ==--
-- Fires when player presses 'Q'. We need to sneakily grab the correct item from inventory if it exists,
-- or sneakily give the correct item in cheat mode.
local function OnPlayerPipette(event)
blueprintLib.mapPipette(event,global.downgrade_pairs)
end
--== ON_PICKED_UP_ITEM ==--
-- When player picks up an item, change -mu to normal loco items.
local function OnPickedUpItem(event)
if global.downgrade_pairs[event.item_stack.name] then
game.players[event.player_index].remove_item(event.item_stack)
game.players[event.player_index].insert({name=global.downgrade_pairs[event.item_stack.name], count=event.item_stack.count})
end
end
script.on_event(defines.events.on_picked_up_item, OnPickedUpItem)
--== ON_PRE_PLAYER_MINED_ITEM ==--
--== ON_ROBOT_PRE_MINED ==--
-- Before player or robot mines an item on the ground, change -mu to normal loco items.
local function OnPreMined(event)
if event.entity.name == "item-on-ground" then
local stack = event.entity.stack
-- Change item-on-ground to unloaded wagon before robot picks it up
if stack.valid_for_read and global.downgrade_pairs[stack.name] then
stack.set_stack({name=global.downgrade_pairs[stack.name], count=stack.count})
end
end
end
script.on_event( defines.events.on_robot_pre_mined,
OnPreMined,
filterLib.generateNameFilter("item-on-ground")
)
script.on_event( defines.events.on_pre_player_mined_item,
OnPreMined,
filterLib.generateNameFilter("item-on-ground")
)
-------------
-- Enables the on_nth_tick event according to the mod setting value
-- Safe to run inside on_load().
-- Also handle the Moving Train List purge timer when settings_nth_tick changes
local function StartBalanceUpdates()
-- Value of zero disables fuel balancing
--game.print("Disabling Nth Tick due to setting")
if not(settings_nth_tick == 0 or settings_mode == "disabled") then
-- See if we stored a longer update rate in global
if global.current_nth_tick and global.current_nth_tick > settings_nth_tick then
current_nth_tick = global.current_nth_tick
else
current_nth_tick = settings_nth_tick
end
-- Start the event
--game.print("Enabling Nth Tick with setting " .. settings_nth_tick)
end
RefreshNthTickHandlers()
end
-----------
-- Queues all existing trains for updating with new settings
local function QueueAllTrains()
for _, surface in pairs(game.surfaces) do
local trains = surface.get_trains()
for _,train in pairs(trains) do
-- Pretend this train was just created. Don't worry how long it takes.
table.insert(global.created_trains, train)
--game.print("Train " .. train.id .. " queued for scrub.")
end
end
if next(global.created_trains) then
script.on_event(defines.events.on_tick, OnTick)
end
end
----------
-- Shows or hides technologies based on runtime setting
local function UpdateTechnologyState()
-- Update technology visible state
if settings_mode == "tech-unlock" then
for _,force in pairs(game.forces) do
if force.technologies["adv-multiple-unit-train-control"] then
force.technologies["adv-multiple-unit-train-control"].enabled = true
end
if force.technologies["multiple-unit-train-control"] then
force.technologies["multiple-unit-train-control"].enabled = true
end
end
else
for _,force in pairs(game.forces) do
if force.technologies["adv-multiple-unit-train-control"] then
force.technologies["adv-multiple-unit-train-control"].enabled = false
end
if force.technologies["multiple-unit-train-control"] then
force.technologies["multiple-unit-train-control"].enabled = false
end
end
end
end
--== ON_RESEARCH_FINISHED EVENT ==--
-- Forces a scrub after researching MUTC technologies
-- Moving trains will be queued until they stop.
local function OnResearchFinished(event)
if (event.research.name == "multiple-unit-train-control") or
(event.research.name == "adv-multiple-unit-train-control") then
-- Reprocess all trains with the new technology setting
QueueAllTrains() -- This will execute some replacements immediately
end
end
---- Bootstrap ----
do
local function init_events()
-- Subscribe to Blueprint activity
script.on_event({defines.events.on_player_setup_blueprint,defines.events.on_player_configured_blueprint}, OnPlayerSetupBlueprint)
script.on_event(defines.events.on_player_pipette, OnPlayerPipette)
-- Subscribe to Technology activity
script.on_event(defines.events.on_research_finished, OnResearchFinished)
-- Subscribe to On_Nth_Tick according to saved global and settings
StartBalanceUpdates()
-- Subscribe to On_Train_Changed_state according to global queue
StartTrainWatcher()
-- Subscribe to On_Train_Created according to mod enabled setting
if settings_mode ~= "disabled" then
script.on_event(defines.events.on_train_created, OnTrainCreated)
script.on_event({defines.events.on_gui_closed, defines.events.on_player_fast_transferred}, OnModuleChanged)
end
-- Set conditional OnTick event handler correctly on load based on global queues, so we can sync with a multiplayer game.
if (global.inventories_to_balance and next(global.inventories_to_balance)) or
(global.created_trains and next(global.created_trains)) then
script.on_event(defines.events.on_tick, OnTick)
end
end
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
--game.print("in mod_settings_changed!")
if event.setting == "multiple-unit-train-control-mode" then
settings_mode = settings.global["multiple-unit-train-control-mode"].value
-- Scrub existing trains according to new settings
QueueAllTrains() -- This will execute some replacements immediately
if settings_mode == "disabled" then
-- Clean globals when disabled
global.mu_pairs = {}
global.inventories_to_balance = {}
end
-- Update technology visible state
UpdateTechnologyState()
-- Enable or disable events based on setting state
init_events()
elseif event.setting == "multiple-unit-train-control-on_nth_tick" then
-- When interval changes, clear the saved update rate and start over
settings_nth_tick = settings.global["multiple-unit-train-control-on_nth_tick"].value
global.current_nth_tick = nil
StartBalanceUpdates()
StartTrainWatcher()
elseif event.setting == "multiple-unit-train-control-debug" then
settings_debug = settings.global["multiple-unit-train-control-debug"].value
end
end)
----------
-- When game is loaded (from save or server), only set up events to match previous state
script.on_load(function()
init_events()
end)
-- When game is created, initialize globals and events
script.on_init(function()
--game.print("In on_init!")
global.created_trains = {}
global.moving_trains = {}
global.mu_pairs = {}
global.inventories_to_balance = {}
InitEntityMaps()
UpdateTechnologyState()
init_events()
end)
-- When mod list/versions change, reinitialize globals and scrub existing trains
script.on_configuration_changed(function(data)
--game.print("In on_configuration_changed!")
global.created_trains = global.created_trains or {}
global.moving_trains = global.moving_trains or {}
global.mu_pairs = global.mu_pairs or {}
global.inventories_to_balance = global.inventories_to_balance or {}
InitEntityMaps()
-- On config change, scrub the list of trains
QueueAllTrains()
init_events()
-- Migrate by clearing old globals
global.trains_in_queue = nil
global.replacement_queue = nil
end)
end
------------------------------------------
-- Debug (print text to player console)
function print_game(...)
local text = ""
for _, v in ipairs{...} do
if type(v) == "table" then
text = text..serpent.block(v)
else
text = text..tostring(v)
end
end
game.print(text)
end
function print_file(...)
local text = ""
for _, v in ipairs{...} do
if type(v) == "table" then
text = text..serpent.block(v)
else
text = text..tostring(v)
end
end
log(text)
end
-- Debug command
function cmd_debug(params)
local cmd = params.parameter
if cmd == "dump" then
for v, data in pairs(global) do
print_game(v, ": ", data)
end
elseif cmd == "dumplog" then
for v, data in pairs(global) do
print_file(v, ": ", data)
end
print_game("Dump written to log file")
end
end
commands.add_command("mutc-debug", "Usage: mutc-debug dump|dumplog", cmd_debug)
------------------------------------------------------------------------------------
-- FIND LOCAL VARIABLES THAT ARE USED GLOBALLY --
-- (Thanks to eradicator!) --
------------------------------------------------------------------------------------
setmetatable(_ENV,{
__newindex=function (self,key,value) --locked_global_write
error('\n\n[ER Global Lock] Forbidden global *write*:\n'
.. serpent.line{key=key or '<nil>',value=value or '<nil>'}..'\n')
end,
__index =function (self,key) --locked_global_read
error('\n\n[ER Global Lock] Forbidden global *read*:\n'
.. serpent.line{key=key or '<nil>'}..'\n')
end ,
})
|
local model = require 'web.mixins.model'
local describe, it, assert = describe, it, assert
describe('web.mixins.model', function()
it('', function()
assert.not_nil(model)
end)
end)
|
-- !!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!
-- This file is automaticly generated. Don't edit manualy!
-- !!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!
---@class C_FriendList
C_FriendList = {}
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.AddFriend)
---@param name string
---@param notes string
function C_FriendList.AddFriend(name, notes)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.AddIgnore)
---@param name string
---@return boolean @added
function C_FriendList.AddIgnore(name)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.AddOrDelIgnore)
---@param name string
function C_FriendList.AddOrDelIgnore(name)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.AddOrRemoveFriend)
---@param name string
---@param notes string
function C_FriendList.AddOrRemoveFriend(name, notes)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.DelIgnore)
---@param name string
---@return boolean @removed
function C_FriendList.DelIgnore(name)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.DelIgnoreByIndex)
---@param index number
function C_FriendList.DelIgnoreByIndex(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetFriendInfo)
---@param name string
---@return FriendInfo @info
function C_FriendList.GetFriendInfo(name)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetFriendInfoByIndex)
---@param index number
---@return FriendInfo @info
function C_FriendList.GetFriendInfoByIndex(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetIgnoreName)
---@param index number
---@return string @name
function C_FriendList.GetIgnoreName(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetNumFriends)
---@return number @numFriends
function C_FriendList.GetNumFriends()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetNumIgnores)
---@return number @numIgnores
function C_FriendList.GetNumIgnores()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetNumOnlineFriends)
---@return number @numOnline
function C_FriendList.GetNumOnlineFriends()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetNumWhoResults)
---@return number, number @numWhos, totalNumWhos
function C_FriendList.GetNumWhoResults()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetSelectedFriend)
---@return number @index
function C_FriendList.GetSelectedFriend()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetSelectedIgnore)
---@return number @index
function C_FriendList.GetSelectedIgnore()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.GetWhoInfo)
---@param index number
---@return WhoInfo @info
function C_FriendList.GetWhoInfo(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.IsFriend)
---@param guid string
---@return boolean @isFriend
function C_FriendList.IsFriend(guid)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.IsIgnored)
---@param token string
---@return boolean @isIgnored
function C_FriendList.IsIgnored(token)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.IsIgnoredByGuid)
---@param guid string
---@return boolean @isIgnored
function C_FriendList.IsIgnoredByGuid(guid)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.RemoveFriend)
---@param name string
---@return boolean @removed
function C_FriendList.RemoveFriend(name)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.RemoveFriendByIndex)
---@param index number
function C_FriendList.RemoveFriendByIndex(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SendWho)
---@param filter string
function C_FriendList.SendWho(filter)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SetFriendNotes)
---@param name string
---@param notes string
---@return boolean @found
function C_FriendList.SetFriendNotes(name, notes)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SetFriendNotesByIndex)
---@param index number
---@param notes string
function C_FriendList.SetFriendNotesByIndex(index, notes)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SetSelectedFriend)
---@param index number
function C_FriendList.SetSelectedFriend(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SetSelectedIgnore)
---@param index number
function C_FriendList.SetSelectedIgnore(index)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SetWhoToUi)
---@param whoToUi boolean
function C_FriendList.SetWhoToUi(whoToUi)
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.ShowFriends)
function C_FriendList.ShowFriends()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_FriendList.SortWho)
---@param sorting string
function C_FriendList.SortWho(sorting)
end
---@class FriendInfo
---@field public connected boolean
---@field public name string
---@field public className string
---@field public area string
---@field public notes string
---@field public guid string
---@field public level number
---@field public dnd boolean
---@field public afk boolean
---@field public rafLinkType RafLinkType
---@field public mobile boolean
FriendInfo = {}
---@class WhoInfo
---@field public fullName string
---@field public fullGuildName string
---@field public level number
---@field public raceStr string
---@field public classStr string
---@field public area string
---@field public filename string
---@field public gender number
WhoInfo = {}
|
AccountHeadCcsView = class("AccountHeadCcsView")
AccountHeadCcsView.onCreationComplete = function (slot0)
ClassUtil.extends(slot0, ZoomPopUpChildView, true, slot0, slot0.bg, slot0.view)
slot0.view.head_lv:setItemResCcsFileName("csb/common/AccountHeadItem.csb")
slot0.view.head_lv:setScrollPolicy(CcsScrollView.SCROLL_H)
end
AccountHeadCcsView.onShow = function (slot0)
slot0._dataTab = slot0:initData()
slot0._index = Hero:getWFaceID()
slot0._gender = Hero:getCbGender()
slot0.model:setHeadSelectedId(mainMgr:parseFaceId(slot0._index))
slot0.model:setHeadSelectedGender(slot0._gender)
slot0:refreshView()
end
AccountHeadCcsView.refreshView = function (slot0)
slot0.view.head_lv:setDatas(TableUtil.cookDataAs2Dimension(slot0._dataTab, 2), true)
end
AccountHeadCcsView.initData = function (slot0)
slot1 = {}
slot2 = {
[0] = "female_",
"male_"
}
slot3 = (Hero:getCbGender() == 0 and {
0,
1
}) or {
1,
0
}
for slot7, slot8 in ipairs(slot3) do
slot9 = slot2[slot8]
for slot13 = 1, PLAYER_HEAD_COUNT, 1 do
table.insert(slot1, {
picName = "plist_head_" .. slot9 .. slot13 .. ".png",
gender = slot8,
faceId = slot13
})
end
end
return slot1
end
AccountHeadCcsView.onBtnClick = function (slot0, slot1, slot2)
if slot1 == slot0.view.btnClose then
if slot0.model:getHeadSelectedId() ~= slot0._index or slot0.model:getHeadSelectedGender() ~= slot0._gender then
slot0.controller:requestChangeFace()
end
slot0.model:setIsShowingHeadView(false)
end
end
AccountHeadCcsView.onHide = function (slot0)
return
end
AccountHeadCcsView.destroy = function (slot0)
destroySomeObj(slot0.view.btnClose)
destroySomeObj(slot0.view.head_lv)
ZoomPopUpChildView.destroy(slot0)
slot0._index = nil
slot0._dataTab = nil
end
return
|
return game:GetFastFlag("RecordRecording") -- Defined in C++
|
local a = require 'packer.async'
local async = a.sync
local await = a.wait
local fmt = string.format
local log = require 'packer.log'
local plugin_utils = require 'packer.plugin_utils'
local util = require 'packer.util'
local function cfg(_config)
config = _config
end
---Serializes a table of git-plugins with `short_name` as table key and another
---table with `commit`; the serialized tables will be written in the path `filename`
---provided, if there is already a snapshot it will be overwritten
---Snapshotting work only with `plugin_utils.git_plugin_type` type of plugins,
---other will be ignored.
---@param filename string
---@param plugins Plugin[]
---@return function
local function do_snapshot(_, filename, plugins)
assert(type(filename) == 'string', fmt("filename needs to be a string but '%s' provided", type(filename)))
assert(type(plugins) == 'table', fmt("plugins needs to be an array but '%s' provided", type(plugins)))
return async(function()
local snapshot_plugins = {}
local opt, start = plugin_utils.list_installed_plugins()
local installed = {}
for key, _ in pairs(opt) do
installed[key] = key
end
for key, _ in pairs(start) do
installed[key] = key
end
for _, plugin in pairs(plugins) do
if installed[plugin.install_path] ~= nil then -- this plugin is installed
log.debug(fmt("Snapshotting '%s'", plugin.short_name))
if plugin.type == plugin_utils.git_plugin_type then
local rev = await(plugin.get_rev())
if rev == '' or rev == nil then
local msg = fmt('Snapshotting %s failed', plugin.short_name)
log.warn(msg)
error(msg)
else
snapshot_plugins[plugin.short_name] = { commit = rev }
end
end
end
end
local snapshot = 'return ' .. vim.inspect(snapshot_plugins)
-- local result = await(a.main(function ()
-- return vim.fn.writefile({snapshot}, filename) == 0
-- end))
-- Doesn't work using vim.fn.writefile
-- vim.schedule_wrap(function ()
-- if vim.fn.writefile(snapshot, filename) ~= 0 then
-- log.warn("Couldn't save snapshot")
-- else
-- log.info("Snapshot saved succesfully")
-- end
-- end)
local file, err = io.open(filename, 'w+')
if err then
log.warn(err)
error(err)
else
file:write(snapshot)
end
if file ~= nil then
file:close()
end
end)
end
local snapshot = setmetatable({ cfg = cfg }, { __call = do_snapshot })
return snapshot
|
local function rgbValue(v) return math.max(v.r, v.g, v.b) end
local function rgbLuminance(v) return 0.299 * v.r + 0.587 * v.g + 0.114 * v.b end
local function rgbHue(v)
if v.r == v.g and v.g == v.b then return 0 end
local max = v.r
local min = v.r
if v.g > max then max = v.g end
if v.b > max then max = v.b end
if v.g < min then min = v.g end
if v.b < min then min = v.b end
local result = 0
if v.r == max then result = (v.g - v.b) / (max - min)
elseif v.g == max then result = 2 + (v.b - v.r) / (max - min)
elseif v.b == max then result = 4 + (v.r - v.g) / (max - min)
end
if result < 0 then result = result + 6 end
return result * 60
end
local function rgbSaturation(v)
local a = math.max(v.r, v.g, v.b)
if a <= 0 then return 0 end
local i = math.min(v.r, v.g, v.b)
return (a - i) / a;
end
local vtmp1
local colors = {}
return {
init = function()
vtmp1 = rgb()
colors.transparent = rgb(0, 0, 0)
colors.black = rgb(0, 0, 0)
colors.silver = rgb(0.75, 0.75, 0.75)
colors.gray = rgb(0.5, 0.5, 0.5)
colors.white = rgb(1, 1, 1)
colors.maroon = rgb(0.5, 0, 0)
colors.red = rgb(1, 0, 0)
colors.purple = rgb(0.5, 0, 0.5)
colors.fuchsia = rgb(1, 0, 1)
colors.green = rgb(0, 0.5, 0)
colors.lime = rgb(0, 1, 0)
colors.olive = rgb(0.5, 0.5, 0)
colors.yellow = rgb(1, 1, 0)
colors.navy = rgb(0, 0, 0.5)
colors.blue = rgb(0, 0, 1)
colors.teal = rgb(0, 0.5, 0.5)
colors.aqua = rgb(0, 1, 1)
end,
type = {
__call = function(_, r, g, b)
return setmetatable({ r = r or 0, g = g or 0, b = b or 0 }, rgb)
end,
__tostring = function(v)
return string.format('(%f, %f, %f)', v.r, v.g, v.b)
end,
__add = function(v, u) if type(v) == 'number' then return rgb(v, v, v):add(u, rgb()) end return v:add(u, rgb()) end,
__sub = function(v, u) if type(v) == 'number' then return rgb(v, v, v):sub(u, rgb()) end return v:sub(u, rgb()) end,
__mul = function(v, u)
if type(v) == 'number' then return rgb(v, v, v) * u end
if rgb.isrgb(u) then return v:mul(u, rgb())
elseif type(u) == 'number' then return v:scale(u, rgb())
else error('rgbs can only be multiplied by rgbs and numbers', 2) end
end,
__div = function(v, u)
if type(v) == 'number' then return rgb(v, v, v) / u end
if rgb.isrgb(u) then return v:div(u, rgb())
elseif type(u) == 'number' then return v:scale(1 / u, rgb())
else error('rgbs can only be divided by rgbs and numbers', 2) end
end,
__pow = function(v, u)
if type(v) == 'number' then return rgb(v, v, v) ^ u end
if rgb.isrgb(u) then return v:pow(u, rgb())
elseif type(u) == 'number' then return rgb(v.r ^ u, v.g ^ u, v.b ^ u)
else error('rgbs can only be raised to power of rgbs and numbers', 2) end
end,
__unm = function(v) return rgb(-v.r, -v.g, -v.b) end,
__len = function(v) return v:value() end,
__eq = function(v, o) return o ~= nil and ffi.istype('rgb', o) and v.r == o.r and v.g == o.g and v.b == o.b end,
__lt = function(v, o) return v:value() < o:value() end,
__le = function(v, o) return v:value() <= o:value() end,
__index = {
new = function(r, g, b)
if rgb.isrgb(r) then return r:clone() end
if rgbm.isrgbm(r) then return r:color() end
if hsv.ishsv(r) then return r:rgb() end
if vec3.isvec3(r) then return rgb(r.x, r.y, r.z) end
if vec4.isvec4(r) then return rgb(r.x * r.w, r.y * r.w, r.z * r.w) end
if type(r) ~= 'number' then
if type(r) == 'table' then
return rgb(tonumber(r[1]) or 0, tonumber(r[2]) or 0, tonumber(r[3]) or 0)
end
r = 0
end
if type(g) ~= 'number' then g = r end
if type(b) ~= 'number' then b = g end
return rgb(r, g, b)
end,
from0255 = function(r, g, b)
if type(r) ~= 'number' then r = 0 end
if type(g) ~= 'number' then g = r end
if type(b) ~= 'number' then b = g end
return rgb(r / 255, g / 255, b / 255)
end,
colors = colors,
isrgb = function(r) return ffi.istype('rgb', r) end,
tmp = function() return vtmp1 end,
type = function(x) return rgb end,
clone = function(v) return rgb(v.r, v.g, v.b) end,
unpack = function(v) return v.r, v.g, v.b end,
table = function(v) return {v.r, v.g, v.b} end,
set = function(v, r, g, b)
if rgb.isrgb(r) then r, g, b = r.r, r.g, r.b
elseif g == nil then g = r b = r end
v.r = r
v.g = g
v.b = b
return v
end,
setLerp = function(v, a, b, k)
v.r = math.lerp(a.r, b.r, k)
v.g = math.lerp(a.g, b.g, k)
v.b = math.lerp(a.b, b.b, k)
return v
end,
add = function(v, u, out)
out = out or v
if rgb.isrgb(u) then
out.r = v.r + u.r
out.g = v.g + u.g
out.b = v.b + u.b
else
out.r = v.r + u
out.g = v.g + u
out.b = v.b + u
end
return out
end,
addScaled = function(v, u, s, out)
out = out or v
out.r = v.r + u.r * s
out.g = v.g + u.g * s
out.b = v.b + u.b * s
return out
end,
sub = function(v, u, out)
out = out or v
if rgb.isrgb(u) then
out.r = v.r - u.r
out.g = v.g - u.g
out.b = v.b - u.b
else
out.r = v.r - u
out.g = v.g - u
out.b = v.b - u
end
return out
end,
mul = function(v, u, out)
out = out or v
out.r = v.r * u.r
out.g = v.g * u.g
out.b = v.b * u.b
return out
end,
div = function(v, u, out)
out = out or v
out.r = v.r / u.r
out.g = v.g / u.g
out.b = v.b / u.b
return out
end,
pow = function(v, u, out)
out = out or v
if type(u) == 'number' then
out.r = v.r ^ u
out.g = v.g ^ u
out.b = v.b ^ u
else
out.r = v.r ^ u.r
out.g = v.g ^ u.g
out.b = v.b ^ u.b
end
return out
end,
scale = function(v, s, out)
out = out or v
out.r = v.r * s
out.g = v.g * s
out.b = v.b * s
return out
end,
min = function(v, s, out)
out = out or v
local sv = rgb.isrgb(s)
out.r = math.min(v.r, sv and s.r or s)
out.g = math.min(v.g, sv and s.g or s)
out.b = math.min(v.b, sv and s.b or s)
return out
end,
max = function(v, s, out)
out = out or v
local sv = rgb.isrgb(s)
out.r = math.max(v.r, sv and s.r or s)
out.g = math.max(v.g, sv and s.g or s)
out.b = math.max(v.b, sv and s.b or s)
return out
end,
saturate = function(v, out)
out = out or v
out.r = math.saturateN(v.r)
out.g = math.saturateN(v.g)
out.b = math.saturateN(v.b)
return out
end,
clamp = function(v, min, max, out)
out = out or v
out.r = math.clampN(v.r, min.r, max.r)
out.g = math.clampN(v.g, min.g, max.g)
out.b = math.clampN(v.b, min.b, max.b)
return out
end,
normalize = function(v)
local m = v:value()
if m > 1 then return v / m end
return v
end,
adjustSaturation = function(v, sat, out)
out = out or v
local avg = (v.r + v.g + v.b) / 3
out.r = math.max(math.lerp(avg, out.r, sat), 0)
out.g = math.max(math.lerp(avg, out.g, sat), 0)
out.b = math.max(math.lerp(avg, out.b, sat), 0)
return out
end,
value = rgbValue,
getValue = rgbValue,
getHue = rgbHue,
hue = rgbHue,
getSaturation = rgbSaturation,
saturation = rgbSaturation,
luminance = rgbLuminance,
getLuminance = rgbLuminance,
hsv = function(v) return hsv(v:hue(), v:saturation(), v:value()) end,
toHsv = function(v) return hsv(v:hue(), v:saturation(), v:value()) end,
rgbm = function(v, m) return rgbm(v.r, v.g, v.b, __util.num_or(m, 1)) end,
toRgbm = function(v, m) return rgbm(v.r, v.g, v.b, __util.num_or(m, 1)) end,
vec3 = function(v) return vec3(v.r, v.g, v.b) end,
toVec3 = function(v) return vec3(v.r, v.g, v.b) end,
}
}
}
|
--[[
MTA Role Play (mta-rp.pl)
Autorzy poniższego kodu:
- Patryk Adamowicz <patrykadam.dev@gmail.com>
Discord: PatrykAdam#1293
Link do githuba: https://github.com/PatrykAdam/mtarp
--]]
playerID = {}
local function onStart()
playerID = {}
for j, w in ipairs(getElementsByType( "player" )) do
local id = 1
for i, v in ipairs(playerID) do
id = i + 1
if not playerID[i] then
id = i
break
end
end
playerID[id] = w
setElementData( w, "player:mtaID", id )
end
end
addEventHandler( "onResourceStart", resourceRoot, onStart )
local function onQuit()
playerID[getElementData(source, "player:mtaID")] = nil
exports.sarp_logs:createLog('SESSION', string.format("[ID: %d] %s opuścił serwer. (Online: %d/%d)", getElementData(source, "player:mtaID"), getPlayerName( source ), getPlayerCount() - 1, getMaxPlayers()))
end
addEventHandler( "onPlayerQuit", root, onQuit )
local function onJoin()
local id = 1
for i, v in ipairs(playerID) do
id = i + 1
if not playerID[i] then
id = i
break
end
end
playerID[id] = source
setElementData( source, "player:mtaID", id )
setPlayerNametagShowing( source, false )
exports.sarp_logs:createLog('SESSION', string.format("[ID: %d] %s wszedł na serwer. (Online: %d/%d)", getElementData(source, "player:mtaID"), getPlayerName( source ), getPlayerCount(), getMaxPlayers()))
end
addEventHandler( "onPlayerJoin", root, onJoin )
|
local actors_config_cache = {}
function bgNPC:ClearActorsConfig()
table.Empty(actors_config_cache)
end
function bgNPC:GetActorConfig(actor_type)
if actors_config_cache[actor_type] then
return actors_config_cache[actor_type]
else
if not bgNPC.cfg.npcs_template[actor_type] then return end
local data = table.Copy(bgNPC.cfg.npcs_template[actor_type])
if data.inherit and data.inherit ~= actor_type then
local inherit_data = bgNPC.cfg.npcs_template[data.inherit]
if inherit_data then
if inherit_data.inherit then
inherit_data = bgNPC:GetActorConfig(inherit_data.inherit)
end
for ik, iv in pairs(inherit_data) do
if ik ~= 'inherit' then
local exist = false
for k, _ in pairs(data) do
if k == ik then
exist = true
break
end
end
if not exist then
data[ik] = iv
end
end
end
end
end
for k, v in pairs(data) do
if isstring(v) and string.StartWith(v, '@') then
local inherit_groups = string.Explode('@', string.Replace(v, ' ', ''))
for _, inherit_actor_type in ipairs(inherit_groups) do
if #inherit_actor_type ~= 0 and inherit_actor_type ~= actor_type then
local inherit_data = bgNPC.cfg.npcs_template[inherit_actor_type]
if inherit_data and inherit_data.inherit then
inherit_data = bgNPC:GetActorConfig(data.inherit)
end
if inherit_data and inherit_data[k] ~= nil then
if data[k] == nil or isstring(data[k]) then
data[k] = inherit_data[k]
elseif data[k] ~= nil and istable(data[k]) and istable(inherit_data[k]) then
for another_key, another_value in pairs(inherit_data[k]) do
if isnumber(another_key) then
table.insert(data, another_value)
elseif data[another_key] == nil then
data[another_key] = another_value
end
end
end
elseif data[k] ~= nil and isstring(data[k]) then
if string.StartWith(data[k], '@') then
data[k] = nil
end
end
end
end
end
end
actors_config_cache[actor_type] = data
return actors_config_cache[actor_type]
end
end
function bgNPC:Log(message, tag)
if not GetConVar('bgn_debug'):GetBool() then return end
if tag ~= nil then
MsgN('[Background NPCs][' .. tostring(tag) .. '] ' .. tostring(message))
else
MsgN('[Background NPCs] ' .. tostring(message))
end
end
function bgNPC:PlayerIsViewVector(ply, pos, radius)
return ply:slibIsViewVector(pos, radius)
end
function bgNPC:NPCIsViewVector(ent, pos, radius)
if ent:IsNextBot() then return true end
if not IsValid(ent) or ent:Health() <= 0 then return false end
radius = radius or 90
local directionAngCos = math.pi / radius
local aimVector = ent:GetAimVector()
local entVector = pos - ent:GetShootPos()
local angCos = aimVector:Dot(entVector) / entVector:Length()
return angCos >= directionAngCos
end
function bgNPC:GetModule(module_name)
return list.Get('BGN_Modules')[module_name]
end
function bgNPC:IsTargetRay(watcher, ent)
if not IsValid(watcher) or watcher:Health() <= 0 then return false end
if not IsValid(ent) or ent:Health() <= 0 then return false end
local center_pos = LocalToWorld(ent:OBBCenter(), Angle(), ent:GetPos(), Angle())
local tr = util.TraceLine({
start = watcher:EyePos(),
endpos = center_pos,
filter = function(e)
if e ~= watcher then
return true
end
end
})
if not tr.Hit or tr.Entity ~= ent then
return false, tr.Entity
end
return true, tr.Entity
end
function bgNPC:GetActivePlayerTool(tool_name, ply)
local ply = ply
if not ply then
if SERVER then return end
ply = LocalPlayer()
end
local tool = ply:GetTool()
if not tool or not tool.GetMode or tool:GetMode() ~= tool_name then return end
return tool
end
|
--
-- Copyright (c) 2016, 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.
--
-- The training loop and learning rate schedule
--
local xlua = require 'xlua'
local optim = require 'optim'
local pastalog = require 'pastalog'
local M = {}
local Trainer = torch.class('resnet.Trainer', M)
local testLogger = optim.Logger('test.log')
function Trainer:__init(model, criterion, opt, optimState)
self.model = model
self.criterion = criterion
self.optimState = optimState or {
optMethod = opt.optMethod,
lrMethod = opt.lrMethod,
epochUpdateLR = opt.epochUpdateLR,
learningRate = opt.LR,
learningRateDecay = opt.LRD,
lrDecayFactor = opt.lrDecayFactor,
momentum = opt.momentum,
nesterov = true,
dampening = 0.0,
weightDecay = opt.weightDecay,
}
--print(self.optimState)
self.opt = opt
self.params, self.gradParams = model:getParameters()
end
function Trainer:train(epoch, dataloader, diffTop1)
-- Trains the model for a single epoch
self.optimState.learningRate = self:learningRate(epoch, diffTop1)
print(self.optimState)
local timer = torch.Timer()
local dataTimer = torch.Timer()
local function feval()
return self.criterion.output, self.gradParams
end
local trainSize = dataloader:size()
local top1Sum, top5Sum, lossSum = 0.0, 0.0, 0.0
local N = 0
print('=> Training epoch # ' .. epoch)
-- set the batch norm to training mode
self.model:training()
for n, sample in dataloader:run(self.opt) do -- sample: image & class
local dataTime = dataTimer:time().real
-- disp progress
xlua.progress(n, dataloader:size())
-- Copy input and target to the GPU
self:copyInputs(sample)
--print(self.input:size())
local output = self.model:forward(self.input):float()
local batchSize = output:size(1)
local loss = self.criterion:forward(self.model.output, self.target)
self.model:zeroGradParameters()
self.criterion:backward(self.model.output, self.target)
self.model:backward(self.input, self.criterion.gradInput)
if self.optimState.optMethod == 'sgd' then
optim.sgd(feval, self.params, self.optimState)
elseif self.optimState.optMethod == 'adam' then
optim.adam(feval, self.params, self.optimState)
end
local top1, top5 = self:computeScore(output, sample.target, 1)
top1Sum = top1Sum + top1*batchSize
top5Sum = top5Sum + top5*batchSize
lossSum = lossSum + loss*batchSize
N = N + batchSize
print((' | Epoch: [%d][%d/%d] Time %.3f Data %.3f Err %1.4f top1 %7.3f top5 %7.3f'):format(
epoch, n, trainSize, timer:time().real, dataTime, loss, top1, top5))
local modelName = self.opt.netType .. '-' .. self.opt.depth .. '-' .. 'LR=' .. self.optimState.learningRate
.. '-' .. 'WD=' .. self.optimState.weightDecay
local trainSeriesName = 'train-top1-' .. self.opt.pastalogName
pastalog(modelName, trainSeriesName, top1, (epoch-1)*trainSize + n, 'http://ct5250-12.ece.gatech.edu:8120/data')
-- check that the storage didn't get changed do to an unfortunate getParameters call
assert(self.params:storage() == self.model:parameters()[1]:storage())
timer:reset()
dataTimer:reset()
end
return top1Sum / N, top5Sum / N, lossSum / N
end
function Trainer:test(epoch, dataloader)
-- Computes the top-1 and top-5 err on the validation set
local timer = torch.Timer()
local dataTimer = torch.Timer()
local size = dataloader:size()
local nCrops = self.opt.tenCrop and 10 or 1
local top1Sum, top5Sum = 0.0, 0.0
local N = 0
self.model:evaluate()
for n, sample in dataloader:run(self.opt) do
local dataTime = dataTimer:time().real
-- disp progress
xlua.progress(n, dataloader:size())
-- Copy input and target to the GPU
self:copyInputs(sample)
local output = self.model:forward(self.input):float()
local batchSize = output:size(1) / nCrops
local loss = self.criterion:forward(self.model.output, self.target)
local top1, top5 = self:computeScore(output, sample.target, nCrops)
top1Sum = top1Sum + top1*batchSize
top5Sum = top5Sum + top5*batchSize
N = N + batchSize
print((' | Test: [%d][%d/%d] Time %.3f Data %.3f top1 %7.3f (%7.3f) top5 %7.3f (%7.3f)'):format(
epoch, n, size, timer:time().real, dataTime, top1, top1Sum / N, top5, top5Sum / N))
local modelName = self.opt.netType .. '-' .. self.opt.depth .. '-' .. 'LR=' .. self.optimState.learningRate
.. '-' .. 'WD=' .. self.optimState.weightDecay
local testSeriesName = 'test-top1-' .. self.opt.pastalogName
pastalog(modelName, testSeriesName, top1, (epoch-1)*size + n, 'http://ct5250-12.ece.gatech.edu:8120/data')
timer:reset()
dataTimer:reset()
end
self.model:training()
print((' * Finished epoch # %d top1: %7.3f top5: %7.3f\n'):format(
epoch, top1Sum / N, top5Sum / N))
local modelName = self.opt.netType .. '-' .. self.opt.depth .. '-' .. 'LR=' .. self.optimState.learningRate
.. '-' .. 'WD=' .. self.optimState.weightDecay
local epochSeriesName = 'epoch-top1-' .. self.opt.pastalogName
pastalog(modelName, epochSeriesName, top1Sum / N, epoch, 'http://ct5250-12.ece.gatech.edu:8120/data')
-- update log
testLogger:add{['epoch'] = epoch, ['top-1 error'] = top1Sum / N, ['top-5 error'] = top5Sum / N}
return top1Sum / N, top5Sum / N
end
function Trainer:computeScore(output, target, nCrops)
if nCrops > 1 then
-- Sum over crops
output = output:view(output:size(1) / nCrops, nCrops, output:size(2))
--:exp()
:sum(2):squeeze(2)
end
-- Coputes the top1 and top5 error rate
local batchSize = output:size(1)
local _ , predictions = output:float():sort(2, true) -- descending
-- Find which predictions match the target
local correct = predictions:eq(
target:long():view(batchSize, 1):expandAs(output))
-- Top-1 score
local top1 = 1.0 - (correct:narrow(2, 1, 1):sum() / batchSize)
-- Top-5 score, if there are at least 5 classes
local len = math.min(5, correct:size(2))
local top5 = 1.0 - (correct:narrow(2, 1, len):sum() / batchSize)
return top1 * 100, top5 * 100
end
function Trainer:copyInputs(sample)
-- Copies the input to a CUDA tensor, if using 1 GPU, or to pinned memory,
-- if using DataParallelTable. The target is always copied to a CUDA tensor
self.input = self.input or (self.opt.nGPU == 1
and torch.CudaTensor()
or cutorch.createCudaHostTensor())
self.target = self.target or torch.CudaTensor()
self.input:resize(sample.input:size()):copy(sample.input)
self.target:resize(sample.target:size()):copy(sample.target)
end
function Trainer:learningRate(epoch, diffTop1)
-- Training schedule
local decayPower = 0
if self.opt.dataset == 'imagenet' or self.opt.dataset == 'ucf101' then
decayPower = math.floor((epoch - 1) / 30)
return self.opt.LR * math.pow(self.optimState.lrDecayFactor, decayPower)
elseif self.opt.dataset == 'cifar10' then
decayPower = epoch >= 122 and 2 or epoch >= 81 and 1 or 0
return self.opt.LR * math.pow(self.optimState.lrDecayFactor, decayPower)
elseif self.opt.dataset == 'ucf101-flow' then
if self.optimState.lrMethod == 'manual' then
decayPower = decayPower
elseif self.optimState.lrMethod == 'fixed' then
decayPower = math.floor((epoch - 1) / self.optimState.epochUpdateLR)
elseif self.optimState.lrMethod == 'adaptive' then
if epoch > 1 and diffTop1 < 5e-3 then
decayPower = decayPower + 0.1
end
end
return self.opt.LR * math.pow(self.optimState.lrDecayFactor, decayPower)
end
--return self.opt.LR * math.pow(0.1, decayPower)
end
return M.Trainer
|
local cache = require "kong.tools.database_cache"
local _M = {}
function _M.execute(conf)
local ssl = require "ngx.ssl"
ssl.clear_certs()
local data = cache.get_or_set(cache.ssl_data(ngx.ctx.api.id), function()
local result = {
cert_der = ngx.decode_base64(conf._cert_der_cache),
key_der = ngx.decode_base64(conf._key_der_cache)
}
return result
end)
local ok, err = ssl.set_der_cert(data.cert_der)
if not ok then
ngx.log(ngx.ERR, "failed to set DER cert: ", err)
return
end
local ok, err = ssl.set_der_priv_key(data.key_der)
if not ok then
ngx.log(ngx.ERR, "failed to set DER private key: ", err)
return
end
end
return _M
|
--[[Go down to line 336 to change frames g00ber]]--
wait(1/60)
Player = game.Players.LocalPlayer
Character = Player.Character
PlayerGui = Player.PlayerGui
Backpack = Player.Backpack
Torso = Character.Torso
Head = Character.Head
Humanoid = Character.Humanoid
LeftArm = Character["Left Arm"]
LeftLeg = Character["Left Leg"]
RightArm = Character["Right Arm"]
RightLeg = Character["Right Leg"]
Character = Player.Character
PlayerGui = Player.PlayerGui
Backpack = Player.Backpack
Torso = Character.Torso
Head = Character.Head
Humanoid = Character.Humanoid
LeftArm = Character["Left Arm"]
LeftLeg = Character["Left Leg"]
RightArm = Character["Right Arm"]
RightLeg = Character["Right Leg"]
LS = Torso["Left Shoulder"]
LH = Torso["Left Hip"]
RS = Torso["Right Shoulder"]
RH = Torso["Right Hip"]
Neck = Torso.Neck
attacktype = 1
vt = Vector3.new
cf = CFrame.new
euler = CFrame.fromEulerAnglesXYZ
angles = CFrame.Angles
necko = cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
necko2 = cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
LHC0 = cf(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
LHC1 = cf(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
RHC0 = cf(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
RHC1 = cf(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
RootPart = Character.HumanoidRootPart
RootJoint = RootPart.RootJoint
RootCF = euler(-1.57, 0, 3.14)
attack = false
equipped = true
local Anim = "Idle"
local Effects = {}
cam = workspace.CurrentCamera
ZTarget = nil
RocketTarget = nil
local RbxUtility = LoadLibrary("RbxUtility")
local Create = RbxUtility.Create
local m = Create("Model"){
Parent = Character,
Name = "WeaponModel",
}
mouse = Player:GetMouse()
RSH, LSH = nil, nil
LH = Torso["Left Hip"]
RH = Torso["Right Hip"]
RSH = Torso["Right Shoulder"]
LSH = Torso["Left Shoulder"]
RSH.Parent = nil
LSH.Parent = nil
RW = Create("Weld"){
Name = "Right Shoulder",
Part0 = Torso ,
C0 = cf(1.5, 0.5, 0),
C1 = cf(0, 0.5, 0),
Part1 = RightArm ,
Parent = Torso ,
}
LW = Create("Weld"){
Name = "Left Shoulder",
Part0 = Torso ,
C0 = cf(-1.5, 0.5, 0),
C1 = cf(0, 0.5, 0) ,
Part1 = LeftArm ,
Parent = Torso ,
}
local co1 = 0--how long it will take for skill to cooldown
local co2 = 0
local co3 = 0
local co4 = 0
local cooldown1 = 0
local cooldown2 = 0
local cooldown3 = 0
local cooldown4 = 0
local maxEnergy = 100
local Energy = 100--Energy you start out with
local skill1stam = 0--how much Energy is needed for a skill
local skill2stam = 0
local skill3stam = 0
local skill4stam = 0
local recovermana = 3--how much mana per second
local skillcolorscheme = BrickColor.new("Green").Color
local scrn = Instance.new('ScreenGui', Player.PlayerGui)
function makeframe(par, trans, pos, size, color)
local frame = Instance.new('Frame', par)
frame.BackgroundTransparency = trans
frame.BorderSizePixel = 0
frame.Position = pos
frame.Size = size
frame.BackgroundColor3 = color
return frame
end
function makelabel(par, text)
local label = Instance.new('TextLabel', par)
label.BackgroundTransparency = 1
label.Size = UDim2.new(1, 0, 1, 0)
label.Position = UDim2.new(0, 0, 0, 0)
label.TextColor3 = Color3.new(255, 255, 255)
label.TextStrokeTransparency = 0
label.FontSize = Enum.FontSize.Size32
label.Font = Enum.Font.SourceSansBold
label.BorderSizePixel = 0
label.TextScaled = true
label.Text = text
end
framesk1 = makeframe(scrn, .5, UDim2.new(.23, 0, .93, 0), UDim2.new(.26, 0, .06, 0), skillcolorscheme)
framesk2 = makeframe(scrn, .5, UDim2.new(.5, 0, .93, 0), UDim2.new(.26, 0, .06, 0), skillcolorscheme)
framesk3 = makeframe(scrn, .5, UDim2.new(.5, 0, .86, 0), UDim2.new(.26, 0, .06, 0), skillcolorscheme)
framesk4 = makeframe(scrn, .5, UDim2.new(.23, 0, .86, 0), UDim2.new(.26, 0, .06, 0), skillcolorscheme)
bar1 = makeframe(framesk1, 0, UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), skillcolorscheme)
bar2 = makeframe(framesk2, 0, UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), skillcolorscheme)
bar3 = makeframe(framesk3, 0, UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), skillcolorscheme)
bar4 = makeframe(framesk4, 0, UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), skillcolorscheme)
text1 = makelabel(framesk1, '[r] Energy Wave')
text2 = makelabel(framesk2, '[f] Energy Laser')
text3 = makelabel(framesk3, "[e] Energy Burst")
text4 = makelabel(framesk4, '[q] Energy Shots')
Energybar = makeframe(scrn, .5, UDim2.new(.23, 0, .82, 0), UDim2.new(.26, 0, .03, 0), BrickColor.new("Black").Color)
Energycover = makeframe(Energybar, 0, UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), BrickColor.new("Bright red").Color)
Energytext = makelabel(Energybar, 'Energy')
healthbar = makeframe(scrn, .5, UDim2.new(.5, 0, .82, 0), UDim2.new(.26, 0, .03, 0), BrickColor.new("Black").Color)
healthcover = makeframe(healthbar, 0, UDim2.new(0, 0, 0, 0), UDim2.new(1, 0, 1, 0), BrickColor.new("Bright red").Color)
healthtext = makelabel(healthbar, 'Health')
local stats=Instance.new('Folder',Character)
stats.Name='Stats'
local block=Instance.new('BoolValue',stats)
block.Name='Block'
block.Value=false
local stun=Instance.new('BoolValue',stats)
stun.Name='Stun'
stun.Value=false
local defense=Instance.new('NumberValue',stats)
defense.Name='Defence'
defense.Value=1
local speed=Instance.new('NumberValue',stats)
speed.Name='Speed'
speed.Value=1
local damagea=Instance.new('NumberValue',stats)
damagea.Name='Damage'
damagea.Value=1
function NoOutline(Part)
Part.TopSurface, Part.BottomSurface, Part.LeftSurface, Part.RightSurface, Part.FrontSurface, Part.BackSurface = 10, 10, 10, 10, 10, 10
end
function nooutline(part)
part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
end
function part(formfactor, parent, material, reflectance, transparency, brickcolor, name, size)
local fp = Create("Part"){
formFactor = formfactor,
Parent = parent,
Reflectance = reflectance,
Transparency = transparency,
CanCollide = false,
Locked = true,
BrickColor = BrickColor.new(tostring(brickcolor)),
Name = name,
Size = size,
Position = Character.Torso.Position,
Material = material,
}
nooutline(fp)
return fp
end
function mesh(Mesh, part, meshtype, meshid, offset, scale)
local Msh = Create(Mesh){
Parent = part,
Offset = offset,
Scale = scale,
}
if Mesh == "SpecialMesh" then
Msh.MeshType = meshtype
Msh.MeshId = meshid
end
return Msh
end
function weld(parent, part0, part1, c0, c1)
local Weld = Create("Weld"){
Parent = parent,
Part0 = part0,
Part1 = part1,
C0 = c0,
C1 = c1,
}
return Weld
end
local function CFrameFromTopBack(at, top, back)
local right = top:Cross(back)
return CFrame.new(at.x, at.y, at.z,
right.x, top.x, back.x,
right.y, top.y, back.y,
right.z, top.z, back.z)
end
function Triangle(a, b, c)
local edg1 = (c - a):Dot((b - a).unit)
local edg2 = (a - b):Dot((c - b).unit)
local edg3 = (b - c):Dot((a - c).unit)
if edg1 <= (b - a).magnitude and edg1 >= 0 then
a, b, c = a, b, c
elseif edg2 <= (c - b).magnitude and edg2 >= 0 then
a, b, c = b, c, a
elseif edg3 <= (a - c).magnitude and edg3 >= 0 then
a, b, c = c, a, b
else
assert(false, "unreachable")
end
local len1 = (c - a):Dot((b - a).unit)
local len2 = (b - a).magnitude - len1
local width = (a + (b - a).unit * len1 - c).magnitude
local maincf = CFrameFromTopBack(a, (b - a):Cross(c - b).unit, -(b - a).unit)
local list = {}
local Color = BrickColor.new("Dark stone grey")
if len1 > 0.01 then
local w1 = Create('WedgePart', m){
Material = "SmoothPlastic",
FormFactor = 'Custom',
BrickColor = Color,
Transparency = 0,
Reflectance = 0,
Material = "SmoothPlastic",
CanCollide = false,
Anchored = true,
Parent = workspace,
Transparency = 0.3,
}
game:GetService("Debris"):AddItem(w1, 5)
NoOutline(w1)
local sz = Vector3.new(0.2, width, len1)
w1.Size = sz
local sp = Create("SpecialMesh"){
Parent = w1,
MeshType = "Wedge",
Scale = Vector3.new(0, 1, 1) * sz / w1.Size,
}
w1:BreakJoints()
table.insert(Effects, {
w1,
"Disappear",
.03
})
w1.CFrame = maincf * CFrame.Angles(math.pi, 0, math.pi / 2) * CFrame.new(0, width / 2, len1 / 2)
table.insert(list, w1)
end
if len2 > 0.01 then
local w2 = Create('WedgePart', m){
Material = "SmoothPlastic",
FormFactor = 'Custom',
BrickColor = Color,
Transparency = 0,
Reflectance = 0,
Material = "SmoothPlastic",
CanCollide = false,
Anchored = true,
Parent = workspace,
Transparency = 0.3,
}
game:GetService("Debris"):AddItem(w2, 5)
NoOutline(w2)
local sz = Vector3.new(0.2, width, len2)
w2.Size = sz
local sp = Create("SpecialMesh"){
Parent = w2,
MeshType = "Wedge",
Scale = Vector3.new(0, 1, 1) * sz / w2.Size,
}
w2:BreakJoints()
table.insert(Effects, {
w2,
"Disappear",
.03
})
w2.CFrame = maincf * CFrame.Angles(math.pi, math.pi, -math.pi / 2) * CFrame.new(0, width / 2, -len1 - len2 / 2)
table.insert(list, w2)
end
return unpack(list)
end
function so(id, par, vol, pit)
coroutine.resume(coroutine.create(function()
local sou = Instance.new("Sound", par or workspace)
sou.Volume = vol
sou.Pitch = pit or 1
sou.SoundId = Sounds[id].Id or id
swait()
sou:play()
swait(6)
sou:Remove()
end))
end
function clerp(a, b, t)
return a:lerp(b, t)
end
--[[Credits to SazErenos for his Artificial ]]--
ArtificialHB = Instance.new("BindableEvent", script)
ArtificialHB.Name = "Heartbeat"
script:WaitForChild("Heartbeat")
frame = 1 / 60
tf = 0
allowframeloss = false
tossremainder = false
lastframe = tick()
script.Heartbeat:Fire()
game:GetService("RunService").Heartbeat:connect(function(s, p)
tf = tf + s
if tf >= frame then
if allowframeloss then
script.Heartbeat:Fire()
lastframe = tick()
else
for i = 1, math.floor(tf / frame) do
script.Heartbeat:Fire()
end
lastframe = tick()
end
if tossremainder then
tf = 0
else
tf = tf - frame * math.floor(tf / frame)
end
end
end)
function swait(num)
if num == 0 or num == nil then
ArtificialHB.Event:wait()
else
for i = 0, num do
ArtificialHB.Event:wait()
end
end
end
function rayCast(Pos, Dir, Max, Ignore)
return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
end
Asset = "http://www.roblox.com/asset/?id="
Sounds = {
Hit1 = {
Id = Asset..(199149137)
},
Hit2 = {
Id = Asset..(199149186)
},
Hit3 = {
Id = Asset..(199149221)
},
Hit4 = {
Id = Asset..(199149235)
},
Slash1 = {
Id = Asset..(161006195)
},
Slash2 = {
Id = Asset..(161006212)
},
Fire = {
Id = Asset..(168413145)
},
Beam = {
Id = Asset..(278596476)
},
Appear = {
Id = Asset..(200633077)
},
Disappear = {
Id = Asset..(200633029)
},
}
ContentProvider = game:GetService("ContentProvider")
for _, v in pairs(Sounds) do
ContentProvider:Preload(v.Id)
end
Damagefunc = function(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
if hit.Parent == nil then
return
end
local h = hit.Parent:FindFirstChild("Humanoid")
for _, v in pairs(hit.Parent:children()) do
if v:IsA("Humanoid") then
h = v
end
end
if h ~= nil and hit.Parent.Name ~= Character.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
if hit.Parent:findFirstChild("DebounceHit") ~= nil then
if hit.Parent.DebounceHit.Value == true then
return
end
end
if h.MaxHealth >= math.huge then
hit:BreakJoints()
end
--[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
return
end]]
-- hs(hit,1.2)
local c = Create("ObjectValue"){
Name = "creator",
Value = game:service("Players").LocalPlayer,
Parent = h,
}
game:GetService("Debris"):AddItem(c, .5)
if HitSound ~= nil and HitPitch ~= nil then
so(HitSound, hit, 1, HitPitch)
end
local Damage = math.random(minim, maxim)
-- h:TakeDamage(Damage)
local blocked = false
local block = hit.Parent:findFirstChild("Block")
if block ~= nil then
if block.className == "IntValue" then
if block.Value > 0 then
blocked = true
block.Value = block.Value - 1
print(block.Value)
end
end
end
if blocked == false then
-- h:TakeDamage(Damage)
h.Health = h.Health - Damage
ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, Part.BrickColor.Color)
else
h.Health = h.Health - (Damage / 2)
ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, Part.BrickColor.Color)
end
if Type == "Knockdown" then
local hum = hit.Parent.Humanoid
hum.PlatformStand = true
coroutine.resume(coroutine.create(function(HHumanoid)
swait(1)
HHumanoid.PlatformStand = false
end), hum)
local angle = (hit.Position - (Property.Position + Vector3.new(0, 0, 0))).unit
local bodvol = Create("BodyVelocity"){
velocity = angle * knockback,
P = 5000,
maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
Parent = hit,
}
local rl = Create("BodyAngularVelocity"){
P = 3000,
maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000,
angularvelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)),
Parent = hit,
}
game:GetService("Debris"):AddItem(bodvol, .5)
game:GetService("Debris"):AddItem(rl, .5)
elseif Type == "Normal" then
local vp = Create("BodyVelocity"){
P = 500,
maxForce = Vector3.new(math.huge, 0, math.huge),
velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05,
}
if knockback > 0 then
vp.Parent = hit.Parent.Torso
end
game:GetService("Debris"):AddItem(vp, .5)
elseif Type == "Up" then
local bodyVelocity = Create("BodyVelocity"){
velocity = vt(0, 20, 0),
P = 5000,
maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
Parent = hit,
}
game:GetService("Debris"):AddItem(bodyVelocity, .5)
elseif Type == "Snare" then
local bp = Create("BodyPosition"){
P = 2000,
D = 100,
maxForce = Vector3.new(math.huge, math.huge, math.huge),
position = hit.Parent.Torso.Position,
Parent = hit.Parent.Torso,
}
game:GetService("Debris"):AddItem(bp, 1)
elseif Type == "Freeze" then
local BodPos = Create("BodyPosition"){
P = 50000,
D = 1000,
maxForce = Vector3.new(math.huge, math.huge, math.huge),
position = hit.Parent.Torso.Position,
Parent = hit.Parent.Torso,
}
local BodGy = Create("BodyGyro") {
maxTorque = Vector3.new(4e+005, 4e+005, 4e+005) * math.huge ,
P = 20e+003,
Parent = hit.Parent.Torso,
cframe = hit.Parent.Torso.CFrame,
}
hit.Parent.Torso.Anchored = true
coroutine.resume(coroutine.create(function(Part)
swait(1.5)
Part.Anchored = false
end), hit.Parent.Torso)
game:GetService("Debris"):AddItem(BodPos, 3)
game:GetService("Debris"):AddItem(BodGy, 3)
end
local debounce = Create("BoolValue"){
Name = "DebounceHit",
Parent = hit.Parent,
Value = true,
}
game:GetService("Debris"):AddItem(debounce, Delay)
c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = Player
c.Parent = h
game:GetService("Debris"):AddItem(c, .5)
end
end
function ShowDamage(Pos, Text, Time, Color)
local Rate = (1 / 30)
local Pos = (Pos or Vector3.new(0, 0, 0))
local Text = (Text or "")
local Time = (Time or 2)
local Color = (Color or Color3.new(1, 0, 0))
local EffectPart = part("Custom", workspace, "SmoothPlastic", 0, 1, BrickColor.new(Color), "Effect", vt(0, 0, 0))
EffectPart.Anchored = true
local BillboardGui = Create("BillboardGui"){
Size = UDim2.new(3, 0, 3, 0),
Adornee = EffectPart,
Parent = EffectPart,
}
local TextLabel = Create("TextLabel"){
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
Text = Text,
TextColor3 = Color,
TextScaled = true,
Font = Enum.Font.ArialBold,
Parent = BillboardGui,
}
game.Debris:AddItem(EffectPart, (Time + 0.1))
EffectPart.Parent = game:GetService("Workspace")
delay(0, function()
local Frames = (Time / Rate)
for Frame = 1, Frames do
wait(Rate)
local Percent = (Frame / Frames)
EffectPart.CFrame = CFrame.new(Pos) + Vector3.new(0, Percent, 0)
TextLabel.TextTransparency = Percent
end
if EffectPart and EffectPart.Parent then
EffectPart:Destroy()
end
end)
end
Handle = part(Enum.FormFactor.Custom, m, Enum.Material.Neon, 0, 0, "Bright red", "Handle", Vector3.new(1.20000005, 0.200000003, 1.20000005))
Handleweld = weld(m, Character["Torso"], Handle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.0396080017, -4.09992504, 0.0598115921, 1, -7.6153174e-011, -2.01268858e-006, 8.22890089e-011, 1, 3.084431e-006, 2.01269063e-006, -3.084431e-006, 1))
mesh("CylinderMesh", Handle, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.660000086, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(1.44000006, 0.200000003, 1.44000006))
Partweld = weld(m, Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(5.14984131e-005, 1.62124634e-005, -1.04904175e-005, 1, 1.23146328e-011, 1.07286201e-006, -1.13079598e-011, 1, -1.07284109e-006, -1.07285791e-006, 1.07284109e-006, 1))
mesh("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Layer2Handle = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Layer2Handle", Vector3.new(0.480000019, 0.200000003, 0.480001062))
Layer2Handleweld = weld(m, Handle, Layer2Handle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.000301361084, 2.28881836e-005, -0.000202178955, 1, 2.70082467e-007, -1.75730406e-006, -2.70091959e-007, 1, -8.66388018e-006, 1.7573052e-006, 8.66388655e-006, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.Neon, 0, 0, "Bright red", "Part", Vector3.new(0.480000019, 0.200000003, 0.720000625))
Partweld = weld(m, Layer2Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(5.14984131e-005, -9.53674316e-007, -2.8800478, 0.999997914, -1.93837602e-011, -1.48245363e-008, 3.90257063e-011, 1, -7.13953341e-011, 1.48336312e-008, 8.91304808e-011, 0.999997914))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.Neon, 0, 0, "Bright red", "Part", Vector3.new(0.480000019, 0.200000003, 0.720000625))
Partweld = weld(m, Layer2Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(4.19616699e-005, -3.24249268e-005, 2.87992668, 0.999985158, 2.87014509e-012, -1.48093022e-008, 5.66184322e-011, 1, -5.45696821e-012, 1.48470463e-008, 8.04902811e-011, 0.999985158))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.480000019, 0.200000003, 5.04000092))
Partweld = weld(m, Layer2Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(1.33514404e-005, -9.53674316e-007, -0.0001039505, 0.999987781, -7.77617137e-011, -1.49125299e-008, 1.16872789e-010, 1, -1.96905603e-010, 1.493936e-008, 2.51930032e-010, 0.999987781))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
mesh("BlockMesh", Layer2Handle, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Layer3Handle = part(Enum.FormFactor.Custom, m, Enum.Material.Neon, 0, 1, "Bright red", "Layer3Handle", Vector3.new(0.720000029, 0.720000029, 0.200000003))
Layer3Handleweld = weld(m, Handle, Layer3Handle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.000802993774, -0.000151634216, 3.05175781e-005, 0.999999404, 4.16033836e-005, 1.96785777e-006, 1.96798396e-006, -2.12107511e-006, -0.999999404, -4.16014955e-005, 1, -2.12118243e-006))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(9.53674316e-007, -0.840223312, 3.5397892, 4.89614176e-005, 5.0135186e-006, 0.999999762, -0.999999046, 1.22189522e-005, 4.8959475e-005, -1.22783813e-005, -0.999998689, 5.01443719e-006))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(1.20000005, 0.200000003, 0.720000327))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.000864028931, -6.00814819e-005, -3.59964466, -0.999999404, 9.70068322e-006, 3.31623378e-005, 3.31642768e-005, 4.86649742e-006, 1, 9.70056226e-006, 0.999999404, -4.86679755e-006))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(2.76565552e-005, -0.840137482, 3.54048443, -3.42451713e-005, -5.10578684e-006, -0.99999994, -0.999998927, -1.21146441e-005, 3.4243305e-005, -1.2144611e-005, 0.999998927, -5.10543578e-006))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(1.20000005, 0.200000003, 0.720000327))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.000713348389, -2.76565552e-005, -3.6005826, -0.999993503, -9.68569748e-006, 5.00400529e-005, -5.00420938e-005, -4.89724516e-006, -0.999999881, 9.62627109e-006, -0.999993503, 4.89690592e-006))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-7.62939453e-006, -0.838525772, 3.54048347, 3.57801182e-005, 5.10578639e-006, 0.99999994, 0.999999046, 1.0341405e-005, -3.57782446e-005, -1.03266702e-005, 0.999998927, -5.10551126e-006))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-5.7220459e-006, -0.84022522, 3.53960228, -3.45465851e-005, -1.12046393e-006, -1, 5.82638359e-006, -0.999999225, 1.12023974e-006, -0.999999225, -5.82638404e-006, 3.45446933e-005))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-2.86102295e-006, -0.839550018, 3.53951263, 3.41143859e-005, 1.04596313e-006, 1, -6.24368704e-006, 0.999999225, -1.04572723e-006, -0.999999225, -6.24369022e-006, 3.41124942e-005))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(1.20000005, 0.200000003, 0.720000327))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.000238418579, -9.53674316e-006, -3.59959984, 6.28840098e-006, -0.999999225, 1.09042128e-006, -3.40994848e-005, -1.09065854e-006, -1, 0.999999225, 6.2884028e-006, -3.4097593e-005))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.Neon, 0, 0.19999998807907, "Bright red", "Part", Vector3.new(0.480000019, 0.480000019, 0.200000003))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0, 3.81469727e-006, 0.999998808, 4.0078163e-011, 1.9098958e-009, 4.0078163e-011, 0.999998808, 2.42152964e-011, 1.9098958e-009, 2.42152964e-011, 1))
mesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=18430887", Vector3.new(0, 0, 0), Vector3.new(3.58200026, 3.58200002, 2.9532001))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(4.00543213e-005, -0.838380814, 3.53930187, -4.74264707e-005, -5.02687499e-006, -0.999999762, 0.999999046, -1.03116026e-005, -4.74245317e-005, -1.0311428e-005, -0.999998808, 5.02768307e-006))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.Neon, 0, 0, "Black", "Part", Vector3.new(0.480000019, 0.480000019, 0.200000003))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0, 0, 0.999998808, 4.0078163e-011, 1.9098958e-009, 4.0078163e-011, 0.999998808, 2.42152964e-011, 1.9098958e-009, 2.42152964e-011, 1))
mesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=18430887", Vector3.new(0, 0, 0), Vector3.new(3.60000014, 3.60000014, 3.60000014))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(7.62939453e-006, -0.839694977, 3.53992653, -3.91442991e-005, -8.80631774e-007, -0.999993026, 2.27987925e-006, 0.999991357, -8.80696462e-007, 0.999997556, -2.29477519e-006, -3.92767397e-005))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(1.20000005, 0.200000003, 0.720000327))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.000235557556, -2.38418579e-005, -3.60028458, 1.50501114e-006, -0.999997199, 8.35720812e-007, 3.47488422e-005, 8.35786693e-007, 1, -0.999997199, -1.50502308e-006, 3.47468304e-005))
mesh("BlockMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 0.600000024, 1))
Part = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.200000003, 0.480000019, 0.840000391))
Partweld = weld(m, Layer3Handle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-2.28881836e-005, -0.840080261, 3.54010582, 3.91591857e-005, 8.0613512e-007, 0.999993026, -2.25008012e-006, -0.999991, 8.06197477e-007, 0.999997556, -2.29477519e-006, -3.92916445e-005))
mesh("SpecialMesh", Part, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
HitboxA = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 1, "Black", "HitboxA", Vector3.new(0.200000003, 2.48000002, 0.840000391))
HitboxAweld = weld(m, Layer3Handle, HitboxA, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-6.67572021e-006, -0.039557457, 3.53951645, 3.44422551e-005, 1.04596529e-006, 1, -5.90090622e-006, 0.999999225, -1.04573905e-006, -0.999999225, -5.90090895e-006, 3.44403634e-005))
HitboxB = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 1, "Black", "HitboxB", Vector3.new(0.200000003, 2.48000026, 0.840000391))
HitboxBweld = weld(m, Layer3Handle, HitboxB, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(9.53674316e-007, -0.0402240753, 3.5397892, 4.89614176e-005, 5.0135186e-006, 0.999999762, -0.999999046, 1.22189522e-005, 4.8959475e-005, -1.22783813e-005, -0.999998689, 5.01443719e-006))
HitboxC = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 1, "Black", "HitboxC", Vector3.new(0.200000003, 2.28000021, 0.840000391))
HitboxCweld = weld(m, Layer3Handle, HitboxC, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(2.76565552e-005, 0.0598621368, 3.54048443, -3.42451713e-005, -5.10578684e-006, -0.99999994, -0.999998927, -1.21146441e-005, 3.4243305e-005, -1.2144611e-005, 0.999998927, -5.10543578e-006))
mesh("SpecialMesh", HitboxC, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
HitboxD = part(Enum.FormFactor.Custom, m, Enum.Material.SmoothPlastic, 0, 1, "Black", "HitboxD", Vector3.new(0.200000003, 2.28000021, 0.840000391))
HitboxDweld = weld(m, Layer3Handle, HitboxD, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-2.28881836e-005, 0.0599050522, 3.54010582, 3.91591857e-005, 8.0613512e-007, 0.999993026, -2.25008012e-006, -0.999991, 8.06197477e-007, 0.999997556, -2.29477519e-006, -3.92916445e-005))
mesh("SpecialMesh", HitboxD, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(0.600000024, 1, 1))
mesh("SpecialMesh", Layer3Handle, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=18430887", Vector3.new(0, 0, 0), Vector3.new(6, 6, -1.21799994))
local Lite = Create("PointLight"){
Parent = Handle,
Color = BrickColor.new("Green").Color,
Shadows = true,
Range = 20,
Brightness = 0.5,
}
local Spin = Create("Sound"){
Parent = Handle,
SoundId = "rbxassetid://143301643",
Volume = 1,
Pitch = 1,
Looped = true,
}
local Spin2 = Create("Sound"){
Parent = Handle,
SoundId = "rbxassetid://149560784",
Volume = .7,
Pitch = .8,
Looped = true,
}
Spin:Play()
Spin2:Play()
local PE1 = Create("ParticleEmitter"){
Parent = Layer3Handle,
Color = ColorSequence.new(BrickColor.new("Green").Color),
Transparency = NumberSequence.new(.5),
Size = NumberSequence.new(0.2),
Texture = "rbxassetid://263433152",
Lifetime = NumberRange.new(1),
Rate = 20,
VelocitySpread = 180,
Rotation = NumberRange.new(100),
Speed = NumberRange.new(3),
LightEmission = 1,
}
function Reappear()
for _, i in pairs(m:children()) do
if i.Name == "Layer3Handle" then
Part.Transparency = 1
coroutine.resume(coroutine.create(function(Part)
for i = 0, 1, 0.1 do
swait()
Part.Transparency = i
end
Part.Transparency = 0.5
end), i)
end
end
end
function Disappear()
for _, i in pairs(m:children()) do
if i.Name == "Layer3Handle" then
Part.Transparency = .5
coroutine.resume(coroutine.create(function(Part)
for i = 0, 1, 0.1 do
swait()
Part.Transparency = i
end
Part.Transparency = 1
end), i)
end
end
end
function attackone()
attack = true
local con1 = HitboxA.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit1", 1)
end)
local con2 = HitboxB.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit2", 1)
end)
local con3 = HitboxC.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit3", 1)
end)
local con4 = HitboxD.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit4", 1)
end)
Reappear()
for i = 0, 1, 0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-50)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(5), math.rad(0), math.rad(50)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(30)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1, 0.3, .3) * angles(math.rad(-30), math.rad(0), math.rad(30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(120), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-70), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(5, -4, -7) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
so("Slash1", Handle, 1, 1)
for i = 0, 1, 0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(50)), .5)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(5), math.rad(0), math.rad(-50)), .5)
RW.C0 = clerp(RW.C0, CFrame.new(1.2, 0.5, -.5) * angles(math.rad(90), math.rad(0), math.rad(-30)), 0.5)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.5)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(70), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .5)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-120), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .5)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(-2, -4, -8) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
Disappear()
con1:disconnect()
con2:disconnect()
con3:disconnect()
con4:disconnect()
attack = false
end
function attacktwo()
attack = true
local con1 = HitboxA.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit1", 1)
end)
local con2 = HitboxB.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit2", 1)
end)
local con3 = HitboxC.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit3", 1)
end)
local con4 = HitboxD.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit4", 1)
end)
Reappear()
for i = 0, 1, 0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-10), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.4, 0.5, -.5) * angles(math.rad(150), math.rad(0), math.rad(0)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.3, 0.3, 0) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, -.3) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, .2) * angles(math.rad(0), math.rad(-85), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(-4, 10, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
so("Slash2", Handle, 1, 1.2)
for i = 0, 1, 0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .5)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(10), math.rad(0), math.rad(0)), .5)
RW.C0 = clerp(RW.C0, CFrame.new(1.2, 0.3, -.5) * angles(math.rad(50), math.rad(0), math.rad(-30)), 0.5)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-50)), 0.5)
RH.C0 = clerp(RH.C0, cf(1, -1, -.3) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .5)
LH.C0 = clerp(LH.C0, cf(-1, -1, .2) * angles(math.rad(0), math.rad(-85), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .5)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(-4, .5, -8) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.4)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
Disappear()
con1:disconnect()
con2:disconnect()
con3:disconnect()
con4:disconnect()
attack = false
end
function attackthree()
attack = true
local con1 = HitboxA.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit1", 1)
end)
local con2 = HitboxB.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit2", 1)
end)
local con3 = HitboxC.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit3", 1)
end)
local con4 = HitboxD.Touched:connect(function(hit)
Damagefunc(HitboxA, hit, 10, 30, math.random(1, 5), "Normal", RootPart, .1, "Hit4", 1)
end)
Reappear()
for i = 0, 1, 0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(50)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(0), math.rad(0), math.rad(-50)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.4, 0.8, -.5) * angles(math.rad(120), math.rad(0), math.rad(-30)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.3, 0.3, 0) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, -.3) * angles(math.rad(0), math.rad(70), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, .2) * angles(math.rad(0), math.rad(-140), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(-10, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-20)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
so("Slash1", Handle, 1, 1.2)
for i = 0, 1, 0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-50)), .5)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(10), math.rad(0), math.rad(50)), .5)
RW.C0 = clerp(RW.C0, CFrame.new(1.4, 0.5, 0) * angles(math.rad(50), math.rad(0), math.rad(30)), 0.5)
LW.C0 = clerp(LW.C0, CFrame.new(-1.3, 0.3, 0) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.5)
RH.C0 = clerp(RH.C0, cf(1, -1, -.3) * angles(math.rad(0), math.rad(140), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .5)
LH.C0 = clerp(LH.C0, cf(-1, -1, .2) * angles(math.rad(0), math.rad(-50), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .5)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, -5, -10) * angles(math.rad(0), math.rad(0), math.rad(-20)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
Disappear()
con1:disconnect()
con2:disconnect()
con3:disconnect()
con4:disconnect()
attack = false
end
local hovering = false
local Hover = false
local Animator = Humanoid.Animator
function OnHover()
so("Appear",Handle,1,1)
attack = true
Animator.Parent = nil
Character.Animate.Disabled = true
Hover = true
Humanoid.JumpPower = 0
Reappear()
attack = false
end
function OffHover()
so("Disappear",Handle,1,1)
attack = true
Animator.Parent = Humanoid
Character.Animate.Disabled = false
Hover = false
Humanoid.JumpPower = 50
Disappear()
attack = false
end
function MagniDamage(Hit,Part,magni,mindam,maxdam,knock,Type)
for _,c in pairs(workspace:children()) do
local hum=c:findFirstChild("Humanoid")
if hum~=nil then
local head=c:findFirstChild("Torso")
if head~=nil then
local targ=head.Position-Part.Position
local mag=targ.magnitude
if mag<=magni and c.Name~=Player.Name then
Damagefunc(Hit,head,mindam,maxdam,knock,Type,RootPart,.2,"Hit1",1)
end
end
end
end
end
function CylinderEffect(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,Character,"Neon",0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("CylinderMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
Effects[#Effects+1]={prt,"Cylinder",delay,x3,y3,z3} --part, type, delay
end
RocketTarget = RootPart
function ShootCannon(asd)
local MainPos=asd.Position
local MainPos2=mouse.Hit.p
local MouseLook=cf((MainPos+MainPos2)/2,MainPos2)
num=30
coroutine.resume(coroutine.create(function()
repeat
wait()
local hit,pos = rayCast(MainPos,MouseLook.lookVector,10,RocketTarget.Parent)
local mag=(MainPos-pos).magnitude
CylinderEffect(BrickColor.new("Teal"),CFrame.new((MainPos+pos)/2,pos)*angles(1.57,0,0),3,mag*5,3,1.5,0,1.5,0.1)
MainPos=MainPos+(MouseLook.lookVector*10)
num=num-1
if hit~=nil then
num=0
local ref=part(3,workspace,"Neon",0,1,BrickColor.new("Green"),"Reference",vt())
ref.Anchored=true
ref.CFrame=cf(pos)
MagniDamage(ref,hit,5,30,50,1,"Normal")
game:GetService("Debris"):AddItem(ref,5)
end
until num<=0
end))
end
function BlastEffect(brickcolor, cframe, x1, y1, z1, x2, y2, z2)
local prt = part(3, workspace, "SmoothPlastic", 0, 0, brickcolor, "Effect", vt(0.5, 0.5, 0.5))
prt.Anchored = true
prt.CFrame = cframe
local msh = mesh("SpecialMesh", prt, "FileMesh", "http://www.roblox.com/asset/?id=20329976", vt(0, 0, 0), vt(x1, y1, z1))
coroutine.resume(coroutine.create(function()
for i = 0, 1, 0.05 do
wait()
prt.Transparency = i
msh.Scale = msh.Scale + vt(x2, y2, z2)
end
prt.Parent = nil
end))
end
function BlockEffect(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,"Neon",0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Block1",delay,x3,y3,z3}) --part, type, delay
end
function FireProjectiles()
attack = true
so("Appear",Handle,1,1)
Reappear()
for i = 0,1,0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-30), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(150), math.rad(0), math.rad(0)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(20), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -6*i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 6*i, math.rad(0)), 0.3)
end
Humanoid.WalkSpeed = 0
for i = 1,8 do
ShootCannon(Handle)
BlockEffect(BrickColor.new("Green"),Handle.CFrame,.5,.5,.5,.9,.9,.9,0.05)
so("Beam",Handle,1,1.5)
for i = 0,1,0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .5)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(0), math.rad(0), math.rad(0)), .5)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(85), math.rad(0), math.rad(30)), 0.5)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(85), math.rad(0), math.rad(-30)), 0.5)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, 1, 0) * angles(math.rad(-90), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -6*i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 6*i, math.rad(0)), 0.3)
end
end
Disappear()
so("Disappear",Handle,1,1)
Humanoid.WalkSpeed = 16
attack = false
end
function EnergyBurst()
attack = true
so("Appear",Handle,1,1)
for i = 0,1,0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-50)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(0), math.rad(0), math.rad(50)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(50), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(130), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-70), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(10, -4, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -6*i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 6*i, math.rad(0)), 0.3)
end
Reappear()
so("Slash1", Handle, 1, 1.2)
for i = 1,2 do
for i = 0,1,0.1 do
swait()
BlockEffect(BrickColor.new("Teal"),Handle.CFrame,.5,.5,.5,.9,.9,.9,0.05)
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(70)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(0), math.rad(0), math.rad(-70)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(20), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-40), math.rad(0), math.rad(-50)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(70), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-130), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(15, -4, -7) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -6*i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 6*i, math.rad(0)), 0.3)
end
end
Disappear()
so("Disappear",Handle,1,1)
so("Fire", Handle, 1, 1.2)
so("Fire", Handle, 1, .8)
MagniDamage(Handle,Handle,30,30,50,1,"Knockdown")
BlastEffect(BrickColor.new("Green"), Handle.CFrame, .1, .1, .1, 1, 1, 1)
for i = 1,5 do
BlockEffect(BrickColor.new("Green"),Handle.CFrame,1,1,1,5,5,5,0.05)
end
attack = false
end
function WaveEffect(Part,cframe1,cframe2,Damage,Size)
coroutine.resume(coroutine.create(function()
local wave=part(1,workspace,"Neon",0,0,BrickColor.new("Green"),"Effect",vt(3,3,10))
wave.Anchored=true
wave.CFrame=Part.CFrame*cframe1
so("Beam",wave,1,1.3)
MagniDamage(wave,wave,10,10,30,1,"Normal")
local Msh = Create("SpecialMesh"){
Parent = wave,
MeshType = "Sphere"
}
BlockEffect(BrickColor.new("Green"),wave.CFrame,1,1,1,3,3,3,0.05)
local PE1 = Create("ParticleEmitter"){
Parent = wave,
Color = ColorSequence.new(BrickColor.new("Green").Color),
Transparency = NumberSequence.new(.5),
Size = NumberSequence.new(1),
Texture = "rbxassetid://249270319",
Lifetime = NumberRange.new(1),
Rate = 50,
VelocitySpread = 180,
Rotation = NumberRange.new(0),
Speed = NumberRange.new(5),
LightEmission = 1,
}
for i=0,1,0.2 do
wait()
local dir = wave.CFrame.lookVector*-1
local pos = rayCast(wave.Position,dir,5,Character)
wave.CFrame=wave.CFrame*cframe2
Effects[#Effects+1]={wave,"Cylinder",0.01,.03,.03,.03}
end
end))
end
function Wave()
attack = true
Reappear()
so("Appear",Handle,1,.8)
for i = 1,3 do
for i = 0, 1, 0.1 do
swait()
BlockEffect(BrickColor.new("Green"),Handle.CFrame,.1,.1,.1,1,1,1,0.05)
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-10), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.8, 0) * angles(math.rad(150), math.rad(0), math.rad(0)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(-4, 10, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.4)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
end
so("Slash2",Handle,1,.4)
local inc=-10
for i=1,8 do
WaveEffect(Torso,CFrame.new(0,-5,inc)*CFrame.fromEulerAnglesXYZ(-2,0,1.57),CFrame.new(0,0,0.8),10,5)
inc=inc-7
end
for i = 1,2 do
for i = 0, 1, 0.1 do
swait()
BlockEffect(BrickColor.new("Green"),Handle.CFrame,.1,.1,.1,1,1,1,0.05)
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(10), math.rad(0), math.rad(0)), .5)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-5), math.rad(0), math.rad(0)), .5)
RW.C0 = clerp(RW.C0, CFrame.new(1.2, 0.4, -.5) * angles(math.rad(50), math.rad(0), math.rad(-20)), 0.5)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-50), math.rad(0), math.rad(-50)), 0.5)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(10)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(-10)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(-4, .5, -10) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.5)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -5 * i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 5 * i, math.rad(0)), 0.3)
end
end
Disappear()
so("Disappear",Handle,1,.8)
attack = false
end
function LaserBarrage(Prt,Parent)
attack=true
--so("BeamLockon",Prt,1,1)
local efprt=part(3,Parent,"Neon",0,0.5,BrickColor.new("Green"),"Effect",vt(5,5,5))
efprt.Anchored=true
local efmsh=mesh("CylinderMesh",efprt,"","",vt(0,0,0),vt(1,1,1))
local spread=vt(0,0,0)
coroutine.resume(coroutine.create(function(Part,Mesh,Spreaded)
game:GetService("Debris"):AddItem(Part,6)
local TheHit=mouse.Hit.p
local MouseLook=cf((Prt.Position+TheHit)/2,TheHit+Spreaded)
local hit,pos = rayCast(Prt.Position,MouseLook.lookVector,1000,Parent)
so("Elec",Prt,0.2,1)
local tefprt=part(3,workspace,"Neon",0,1,BrickColor.new("Black"),"Effect",vt(0.2,0.2,0.2))
tefprt.CFrame=cf(pos)
MagicCircle(BrickColor.new("Green"),cf(pos),5,5,5,5,5,5,0.04)
so("Elec",tefprt,0.3,1)
game:GetService("Debris"):AddItem(tefprt,3)
Part.CFrame=CFrame.new((Prt.Position+pos)/2,pos)*angles(1.57,0,0)
if(hit.Parent:findFirstChild("Humanoid")~= nil)then
if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Name ~= "Base" and hit.Parent.Name ~= Player.Name then
MagniDamage(efprt,efprt,40,50,130,20,1)
end
end
local mag=(Prt.Position-pos).magnitude
MagicCylinder(BrickColor.new("Green"),Part.CFrame,1,mag*5,1,5,5,5,0.05)
Part.Parent=nil
end),efprt,efmsh,spread)
end
function SuperLaser()
attack = true
so("Appear",Handle,1,0.5)
Humanoid.WalkSpeed = 5
Reappear()
for i = 0,1,0.01 do
swait()
BlockEffect(BrickColor.new("Green"),Handle.CFrame,.1,.1,.1,1,1,1,0.05)
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .5)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-5), math.rad(0), math.rad(0)), .5)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(85), math.rad(0), math.rad(50)), 0.5)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(85), math.rad(0), math.rad(-50)), 0.5)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, 1, 0) * angles(math.rad(-90), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -6*i, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 6*i, math.rad(0)), 0.3)
end
Humanoid.WalkSpeed = 0
LaserBarrage(Handle,Character)
so("Beam",Handle,1,0.8)
for i = 0,1,0.05 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), .2)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(0), math.rad(0), math.rad(0)), .2)
RW.C0 = clerp(RW.C0, CFrame.new(1.3, 0.5, -.5) * angles(math.rad(85), math.rad(0), math.rad(0)), 0.2)
LW.C0 = clerp(LW.C0, CFrame.new(-1.3, 0.5, -.5) * angles(math.rad(85), math.rad(0), math.rad(0)), 0.2)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .2)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-5), math.rad(0), math.rad(0)), .2)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, 1, 0) * angles(math.rad(-90), math.rad(0), math.rad(0)), 0.2)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), -6*i, math.rad(0)), 0.2)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), 6*i, math.rad(0)), 0.2)
end
Disappear()
so("Disappear",Handle,1,.7)
Humanoid.WalkSpeed = 16
attack = false
end
function MagicCylinder(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,"Neon",0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("SpecialMesh",prt,"Head","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,2)
coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,delay do
swait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)
end
function MagicCircle(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,"Neon",0,0,brickcolor,"Effect",vt(0.5,0.5,0.5))
prt.Anchored=true
prt.CFrame=cframe
prt.CanCollide = false
msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,2)
coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,delay do
swait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)
end
mouse.Button1Down:connect(function()
if attack == false and Hover == false and attacktype == 1 then
attacktype = 2
attackone()
elseif attack == false and Hover == false and attacktype == 2 then
attacktype = 3
attacktwo()
elseif attack == false and Hover == false and attacktype == 3 then
attacktype = 1
attackthree()
end
end)
function subtractEnergy(k)
if Energy>=k then
Energy=Energy-k
end
end
mouse.KeyDown:connect(function(k)
k = k:lower()
if attack == false and k == ' ' and Anim == "Jump" and Hover == false then
hovering = true
OnHover()
elseif attack == false and k == ' ' and Hover == true then
hovering = false
OffHover()
elseif attack == false and k == 'q' and Hover == false and cooldown1 >= co1 and Energy>=skill1stam then
subtractEnergy(skill1stam)
cooldown1=0
FireProjectiles()
elseif attack == false and k == 'e' and Hover == false and cooldown2 >= co2 and Energy>=skill2stam then
subtractEnergy(skill2stam)
cooldown2=0
EnergyBurst()
elseif attack == false and k == 'r' and Hover == false and cooldown3 >= co3 and Energy>=skill3stam then
subtractEnergy(skill3stam)
cooldown3=0
Wave()
elseif attack == false and k == 'f' and Hover == false and cooldown4 >= co4 and Energy>=skill4stam then
subtractEnergy(skill4stam)
cooldown4=0
SuperLaser()
end
end)
function updateskills()
if cooldown1 <= co1 then
cooldown1 = cooldown1 + 1 / 30
end
if cooldown2 <= co2 then
cooldown2 = cooldown2 + 1 / 30
end
if cooldown3 <= co3 then
cooldown3 = cooldown3 + 1 / 30
end
if cooldown4 <= co4 then
cooldown4 = cooldown4 + 1 / 30
end
if Energy<=skill1stam then
bar4.BackgroundColor3=Color3.new(104/255,104/255,104/255)
else
bar4.BackgroundColor3=skillcolorscheme
end
if Energy<=skill2stam then
bar3.BackgroundColor3=Color3.new(104/255,104/255,104/255)
else
bar3.BackgroundColor3=skillcolorscheme
end
if Energy<=skill3stam then
bar1.BackgroundColor3=Color3.new(104/255,104/255,104/255)
else
bar1.BackgroundColor3=skillcolorscheme
end
if Energy<=skill4stam then
bar2.BackgroundColor3=Color3.new(104/255,104/255,104/255)
else
bar2.BackgroundColor3=skillcolorscheme
end
if Energy <= maxEnergy then
Energy = Energy + recovermana / 30
end
end
local sine = 0
local change = 1
local val = 0
local idle = 0
local donum = 0
local donum2 = 0
while true do
swait()
updateskills()
healthcover:TweenSize(UDim2.new(1 * (Character.Humanoid.Health / Character.Humanoid.MaxHealth), 0, 1, 0), 'Out', 'Quad', .5)
Energycover:TweenSize(UDim2.new(1 * (Energy / maxEnergy), 0, 1, 0), 'Out', 'Quad', .5)
bar4:TweenSize(UDim2.new(1 * (cooldown1 / co1), 0, 1, 0), 'Out', 'Quad', .5)
bar3:TweenSize(UDim2.new(1 * (cooldown2 / co2), 0, 1, 0), 'Out', 'Quad', .5)
bar1:TweenSize(UDim2.new(1 * (cooldown3 / co3), 0, 1, 0), 'Out', 'Quad', .5)
bar2:TweenSize(UDim2.new(1 * (cooldown4 / co4), 0, 1, 0), 'Out', 'Quad', .5)
sine = sine + change
torvel = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
velderp = RootPart.Velocity.y
hitfloor, posfloor = rayCast(RootPart.Position, (CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 1, 0))).lookVector, 4, Character)
if equipped == true or equipped == false then
if attack == false then
idle = idle + 1
else
idle = 0
end
if idle >= 500 then
if attack == false then
end
end
if donum2 >= .5 then
handidle = true
elseif donum2 <= 0 then
handidle = false
end
if handidle == false then
donum2 = donum2 + 0.003
else
donum2 = donum2 - 0.003
end
donum = donum + 0.003
if RootPart.Velocity.y > 1 and hitfloor == nil then
Anim = "Jump"
if attack == false then
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(5), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-10), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(30)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -.8, -.5) * angles(math.rad(0), math.rad(90), math.rad(-20)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, -.3) * angles(math.rad(0), math.rad(-90), math.rad(30)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, .5+0.2*math.cos(sine/15), 0) * angles(math.rad(0), math.rad(0), math.rad(20) - donum2 / 1), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .01, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .03, math.rad(0)), 0.3)
end
elseif RootPart.Velocity.y < -1 and hitfloor == nil then
Anim = "Fall"
if attack == false then
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(-5), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(10), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(50)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-50)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -.7, -.5) * angles(math.rad(0), math.rad(90), math.rad(-20)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -.9, -.3) * angles(math.rad(0), math.rad(-90), math.rad(30)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, .5+0.2*math.cos(sine/15), 0) * angles(math.rad(0), math.rad(0), math.rad(20) - donum2 / 1), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .01, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .03, math.rad(0)), 0.3)
elseif attack == false and Hover == true then
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 5) * angles(math.rad(0), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(10), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1, 0.3, .3) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1, 0.3, .3) * angles(math.rad(-30), math.rad(0), math.rad(30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -.8, -.3) * angles(math.rad(0), math.rad(90), math.rad(-30)) * angles(math.rad(3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(40)) * angles(math.rad(2), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, -8, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .01, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .03, math.rad(0)), 0.3)
end
elseif torvel < 1 and hitfloor ~= nil then
Anim = "Idle"
change = 1
if attack == false and Hover == false then
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-30)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(5), math.rad(0), math.rad(30)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(.8, 0.5, -.7) * angles(math.rad(85), math.rad(0), math.rad(-70)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-.8, 0.5, -.3) * angles(math.rad(70), math.rad(0), math.rad(70)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-70), math.rad(0)) * angles(math.rad(-3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, .5+0.2*math.cos(sine/15), 0) * angles(math.rad(0), math.rad(0), math.rad(20) - donum2 / 1), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .01, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .03, math.rad(0)), 0.3)
elseif attack == false and Hover == true then
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 5+0.2*math.cos(sine/15)) * angles(math.rad(0), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(10+3.5*math.cos(sine/15)), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1, 0.3, .3) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1, 0.3, .3) * angles(math.rad(-30), math.rad(0), math.rad(30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -.8, -.3) * angles(math.rad(0), math.rad(90), math.rad(-30)) * angles(math.rad(3), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(40)) * angles(math.rad(2), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, -8, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .01, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .03, math.rad(0)), 0.3)
end
elseif torvel > 2 and hitfloor ~= nil then
Anim = "Walk"
if attack == false and Hover == false then
change = 1
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(5), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(5), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(40) * math.cos(sine / 7), math.rad(0), math.rad(5)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-40) * math.cos(sine / 7), math.rad(0), math.rad(-5)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-2), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-2), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, .5+0.2*math.cos(sine/15), 0) * angles(math.rad(20), math.rad(0), math.rad(20) - donum2 / 1), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .01, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .03, math.rad(0)), 0.3)
elseif attack == false and Hover == true then
change = 1
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 5+0.2*math.cos(sine/15)) * angles(math.rad(30+3.5*math.cos(sine/15)), math.rad(0), math.rad(0)), .3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, necko * angles(math.rad(-15-3.5*math.cos(sine/15)), math.rad(0), math.rad(0)), .3)
RW.C0 = clerp(RW.C0, CFrame.new(1.4, 0.45, 0) * angles(math.rad(-30), math.rad(0), math.rad(30)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.4, 0.45, 0) * angles(math.rad(-30), math.rad(0), math.rad(-30)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -.8, -.3) * angles(math.rad(0), math.rad(90), math.rad(-30)) * angles(math.rad(5), math.rad(0), math.rad(0)), .3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * angles(math.rad(0), math.rad(-90), math.rad(40)) * angles(math.rad(3), math.rad(0), math.rad(0)), .3)
Handleweld.C0 = clerp(Handleweld.C0, CFrame.new(0, -8, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Layer2Handleweld.C0 = clerp(Layer2Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) - donum / .008, math.rad(0)), 0.3)
Layer3Handleweld.C0 = clerp(Layer3Handleweld.C0, CFrame.new(0, 0, 0) * angles(math.rad(0), math.rad(30) + donum / .009, math.rad(0)), 0.3)
end
end
end
if #Effects > 0 then
for e = 1, #Effects do
if Effects[e] ~= nil then
local Thing = Effects[e]
if Thing ~= nil then
local Part = Thing[1]
local Mode = Thing[2]
local Delay = Thing[3]
local IncX = Thing[4]
local IncY = Thing[5]
local IncZ = Thing[6]
if Thing[1].Transparency <= 1 then
if Thing[2] == "Block1" then
Thing[1].CFrame = Thing[1].CFrame * euler(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
Mesh = Thing[1].Mesh
Mesh.Scale = Mesh.Scale + vt(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
elseif Thing[2] == "Cylinder" then
Mesh = Thing[1].Mesh
Mesh.Scale = Mesh.Scale + vt(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
elseif Thing[2] == "Blood" then
Mesh = Thing[7]
Thing[1].CFrame = Thing[1].CFrame * cf(0, .5, 0)
Mesh.Scale = Mesh.Scale + vt(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
elseif Thing[2] == "Elec" then
Mesh = Thing[1].Mesh
Mesh.Scale = Mesh.Scale + vt(Thing[7], Thing[8], Thing[9])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
elseif Thing[2] == "Disappear" then
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
end
else
Part.Parent = nil
table.remove(Effects, e)
end
end
end
end
end
end
Character=game.Workspace.PixelFir3
zv = Instance.new('Sound',Character)
zv.Looped=false
zv.Volume=1
zv.Pitch=5
zv.SoundId="rbxassetid://340389859"
wait(0.01)
zv:Play()
wait(10)
zv:Remove()
---------------------- W00T --------------------
Player=game:GetService("Players").LocalPlayer
Character=Player.Character
PlayerGui=Player.PlayerGui
Backpack=Player.Backpack
Torso=Character.Torso
Head=Character.Head
Humanoid=Character.Humanoid
LeftArm=Character["Left Arm"]
LeftLeg=Character["Left Leg"]
RightArm=Character["Right Arm"]
RightLeg=Character["Right Leg"]
LS=Torso["Left Shoulder"]
LH=Torso["Left Hip"]
RS=Torso["Right Shoulder"]
RH=Torso["Right Hip"]
Neck=Torso.Neck
it=Instance.new
vt=Vector3.new
cf=CFrame.new
euler=CFrame.fromEulerAnglesXYZ
angles=CFrame.Angles
necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
RootPart=Character.HumanoidRootPart
RootJoint=RootPart.RootJoint
RootCF=euler(-1.57,0,3.14)
attack=false
attackdebounce=false
MMouse=nil
combo=0
local Anim="Idle"
local Effects={}
equipped=false
local idle=0
local hold=false
local con1=nil
local con2=nil
local Mode="Binary"
local idleanim=0
local idleanim2=false
local impulse=1
local hitfloor,posfloor=nil,nil
local damcount=0
local guard=false
local Duration=0
--player
player=nil
--save shoulders
RSH, LSH=nil, nil
--welds
RW, LW=Instance.new("Weld"), Instance.new("Weld")
RW.Name="Right Shoulder" LW.Name="Left Shoulder"
LH=Torso["Left Hip"]
RH=Torso["Right Hip"]
Asset="http://www.roblox.com/asset/?id="
Health=100
Humanoid.MaxHealth=100
Humanoid.Health=100
coroutine.resume(coroutine.create(function()
for i=1,20 do
Humanoid.MaxHealth=100
Humanoid.Health=100
end
Humanoid.MaxHealth=100
Humanoid.Health=100
Humanoid.Health=100
end))
Humanoid.Health=Health
function swait(num)
if num==0 or num==nil then
game:service'RunService'.RenderStepped:wait()
else
for i=0,num do
game:service'RunService'.RenderStepped:wait()
end
end
end
if Character:findFirstChild("Binary Sword",true) ~= nil then
Character:findFirstChild("Binary Sword",true).Parent = nil
end
if Character:findFirstChild("Demon Blade",true) ~= nil then
Character:findFirstChild("Demon Blade",true).Parent = nil
end
if Player.PlayerGui:findFirstChild("WeaponGUI",true) ~= nil then
Player.PlayerGui:findFirstChild("WeaponGUI",true).Parent = nil
end
function NoOutline(Part)
Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
end
function part(formfactor,parent,reflectance,transparency,brickcolor,name,size)
local fp=it("Part")
fp.formFactor=formfactor
fp.Parent=parent
fp.Reflectance=reflectance
fp.Transparency=transparency
fp.CanCollide=false
fp.Locked=true
fp.BrickColor=brickcolor
fp.Name=name
fp.Size=size
fp.Position=Torso.Position
NoOutline(fp)
fp.Material="Neon"
fp:BreakJoints()
return fp
end
function mesh(Mesh,part,meshtype,meshid,offset,scale)
local mesh=it(Mesh)
mesh.Parent=part
if Mesh=="SpecialMesh" then
mesh.MeshType=meshtype
mesh.MeshId=meshid
end
mesh.Offset=offset
mesh.Scale=scale
return mesh
end
function weld(parent,part0,part1,c0)
local weld=it("Weld")
weld.Parent=parent
weld.Part0=part0
weld.Part1=part1
weld.C0=c0
return weld
end
local fengui=it("GuiMain")
fengui.Parent=Player.PlayerGui
fengui.Name="WeaponGUI"
local Color1=BrickColor.new("White")
local Color2=BrickColor.new("Dark stone grey")
local Colorr3=BrickColor.new("Black")
local Color4=BrickColor.new("Medium stone grey")
local suit = Instance.new("Model")
suit.Parent = Character
suit.Name = "Suit"
--[[local c=Character:children()
for i=1,#c do
if c[i].className=="Hat" then
c[i].Parent=nil
end
end ]]
--[[HOOD]]--
--[[local Hprt1=part(3,suit,0,0,BrickColor.new("Really black"),"Hood",vt(1,1,1))
Hmsh1=mesh("SpecialMesh",Hprt1,"FileMesh","http://www.roblox.com/asset/?id=101203373",vt(0,0,0),vt(1,1,1))
--Hmsh1.TextureId="http://www.roblox.com/asset/?id=101203430"
local Hwld1=weld(Hprt1,Hprt1,Head,euler(0,0,0)*cf(0,-0.2,0)) ]]
--[[TORSO]]--
numb=0.525
for i=1,2 do
local Tprt1=part(3,suit,0,0,BrickColor.new("Black"),"Torso Part1",vt(1,1,1))
Tmsh1=mesh("BlockMesh",Tprt1,"","",vt(0,0,0),vt(2.01,2.01,1.01))
local Twld1=weld(Tprt1,Tprt1,Torso,euler(0,0,0)*cf(0,0,0))
local Tprt2=part(3,suit,0,0,BrickColor.new("Black"),"Torso Part2",vt(1,1,1))
Tmsh2=mesh("BlockMesh",Tprt2,"","",vt(0,0,0),vt(0.95,2,0.1))
local Twld2=weld(Tprt2,Tprt2,Torso,euler(0,0,0)*cf(numb,0,0.5))
numb2=-0.4
for i=1,9 do
local Tprt3=part(3,suit,0,0,BrickColor.new("White"),"Torso Part3",vt(1,1,1))
Tmsh3=mesh("BlockMesh",Tprt3,"","",vt(0,0,0),vt(0.05,2,0.11))
local Twld3=weld(Tprt3,Tprt3,Tprt2,euler(0,0,0)*cf(numb2,0,0))
numb2=numb2+0.1
end
numb=numb-1.05
end
local Tprt4=part(3,suit,0,0,BrickColor.new("Really black"),"Torso Part4",vt(1,1,1))
Tmsh4=mesh("BlockMesh",Tprt4,"","",vt(0,0,0),vt(0.1,2,0.1))
local Twld4=weld(Tprt4,Tprt4,Torso,euler(0,0,0)*cf(0,0,0.5))
local Tprt5=part(3,suit,0,0,BrickColor.new("Really black"),"Torso Part5",vt(1,1,1))
Tmsh5=mesh("BlockMesh",Tprt5,"","",vt(0,0,0),vt(0.61,2.02,0.1))
local Twld5=weld(Tprt5,Tprt5,Torso,euler(0,0,0)*cf(0.7,0,0.55))
local Tprt6=part(3,suit,0,0,BrickColor.new("Really black"),"Torso Part6",vt(1,1,1))
Tmsh6=mesh("BlockMesh",Tprt6,"","",vt(0,0,0),vt(1.19,2.02,0.1))
local Twld6=weld(Tprt6,Tprt6,Torso,euler(0,1.57,0)*cf(1,0,0))
local Tprt7=part(3,suit,0,0,BrickColor.new("Really black"),"Torso Part7",vt(1,1,1))
Tmsh7=mesh("BlockMesh",Tprt7,"","",vt(0,0,0),vt(0.61,2.02,0.1))
local Twld7=weld(Tprt7,Tprt7,Torso,euler(0,0,0)*cf(-0.7,0,0.55))
local Tprt8=part(3,suit,0,0,BrickColor.new("Really black"),"Torso Part8",vt(1,1,1))
Tmsh8=mesh("BlockMesh",Tprt8,"","",vt(0,0,0),vt(1.19,2.02,0.1))
local Twld8=weld(Tprt8,Tprt8,Torso,euler(0,1.57,0)*cf(-1,0,0))
local Tprt9=part(3,suit,0,0,BrickColor.new("Really black"),"Torso Part9",vt(1,1,1))
Tmsh9=mesh("BlockMesh",Tprt9,"","",vt(0,0,0),vt(2,2.02,0.1))
local Twld9=weld(Tprt9,Tprt9,Torso,euler(0,0,0)*cf(0,0,-0.55))
local Tprt10=part(3,suit,0,0,BrickColor.new("White"),"Torso Part10",vt(1,1,1))
Tmsh10=mesh("BlockMesh",Tprt10,"","",vt(0,0,0),vt(0.2,0.8,0.1))
local Twld10=weld(Tprt10,Tprt10,Tprt7,euler(0,0,0)*cf(0.2,0.2,0.01))
numb=0.3
for i=1,4 do
local Tprt11=part(3,suit,0,0,BrickColor.new("Black"),"Torso Part11",vt(1,1,1))
Tmsh11=mesh("CylinderMesh",Tprt11,"","",vt(0,0,0),vt(0.15,0.1,0.15))
local Twld11=weld(Tprt11,Tprt11,Tprt10,euler(1.57,0,0)*cf(0,numb,0.05))
numb=numb-0.2
end
local Tprt12=part(3,suit,0,0,BrickColor.new("White"),"Torso Part12",vt(1,1,1))
Tmsh12=mesh("BlockMesh",Tprt12,"","",vt(0,0,0),vt(0.2,0.8,0.1))
local Twld12=weld(Tprt12,Tprt12,Tprt5,euler(0,0,0)*cf(-0.2,0.2,0.01))
numb=0.3
for i=1,4 do
local Tprt13=part(3,suit,0,0,BrickColor.new("Black"),"Torso Part13",vt(1,1,1))
Tmsh13=mesh("BlockMesh",Tprt13,"","",vt(0,0,0),vt(0.15,0.01,0.05))
local Twld13=weld(Tprt13,Tprt13,Tprt12,euler(1.57,0,0)*cf(0,numb,0.05))
numb=numb-0.2
end
local Tprt14=part(3,suit,0,0,BrickColor.new("White"),"Torso Part14",vt(1,1,1))
Tmsh14=mesh("BlockMesh",Tprt14,"","",vt(0,0,0),vt(0.2,0.4,0.1))
local Twld14=weld(Tprt14,Tprt14,Tprt7,euler(0,0,0)*cf(0.2,-0.8,0.01))
local Tprt15=part(3,suit,0,0,BrickColor.new("White"),"Torso Part15",vt(1,1,1))
Tmsh15=mesh("BlockMesh",Tprt15,"","",vt(0,0,0),vt(0.2,0.4,0.1))
local Twld15=weld(Tprt15,Tprt15,Tprt5,euler(0,0,0)*cf(-0.2,-0.8,0.01))
local Tprt16=part(3,suit,0,0,BrickColor.new("White"),"Torso Part16",vt(1,1,1))
Tmsh16=mesh("BlockMesh",Tprt16,"","",vt(0,0,0),vt(0.05,2,0.1))
local Twld16=weld(Tprt16,Tprt16,Tprt7,euler(0,0,0)*cf(0,0,0.01))
local Tprt17=part(3,suit,0,0,BrickColor.new("White"),"Torso Part17",vt(1,1,1))
Tmsh17=mesh("BlockMesh",Tprt17,"","",vt(0,0,0),vt(0.05,2,0.1))
local Twld17=weld(Tprt17,Tprt17,Tprt5,euler(0,0,0)*cf(0,0,0.01))
local Tprt18=part(3,suit,0,0,BrickColor.new("White"),"Torso Part18",vt(1,1,1))
Tmsh18=mesh("BlockMesh",Tprt18,"","",vt(0,0,0),vt(0.62,0.2,0.11))
local Twld18=weld(Tprt18,Tprt18,Tprt7,euler(0,0,0)*cf(0,0.911,0))
local Tprt19=part(3,suit,0,0,BrickColor.new("White"),"Torso Part19",vt(1,1,1))
Tmsh19=mesh("BlockMesh",Tprt19,"","",vt(0,0,0),vt(0.62,0.2,0.11))
local Twld19=weld(Tprt19,Tprt19,Tprt5,euler(0,0,0)*cf(0,0.911,0))
local Tprt20=part(3,suit,0,0,BrickColor.new("White"),"Torso Part20",vt(1,1,1))
Tmsh20=mesh("BlockMesh",Tprt20,"","",vt(0,0,0),vt(1.20,0.2,0.11))
local Twld20=weld(Tprt20,Tprt20,Tprt8,euler(0,0,0)*cf(0,0.911,0))
local Tprt21=part(3,suit,0,0,BrickColor.new("White"),"Torso Part21",vt(1,1,1))
Tmsh21=mesh("BlockMesh",Tprt21,"","",vt(0,0,0),vt(1.20,0.2,0.11))
local Twld21=weld(Tprt21,Tprt21,Tprt6,euler(0,0,0)*cf(0,0.911,0))
local Tprt22=part(3,suit,0,0,BrickColor.new("White"),"Torso Part22",vt(1,1,1))
Tmsh22=mesh("BlockMesh",Tprt22,"","",vt(0,0,0),vt(2.01,0.2,0.11))
local Twld22=weld(Tprt22,Tprt22,Tprt9,euler(0,0,0)*cf(0,0.911,0))
local Tprt23=part(3,suit,0,0,BrickColor.new("White"),"Torso Part23",vt(1,1,1))
Tmsh23=mesh("BlockMesh",Tprt23,"","",vt(0,0,0),vt(0.4,2.01,0.11))
local Twld23=weld(Tprt23,Tprt23,Tprt9,euler(0,0,0)*cf(0,0,0))
local Tprt24=part(3,suit,0,0,BrickColor.new("Black"),"Torso Part24",vt(1,1,1))
Tmsh24=mesh("BlockMesh",Tprt24,"","",vt(0,0,0),vt(0.2,2.01,0.105))
local Twld24=weld(Tprt24,Tprt24,Tprt9,euler(0,0,0)*cf(0.2,0,0))
local Tprt25=part(3,suit,0,0,BrickColor.new("Black"),"Torso Part25",vt(1,1,1))
Tmsh25=mesh("BlockMesh",Tprt25,"","",vt(0,0,0),vt(0.2,2.01,0.105))
local Twld25=weld(Tprt25,Tprt25,Tprt9,euler(0,0,0)*cf(-0.2,0,0))
--[[LEFT ARM]]--
local LAprt1=part(3,suit,0,0,BrickColor.new("Really black"),"Left Arm Part1",vt(1,1,1))
LAmsh1=mesh("BlockMesh",LAprt1,"","",vt(0,0,0),vt(1.01,2.01,1.01))
local LAwld1=weld(LAprt1,LAprt1,LeftArm,euler(0,0,0)*cf(0,0,0))
local LAprt2=part(3,suit,0,0,BrickColor.new("White"),"Left Arm Part2",vt(1,1,1))
LAmsh2=mesh("BlockMesh",LAprt2,"","",vt(0,0,0),vt(1.02,2.01,0.2))
local LAwld2=weld(LAprt2,LAprt2,LAprt1,euler(0,0,0)*cf(0,-0.01,0))
local LAprt3=part(3,suit,0,0,BrickColor.new("Really black"),"Left Arm Part3",vt(1,1,1))
LAmsh3=mesh("BlockMesh",LAprt3,"","",vt(0,0,0),vt(1.02,2.01,0.1))
local LAwld3=weld(LAprt3,LAprt3,LAprt1,euler(0,0,0)*cf(0,-0.01,0.2))
local LAprt4=part(3,suit,0,0,BrickColor.new("Really black"),"Left Arm Part4",vt(1,1,1))
LAmsh4=mesh("BlockMesh",LAprt4,"","",vt(0,0,0),vt(1.02,2.01,0.1))
local LAwld4=weld(LAprt4,LAprt4,LAprt1,euler(0,0,0)*cf(0,-0.01,-0.2))
local LAprt5=part(3,suit,0,0,BrickColor.new("Really black"),"Left Arm Part5",vt(1,1,1))
LAmsh5=mesh("BlockMesh",LAprt5,"","",vt(0,0,0),vt(1.025,0.2,1.025))
local LAwld5=weld(LAprt5,LAprt5,LAprt1,euler(0,0,0)*cf(0,0.9,0))
--[[RIGHT ARM]]--
local RAprt1=part(3,suit,0,0,BrickColor.new("Really black"),"Right Arm Part1",vt(1,1,1))
RAmsh1=mesh("BlockMesh",RAprt1,"","",vt(0,0,0),vt(1.01,2.01,1.01))
local RAwld1=weld(RAprt1,RAprt1,RightArm,euler(0,0,0)*cf(0,0,0))
local RAprt2=part(3,suit,0,0,BrickColor.new("White"),"Right Arm Part2",vt(1,1,1))
RAmsh2=mesh("BlockMesh",RAprt2,"","",vt(0,0,0),vt(1.02,2.01,0.2))
local RAwld2=weld(RAprt2,RAprt2,RAprt1,euler(0,0,0)*cf(0,-0.01,0))
local RAprt3=part(3,suit,0,0,BrickColor.new("Really black"),"Right Arm Part3",vt(1,1,1))
RAmsh3=mesh("BlockMesh",RAprt3,"","",vt(0,0,0),vt(1.02,2.01,0.1))
local RAwld3=weld(RAprt3,RAprt3,RAprt1,euler(0,0,0)*cf(0,-0.01,0.2))
local RAprt4=part(3,suit,0,0,BrickColor.new("Really black"),"Right Arm Part4",vt(1,1,1))
RAmsh4=mesh("BlockMesh",RAprt4,"","",vt(0,0,0),vt(1.02,2.01,0.1))
local RAwld4=weld(RAprt4,RAprt4,RAprt1,euler(0,0,0)*cf(0,-0.01,-0.2))
local RAprt5=part(3,suit,0,0,BrickColor.new("Really black"),"Right Arm Part5",vt(1,1,1))
RAmsh5=mesh("BlockMesh",RAprt5,"","",vt(0,0,0),vt(1.025,0.2,1.025))
local RAwld5=weld(RAprt5,RAprt5,RAprt1,euler(0,0,0)*cf(0,0.9,0))
--[[LEFT LEG]]--
local LLprt1=part(3,suit,0,0,BrickColor.new("Really black"),"Left Leg Part1",vt(1,1,1))
LLmsh1=mesh("BlockMesh",LLprt1,"","",vt(0,0,0),vt(1.01,2.01,1.01))
local LLwld1=weld(LLprt1,LLprt1,LeftLeg,euler(0,0,0)*cf(0,0,0))
local LLprt2=part(3,suit,0,0,BrickColor.new("White"),"Left Leg Part2",vt(1,1,1))
LLmsh2=mesh("BlockMesh",LLprt2,"","",vt(0,0,0),vt(1.02,0.2,1.02))
local LLwld2=weld(LLprt2,LLprt2,LLprt1,euler(0,0,0)*cf(0,-0.6,0))
local LLprt3=part(3,suit,0,0,BrickColor.new("Really black"),"Left Leg Part3",vt(1,1,1))
LLmsh3=mesh("BlockMesh",LLprt3,"","",vt(0,0,0),vt(1.02,0.1,1.02))
local LLwld3=weld(LLprt3,LLprt3,LLprt1,euler(0,0,0)*cf(0,-0.75,0))
local LLprt4=part(3,suit,0,0,BrickColor.new("Really black"),"Left Leg Part4",vt(1,1,1))
LLmsh4=mesh("BlockMesh",LLprt4,"","",vt(0,0,0),vt(1.02,0.1,1.02))
local LLwld4=weld(LLprt4,LLprt4,LLprt1,euler(0,0,0)*cf(0,-0.45,0))
local LLprt5=part(3,suit,0,0,BrickColor.new("White"),"Left Leg Part5",vt(1,1,1))
LLmsh5=mesh("BlockMesh",LLprt5,"","",vt(0,0,0),vt(1.02,0.4,1.02))
local LLwld5=weld(LLprt5,LLprt5,LLprt1,euler(0,0,0)*cf(0,0.8,0))
--[[RIGHT LEG]]--
local RLprt1=part(3,suit,0,0,BrickColor.new("Really black"),"Right Leg Part1",vt(1,1,1))
RLmsh1=mesh("BlockMesh",RLprt1,"","",vt(0,0,0),vt(1.01,2.01,1.01))
local RLwld1=weld(RLprt1,RLprt1,RightLeg,euler(0,0,0)*cf(0,0,0))
local RLprt2=part(3,suit,0,0,BrickColor.new("White"),"Right Leg Part2",vt(1,1,1))
RLmsh2=mesh("BlockMesh",RLprt2,"","",vt(0,0,0),vt(1.02,0.2,1.02))
local RLwld2=weld(RLprt2,RLprt2,RLprt1,euler(0,0,0)*cf(0,-0.6,0))
local RLprt3=part(3,suit,0,0,BrickColor.new("Really black"),"Right Leg Part3",vt(1,1,1))
RLmsh3=mesh("BlockMesh",RLprt3,"","",vt(0,0,0),vt(1.02,0.1,1.02))
local RLwld3=weld(RLprt3,RLprt3,RLprt1,euler(0,0,0)*cf(0,-0.75,0))
local RLprt4=part(3,suit,0,0,BrickColor.new("Really black"),"Right Leg Part4",vt(1,1,1))
RLmsh4=mesh("BlockMesh",RLprt4,"","",vt(0,0,0),vt(1.02,0.1,1.02))
local RLwld4=weld(RLprt4,RLprt4,RLprt1,euler(0,0,0)*cf(0,-0.45,0))
local RLprt5=part(3,suit,0,0,BrickColor.new("White"),"Right Leg Part5",vt(1,1,1))
RLmsh5=mesh("BlockMesh",RLprt5,"","",vt(0,0,0),vt(1.02,0.4,1.02))
local RLwld5=weld(RLprt5,RLprt5,RLprt1,euler(0,0,0)*cf(0,0.8,0))
local model1=Instance.new("Model")
model1.Parent=Character
model1.Name="Binary Sword"
BSword={}
BSwordWelds={}
local model2=Instance.new("Model")
model2.Parent=nil
model2.Name="Demon Blade"
DBlade={}
DBladeWelds={}
prt1=part(3,model1,0,1,Color1,"Part1",vt())
prt2=part(3,model1,0,0,Color2,"Part2",vt())
prt3=part(3,model1,0,0,Color2,"Part3",vt())
prt4=part(3,model1,0,0,Colorr3,"Part4",vt())
prt5=part(3,model1,0,0,Colorr3,"Part5",vt())
prt6=part(3,model1,0.7,0,Color4,"Part6",vt())
prt7=part(3,model1,0.7,0,Color4,"Part7",vt())
prt8=part(3,model1,0.7,0,Color4,"Part8",vt())
prt9=part(3,model1,0.7,0,Color4,"Part9",vt())
prt10=part(3,model1,0,0,Colorr3,"Part10",vt())
prt11=part(3,model1,0,0,Colorr3,"Part11",vt())
prt12=part(3,model1,0,0,Colorr3,"Part12",vt())
prtd1=part(3,model2,0,0.4,BrickColor.new("Black"),"DPart1",vt())
--prtd1=part(3,model2,0,0.4,BrickColor.new("Bright red"),"DPart1",vt())
prtd2=part(3,model2,0,0,BrickColor.new("Dark stone grey"),"DPart2",vt())
prtd3=part(3,model2,0,0,BrickColor.new("Dark stone grey"),"DPart3",vt())
prtd4=part(3,model2,0,0,BrickColor.new("Dark stone grey"),"DPart4",vt())
prtd5=part(3,model2,0,0,BrickColor.new("Dark stone grey"),"DPart5",vt())
prtd6=part(3,model2,0,0,BrickColor.new("Dark stone grey"),"DPart6",vt())
prtd7=part(3,model2,0.8,0,BrickColor.new("Medium stone grey"),"DPart7",vt())
prtd8=part(3,model2,0.8,0,BrickColor.new("Medium stone grey"),"DPart8",vt())
--[[prtd9=part(3,model2,0.5,0.2,BrickColor.new("Really red"),"DPart9",vt())
prtd10=part(3,model2,0.5,0.2,BrickColor.new("Really red"),"DPart10",vt())
prtd11=part(3,model2,0.5,0,BrickColor.new("Really red"),"DPart11",vt()) ]]
prtd9=part(3,model2,0.5,0.2,BrickColor.new("White"),"DPart9",vt())
prtd10=part(3,model2,0.5,0.2,BrickColor.new("White"),"DPart10",vt())
prtd11=part(3,model2,0.5,0,BrickColor.new("White"),"DPart11",vt())
prtd12=part(3,model2,0,0,BrickColor.new("Dark stone grey"),"DPart12",vt())
for _,c in pairs(model2:children()) do
if c.className=="Part" then
table.insert(DBlade,c)
end
end
light=it("PointLight")
light.Brightness=.8
light.Color=Color3.new(255/255,50/255,0)
--light.Color=BrickColor.new("Really red")
light.Range=10
light.Parent=prtd9
msh1=mesh("BlockMesh",prt1,"","",vt(0,0,0),vt(1,1,1))
msh2=mesh("CylinderMesh",prt2,"","",vt(0,0,0),vt(2,10,2))
msh3=mesh("SpecialMesh",prt3,"Head","",vt(0,0,0),vt(2.5,2,2.5))
msh4=mesh("SpecialMesh",prt4,"Sphere","",vt(0,0,0),vt(3,3,3))
msh5=mesh("SpecialMesh",prt5,"FileMesh","http://www.roblox.com/asset/?id=9756362",vt(0,0,0),vt(0.5,0.5,1))
msh6=mesh("BlockMesh",prt6,"","",vt(0,0,0),vt(.5,20,1))
msh7=mesh("BlockMesh",prt7,"","",vt(0,0,0),vt(.5,20,1))
msh8=mesh("SpecialMesh",prt8,"Wedge","",vt(0,0,0),vt(.5,5,1))
msh9=mesh("SpecialMesh",prt9,"Wedge","",vt(0,0,0),vt(.5,5,1))
msh10=mesh("BlockMesh",prt10,"","",vt(0,0,0),vt(.6,20,0.2))
msh11=mesh("SpecialMesh",prt11,"Wedge","",vt(0,0,0),vt(.6,5,0.1))
msh12=mesh("SpecialMesh",prt12,"Wedge","",vt(0,0,0),vt(.6,5,0.1))
mshd1=mesh("BlockMesh",prtd1,"","",vt(0,0,0),vt(5.01,3,5.01))
mshd2=mesh("BlockMesh",prtd2,"","",vt(0,0,0),vt(5.1,3,5.1))
mshd3=mesh("SpecialMesh",prtd3,"Wedge","",vt(0,0,0),vt(5.05,4,3))
mshd4=mesh("SpecialMesh",prtd4,"Wedge","",vt(0,0,0),vt(5.05,4,3))
mshd5=mesh("SpecialMesh",prtd5,"Wedge","",vt(0,0,0),vt(5.5,6,6))
mshd6=mesh("SpecialMesh",prtd6,"Wedge","",vt(0,0,0),vt(5.5,6,6))
mshd7=mesh("BlockMesh",prtd7,"","",vt(0,0,0),vt(3,20,1))
mshd8=mesh("SpecialMesh",prtd8,"Wedge","",vt(0,0,0),vt(1,3,5))
mshd9=mesh("BlockMesh",prtd9,"","",vt(0,0,0),vt(4.5,20,.1))
mshd10=mesh("SpecialMesh",prtd10,"Wedge","",vt(0,0,0),vt(.1,4.5,8))
mshd11=mesh("CylinderMesh",prtd11,"","",vt(0,0,0),vt(4,5.8,4))
mshd12=mesh("CylinderMesh",prtd12,"","",vt(0,0,0),vt(3,5.9,3))
wld1=weld(prt1,prt1,Torso,euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5))
wld2=weld(prt2,prt2,prt1,euler(0,0,0)*cf(0,0,0))
wld3=weld(prt3,prt3,prt2,euler(0,0,0)*cf(0,1,0))
wld4=weld(prt4,prt4,prt2,euler(0,0,0)*cf(0,-1,0))
wld5=weld(prt5,prt5,prt4,euler(0,0,0)*cf(0,-0.2,0))
wld6=weld(prt6,prt6,prt5,euler(0,0,0)*cf(0,-2,0.1))
wld7=weld(prt7,prt7,prt5,euler(0,0,0)*cf(0,-2,-0.1))
wld8=weld(prt8,prt8,prt6,euler(0,0,0)*cf(0,-2.5,0))
wld9=weld(prt9,prt9,prt7,euler(0,3.14,0)*cf(0,-2.5,0))
wld10=weld(prt10,prt10,prt5,euler(0,0,0)*cf(0,-2,0))
wld11=weld(prt11,prt11,prt10,euler(0,0,0)*cf(0,-2.5,0.01))
wld12=weld(prt12,prt12,prt10,euler(0,3.14,0)*cf(0,-2.5,-0.01))
wldd1=weld(prtd1,prtd1,RightArm,euler(0,0,0)*cf(0,.21,0))
wldd2=weld(prtd1,prtd2,prtd1,euler(0,0,0)*cf(0,.5,0))
wldd3=weld(prtd1,prtd3,prtd2,euler(0,1.57,0)*cf(.21,-.6,0))
wldd4=weld(prtd1,prtd4,prtd2,euler(0,-1.57,0)*cf(-.21,-.6,0))
wldd5=weld(prtd1,prtd5,prtd2,euler(0,-1.57,0)*cf(.1,-.1,0))
wldd6=weld(prtd1,prtd6,prtd5,euler(0,0,3.14)*cf(0,1.2,0))
wldd7=weld(prtd1,prtd7,prtd2,euler(0,0,0)*cf(0,2.5,0))
wldd8=weld(prtd1,prtd8,prtd7,euler(1.57,1.57,0)*cf(0,2.5,0))
wldd9=weld(prtd1,prtd9,prtd7,euler(0,0,0)*cf(0,0,0))
wldd10=weld(prtd1,prtd10,prtd8,euler(0,0,0)*cf(0,0,0.3))
wldd11=weld(prtd1,prtd11,prtd1,euler(1.57,0,0)*cf(0,1,0))
wldd12=weld(prtd1,prtd12,prtd11,euler(0,0,0)*cf(0,0,0))
for _,c in pairs(prtd1:children()) do
if c.className=="Weld" then
table.insert(DBladeWelds,c)
print(c)
end
end
for i=-.9,.9,0.2 do
prt13=part(3,model1,0,0,Color1,"Part13",vt())
msh13=mesh("CylinderMesh",prt13,"","",vt(0,0,0),vt(2.2,1,2.2))
wld13=weld(prt13,prt13,prt1,euler(math.random(-10,10)/100,math.random(-10,10)/100,math.random(-10,10)/100)*cf(0,i,0))
end
function Make1(Ceef)
prtnr=part(3,model1,0,1,Color1,"1a",vt())
mshnr=mesh("BlockMesh",prtnr,"","",vt(0,0,0),vt(.7,.7,.7))
wldnr=weld(prtnr,prtnr,prt10,euler(0,0,0)*cf(0,Ceef,0))
prtn1=part(3,model1,0,0,Colorr3,"1a",vt())
mshn1=mesh("BlockMesh",prtn1,"","",vt(0,0,0),vt(.7,.2,1.5))
wldn1=weld(prtn1,prtn1,prtnr,euler(0,0,0)*cf(0,0,0))
prtn2=part(3,model1,0,0,Colorr3,"1b",vt())
mshn2=mesh("BlockMesh",prtn2,"","",vt(0,0,0),vt(.7,.2,.5))
wldn2=weld(prtn2,prtn2,prtn1,euler(0.5,0,0)*cf(0,0.03,-0.1))
prtn3=part(3,model1,0,0,Colorr3,"1c",vt())
mshn3=mesh("BlockMesh",prtn3,"","",vt(0,0,0),vt(.7,.2,.5))
wldn3=weld(prtn3,prtn3,prtn1,euler(1.57,0,0)*cf(0,0,0.15))
end
function Make0(Ceef)
prtnr=part(3,model1,0,1,Color1,"1a",vt())
mshnr=mesh("BlockMesh",prtnr,"","",vt(0,0,0),vt(.7,.7,.7))
wldnr=weld(prtnr,prtnr,prt10,euler(0,0,0)*cf(0,Ceef,0))
prtn1=part(3,model1,0,0,Colorr3,"0a",vt())
mshn1=mesh("BlockMesh",prtn1,"","",vt(0,0,0),vt(.7,.2,1.5))
wldn1=weld(prtn1,prtn1,prtnr,euler(0,0,0)*cf(0,-0.05,0))
prtn2=part(3,model1,0,0,Colorr3,"0b",vt())
mshn2=mesh("BlockMesh",prtn2,"","",vt(0,0,0),vt(.7,.2,.5))
wldn2=weld(prtn2,prtn2,prtn1,euler(1.57,0,0)*cf(0,0.05,0.15))
prtn3=part(3,model1,0,0,Colorr3,"0c",vt())
mshn3=mesh("BlockMesh",prtn3,"","",vt(0,0,0),vt(.7,.2,.5))
wldn3=weld(prtn3,prtn3,prtn1,euler(1.57,0,0)*cf(0,0.05,-0.15))
prtn4=part(3,model1,0,0,Colorr3,"0d",vt())
mshn4=mesh("BlockMesh",prtn4,"","",vt(0,0,0),vt(.7,.2,1.5))
wldn4=weld(prtn4,prtn4,prtn1,euler(0,0,0)*cf(0,0.1,0))
end
Make1(1.6)
Make0(1.4)
Make0(1.2)
Make1(1)
Make1(.8)
Make1(.6)
Make1(.4)
Make0(.2)
Make0(0)
local hitbox1=part(3,nil,0,1,BrickColor.new("Black"),"Hitbox",vt(1,1,1))
local hitbox2=part(3,nil,0,1,BrickColor.new("Black"),"Hitbox",vt(1,1,1))
local Tool=nil
if (script.Parent.className~="HopperBin") then
Tool=Instance.new("HopperBin")
Tool.Parent=Backpack
Tool.Name="Binary Sword"
script.Parent=Tool
end
Bin=script.Parent
--Bin=Tool
local bodvel=Instance.new("BodyVelocity")
bodvel.Name="FixerVel"
local bg=Instance.new("BodyGyro")
bg.Name="FixerGyro"
so = function(id,par,vol,pit)
coroutine.resume(coroutine.create(function()
local sou = Instance.new("Sound",par or workspace)
sou.Parent=par
sou.Volume=vol
sou.Pitch=pit or 1
sou.SoundId=id
swait()
sou:Play()
game:GetService("Debris"):AddItem(sou,6)
end))
end
function clerp(a,b,t)
local qa = {QuaternionFromCFrame(a)}
local qb = {QuaternionFromCFrame(b)}
local ax, ay, az = a.x, a.y, a.z
local bx, by, bz = b.x, b.y, b.z
local _t = 1-t
return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
end
function QuaternionFromCFrame(cf)
local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
local trace = m00 + m11 + m22
if trace > 0 then
local s = math.sqrt(1 + trace)
local recip = 0.5/s
return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
else
local i = 0
if m11 > m00 then
i = 1
end
if m22 > (i == 0 and m00 or m11) then
i = 2
end
if i == 0 then
local s = math.sqrt(m00-m11-m22+1)
local recip = 0.5/s
return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
elseif i == 1 then
local s = math.sqrt(m11-m22-m00+1)
local recip = 0.5/s
return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
elseif i == 2 then
local s = math.sqrt(m22-m00-m11+1)
local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
end
end
end
function QuaternionToCFrame(px, py, pz, x, y, z, w)
local xs, ys, zs = x + x, y + y, z + z
local wx, wy, wz = w*xs, w*ys, w*zs
local xx = x*xs
local xy = x*ys
local xz = x*zs
local yy = y*ys
local yz = y*zs
local zz = z*zs
return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
end
function QuaternionSlerp(a, b, t)
local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
local startInterp, finishInterp;
if cosTheta >= 0.0001 then
if (1 - cosTheta) > 0.0001 then
local theta = math.acos(cosTheta)
local invSinTheta = 1/math.sin(theta)
startInterp = math.sin((1-t)*theta)*invSinTheta
finishInterp = math.sin(t*theta)*invSinTheta
else
startInterp = 1-t
finishInterp = t
end
else
if (1+cosTheta) > 0.0001 then
local theta = math.acos(-cosTheta)
local invSinTheta = 1/math.sin(theta)
startInterp = math.sin((t-1)*theta)*invSinTheta
finishInterp = math.sin(t*theta)*invSinTheta
else
startInterp = t-1
finishInterp = t
end
end
return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
end
function hideanim()
equipped=false
attack=true
if Mode=="Binary" then
so("rbxasset://sounds\\unsheath.wav",prt1,1,.8)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(.2,0,-.5)*cf(0,1,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.3)
end
wld1.Part1=Torso
wld1.C0=euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5)
for i=0,1,0.2 do
swait()
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(0.5,0,0),.3)
end
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
--wld1=weld(prt1,prt1,RightArm,euler(1.57,0,0)*cf(0,1,-0.3))
else
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.8),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.2,0)*euler(-.2,0,0),.3)
end
so("http://roblox.com/asset/?id=161006163",RightArm,1,.4)
so("http://roblox.com/asset/?id=160867463",RightArm,1,1.2)
for i=0,1,0.015 do
swait()
for i=1,3 do
if math.random(1,5)==1 then
MagicBlock(BrickColor.new("Dark stone grey"),RightArm.CFrame*cf(math.random(-100,100)/100,0-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
MagicBlock(BrickColor.new("Black"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
--MagicBlock(BrickColor.new("Bright red"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
end
Tool.Name="Binary Sword"
model2.Parent=nil
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
end
Torso.Neck.C0=necko
Torso.Neck.C1=necko2
RootJoint.C0=RootCF
RW.C0=cf(1.5,0.5,0)*euler(0,0,0)
RW.C1=cf(0,0.5,0)*euler(0,0,0)
LW.C0=cf(-1.5,0.5,0)*euler(0,0,0)
LW.C1=cf(0,0.5,0)*euler(0,0,0)
RH.C0=RHC0
RH.C1=RHC1
LH.C0=LHC0
LH.C1=LHC1
Mode="Binary"
attack=false
end
function equipanim()
equipped=true
attack=true
for i=0,1,0.2 do
swait()
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3,0,0),.4)
end
for i=0,1,0.1 do
swait()
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.5,0,-0.6),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
end
so("rbxasset://sounds\\unsheath.wav",prt1,1,.6)
wld1.Part1=RightArm
wld1.C0=euler(.2,0,-.5)*cf(0,1,0)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(.5,-0.5,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
end
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.5),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1,-0.5,-0.7),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1,-0.5,0.5),.3)
end
--wld1=weld(prt1,prt1,RightArm,euler(1.57,0,0)*cf(0,1,-0.3))
wld1.C0=euler(1.57,0,0)*cf(0,1,-0.3)
Torso.Neck.C0=necko*euler(0,0,0.5)
RootJoint.C0=RootCF*euler(0,0,-0.5)
RW.C0=cf(1,0.5,-0.5)*euler(1,-0.5,-0.7)
RW.C1=cf(0,0.5,0)*euler(0,0,0)
LW.C0=cf(-1,0.5,-0.5)*euler(1,-0.5,0.5)
LW.C1=cf(0,0.5,0)*euler(0,0,0)
attack=false
end
function Stomp()
Humanoid.WalkSpeed=0
Torso.Velocity=RootPart.CFrame.lookVector*0
so("http://roblox.com/asset/?id=157878578",Torso,1,0.8)
so("http://roblox.com/asset/?id=2760979",Torso,1,0.4)
--so("http://roblox.com/asset/?id=2101148",Torso,1,0.6)
MagicWave(BrickColor.new("Medium stone grey"),cf(Torso.Position)*cf(0,-1,0),1,1,1,1.5,1,1.5,0.05)
Dam=math.random(5,10)
Humanoid.Health=Humanoid.Health-Dam
showDamage(Torso,Dam,.5,BrickColor:Red())
MagniDamage(Torso,15,10,20,math.random(10,20),"Knockdown")
--[[for i=0,1,0.2 do
swait()
if Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.3)
end
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3,0,0.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-1.2),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1)*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1.1,-.5,-0.5)*euler(-0.2,-1.3,0),.3)
end
for i=0,1,0.1 do
swait()
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.6,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.2)*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.4,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1.2,-.2,-0.5)*euler(-0.3,-1.3,0),.3)
end]]
swait(10)
Humanoid.WalkSpeed=16
end
function attackone()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.2,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,1),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(2,-0.5,-0.2),.3)
LW.C0=clerp(LW.C0,cf(-.5,0.5,-0.5)*euler(2.5,-0.5,0.8),.3)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.3)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
--con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,10,20,math.random(1,5),"Normal",RootPart,.5,1) end)
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,10,20,math.random(1,5),"Normal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.7)
blcf=nil
scfr=nil
for i=0,1,0.25 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(1.8,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-.3),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.3),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,-.3,-.3),.3)
LW.C0=clerp(LW.C0,cf(-0.8,0.2,-0.5)*euler(.5,-0.5,1),.3)
end
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-.9),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.9),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,-.8,-.3),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.1,-0.5,.7),.3)
end
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function attacktwo()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-1.2),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,1.2),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,1.8,1.5),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.5,-0.5,.8),.3)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.3)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,10,20,math.random(1,5),"Normal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.8)
blcf=nil
scfr=nil
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2.2,0,0)*cf(0,.8,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,1),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.2,1.2,0)*euler(-1.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(.2,-.2,-1.4),.3)
end
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function attackthree()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,-.785)*cf(0,.8,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
RW.C0=clerp(RW.C0,cf(1,1,0)*euler(2.8,0,-.785),.3)
LW.C0=clerp(LW.C0,cf(-1,1,0)*euler(2.8,0,.785),.3)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.3)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,10,20,math.random(1,5),"Normal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.9)
blcf=nil
scfr=nil
for i=0,1,0.25 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(1.7,0,0)*cf(0,1,0),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,-.6),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.6),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.5,0,.2),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-.2),.4)
end
for i=0,1,0.2 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2,0,0)*cf(0,.7,-.3),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,-.8),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.8),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.2,-.4,.4),.4)
end
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function SpinSlash()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.3,0,0.8),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0.2,0,-0.8),.4)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(2.2,-1.2,0)*euler(0,0,1),.4)
LW.C0=clerp(LW.C0,cf(.1,0.5,-0.8)*euler(1.8,-0.5,1),.4)
--RH.C0=clerp(RH.C0,RHC0*cf(0,0,0)*euler(0.2,0.2,.5),.3)
--LH.C0=clerp(LH.C0,LHC0*cf(.5,0.2,0)*euler(0,.5,0.2),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,10,15,math.random(1,5),"Normal",RootPart,.2,1) end)
blcf=nil
scfr=nil
so("http://roblox.com/asset/?id=161006212",prt10,1,.6)
repeat
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
for i=0,1,0.15 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(1.2,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.3,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0,0,2.3),.25)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.57,-1.57,0)*euler(-0.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.57,-1.57,0)*euler(0.5,0,0),.3)
RH.C0=clerp(RH.C0,RHC0,.3)
LH.C0=clerp(LH.C0,LHC0,.3)
end
for i=0,1,0.05 do
swait()
if i>=0.45 and i<=0.5 then
so("http://roblox.com/asset/?id=161006212",prt10,1,.7)
end
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0,0,2.3+6*i),1)
end
until hold==false
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function BinarySwing()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.8),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1)*euler(0,0,-0.8),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,-2,0)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-.2,-.1,-0.5)*euler(1,-1.8,0)*euler(.9,0,0),.3)
RH.C0=clerp(RH.C0,RHC0*cf(.2,1,.1)*euler(0,-.5,-.2),.3)
LH.C0=clerp(LH.C0,LHC0*cf(-.2,1,.1)*euler(0,.5,.2),.3)
end
Humanoid.Jump=true
bodvol=Instance.new("BodyVelocity")
bodvol.Parent=RootPart
bodvol.velocity=vt(0,1,0)*100
bodvol.P=5000
bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
--Torso.Velocity=vt(0,1,0)*100
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(10,20),"Normal",RootPart,.2,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.8)
blcf=nil
scfr=nil
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(3,-2.4,0)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-.2,.8,-0.5)*euler(3.1,-1.8,0)*euler(.9,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.8),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*euler(0,0,1.3),.3)
RH.C0=clerp(RH.C0,RHC0,.3)
LH.C0=clerp(LH.C0,LHC0,.3)
end
con1:disconnect()
hitbox1.Parent=nil
bodvol.Parent=nil
attack=false
end
function BinaryImpulse()
attack=true
if impulse==1 then
impulse=2
Humanoid.Jump=true
for i=0,1,0.2 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0.5,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.45)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.7)*euler(1.5,-1.5,0)*euler(.7,0,0),.45)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.45)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.45)
end
blcf=nil
scfr=nil
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(10,20),"Normal",RootPart,.5,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=161006212",prt10,1,1)
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(-.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.3)
RootJoint.C0=RootCF*euler(0,0.5,6.6*i)
end
end
con1:disconnect()
hitbox1.Parent=nil
elseif impulse==2 then
impulse=3
Humanoid.Jump=true
for i=0,1,0.2 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,-0.5,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.45)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.7)*euler(1.5,-1.5,0)*euler(.7,0,0),.45)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.45)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.45)
end
blcf=nil
scfr=nil
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(10,20),"Normal",RootPart,.5,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=161006212",prt10,1,1.05)
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(-.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.3)
RootJoint.C0=RootCF*euler(0,-0.5,6.6*i)
end
end
con1:disconnect()
hitbox1.Parent=nil
elseif impulse==3 then
impulse=1
for i=0,1,0.2 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,-0.785)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.8,-0.5)*euler(3,0,-0.785),.45)
LW.C0=clerp(LW.C0,cf(-1,0.8,-0.5)*euler(3,0,0.785),.45)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.45)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.45)
end
Humanoid.Jump=true
blcf=nil
scfr=nil
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,25,35,math.random(20,30),"Normal",RootPart,.5,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=161006195",prt10,1,1)
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2,0,-0.785)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.3,-0.5)*euler(.5,0,-0.785),.3)
LW.C0=clerp(LW.C0,cf(-1,0.3,-0.5)*euler(.5,0,0.785),.3)
RootJoint.C0=RootCF*euler(6.28*i,0,0)
end
end
con1:disconnect()
hitbox1.Parent=nil
end
attack=false
end
function Bash()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.1,0,0)*cf(0,1,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1)*euler(0.5,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1.4),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.4,-1.4,0)*euler(-.6,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1,-1,0)*euler(.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,2.5,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1,0),.3)
end
Torso.Velocity=RootPart.CFrame.lookVector*200
so("http://roblox.com/asset/?id=2767090",Torso,1,.7)
MagicWave(Color4,RootPart.CFrame*euler(1.57,0,0),1,1,1,1,1,1,0.05)
hit=nil
for i=1,20 do
if hit==nil then
swait()
end
hit,pos=rayCast(RootPart.Position,RootPart.CFrame.lookVector,6,Character)
end
Torso.Velocity=RootPart.CFrame.lookVector*0
Humanoid.WalkSpeed=0
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.1,0,0)*cf(0,1,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1.4)*euler(-0.2,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1.4),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(3,-1.4,0)*euler(-.6,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(2.3,-1.4,0)*euler(.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
so("http://roblox.com/asset/?id=161006195",prt10,1,.5)
blcf=nil
scfr=nil
for i=0,1,0.2 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
wld1.C0=clerp(wld1.C0,euler(2.2,0,0)*cf(0,.8,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1.4)*euler(0.4,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.3)*euler(0,0,-1.4),.45)
RW.C0=clerp(RW.C0,cf(.5,0.2,-0.5)*euler(3,-1.4,0)*euler(-2.7,0,0),.45)
LW.C0=clerp(LW.C0,cf(-1.2,0.1,-0.3)*euler(0,-1.4,0)*euler(.5,0,0),.45)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.2,1.57,0),.45)
LH.C0=clerp(LH.C0,cf(-1.1,0.4,-0.8)*euler(-0.05,-1.57,0),.45)
end
hit,pos=rayCast(prt10.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,100,Character)
if hit~=nil then
local ref=part(3,workspace,0,1,BrickColor.new("Black"),"Effect",vt())
ref.Anchored=true
ref.CFrame=cf(pos)
game:GetService("Debris"):AddItem(ref,3)
for i=1,10 do
Col=hit.BrickColor
local groundpart=part(3,workspace,0,0,Col,"Ground",vt(math.random(50,200)/100,math.random(50,200)/100,math.random(50,200)/100))
groundpart.Anchored=true
groundpart.Material=hit.Material
groundpart.CanCollide=true
groundpart.CFrame=cf(pos)*cf(math.random(-500,500)/100,0,math.random(-500,500)/100)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
game:GetService("Debris"):AddItem(groundpart,5)
end
so("http://roblox.com/asset/?id=157878578",ref,.6,1.2)
MagicWave(hit.BrickColor,cf(pos),1,1,1,.7,.7,.7,0.05)
MagniDamage(ref,10,10,20,math.random(10,20),"Knockdown")
end
swait(50)
Humanoid.WalkSpeed=16
attack=false
end
function UnleashTheDemon()
attack=true
so("rbxasset://sounds\\unsheath.wav",prt1,1,.8)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(.2,0,-.5)*cf(0,1,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,RHC0,.4)
LH.C0=clerp(LH.C0,LHC0,.4)
end
wld1.Part1=Torso
wld1.C0=euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5)
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,-0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.3,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.4,-1.57,0)*euler(1.2,0,0),.3)
end
so("http://roblox.com/asset/?id=178452217",RightArm,.5,.4)
so("http://roblox.com/asset/?id=168586586",RightArm,.5,.6)
so("http://roblox.com/asset/?id=160740121",RightArm,1,.8)
num=0
for i=0,1,0.01 do
swait()
if num>=10 then
num=0
MagicWave(BrickColor.new("White"),cf(Torso.Position)*cf(0,-1,0)*euler(0,math.random(-50,50),0),1,1,1,1,.5,1,0.05)
--MagicWave(BrickColor.new("Really red"),cf(Torso.Position)*cf(0,-1,0)*euler(0,math.random(-50,50),0),1,1,1,1,.5,1,0.05)
end
for i=1,2 do
if math.random(1,5)==1 then
MagicBlock(BrickColor.new("Dark stone grey"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
--MagicBlock(BrickColor.new("Bright red"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
MagicBlock(BrickColor.new("Black"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
num=num+1
end
Tool.Name="Demon Blade"
so("http://roblox.com/asset/?id=168586621",RightArm,1,.5)
so("http://roblox.com/asset/?id=160867463",RightArm,1,.8)
for i=1,4 do
MagicBlock(BrickColor.new("Black"),RightArm.CFrame*cf(0,-.5-math.random(0,500)/100,0),2,2,2,.5,.5,.5,0.05)
--MagicBlock(BrickColor.new("Bright red"),RightArm.CFrame*cf(0,-.5-math.random(0,500)/100,0),2,2,2,.5,.5,.5,0.05)
end
MagicWave(BrickColor.new("White"),cf(Torso.Position)*cf(0,-1,0)*euler(0,math.random(-50,50),0),1,1,1,.5,.3,.5,0.01)
--MagicWave(BrickColor.new("Really red"),cf(Torso.Position)*cf(0,-1,0)*euler(0,math.random(-50,50),0),1,1,1,.5,.3,.5,0.01)
Mode="Demon"
model2.Parent=Character
for i=1,#DBlade do
DBlade[i].Parent=model2
DBladeWelds[i].Parent=DBlade[1]
end
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.2,-0.5,1),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1.4,0.5,-1.3),.3)
end
swait(50)
attack=false
end
function Demonattackone()
attack=true
--[[
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.2,0)*euler(-.2,0,0),.3)
]]
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,-1),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.7),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.3,0,.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-1,-.6)*euler(-.3,1.57,0)*euler(0,.5,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.3,0)*euler(0.5,-.8,0)*euler(-.5,0,0),.3)
end
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,10,15,math.random(1,5),"Lifesteal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=28144425",prtd7,1,.7)
blcf=nil
scfr=nil
for i=0,1,0.08 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox2.CFrame=prtd7.CFrame
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.2,0,1),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.7),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.4,-0.5,1)*euler(1.3,0,-1.7),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,0)*euler(-.3,1.57,0)*euler(0,-1,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,-0.3)*euler(-0.3,-2.3,0)*euler(0,0,0),.3)
end
con1:disconnect()
hitbox2.Parent=nil
attack=false
end
function Demonattacktwo()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.4)*euler(0.1,0,1.2),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.7),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.4,-1.2,.6)*euler(1.1,0,-1.7),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,0)*euler(-.1,1.57,0)*euler(0,-1,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,-0.3)*euler(-0.1,-2.3,0)*euler(0,0,0),.3)
end
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,10,15,math.random(1,5),"Lifesteal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=28144425",prtd7,1,.5)
blcf=nil
scfr=nil
for i=0,1,0.1 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox2.CFrame=prtd7.CFrame
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.4)*euler(0.1,0,-0.8),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.7),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-.8,.6)*euler(0.5,0,.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-.8,-0.3)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.6,-0.2)*euler(0.2,-1.2,0)*euler(-.2,0,0),.3)
end
con1:disconnect()
hitbox2.Parent=nil
attack=false
end
function Demonattackthree()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.1,0,-0.2),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(2.9,-1.8,0)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.3)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.7,0)*euler(0.2,-1.2,0)*euler(-.2,0,0),.3)
end
Humanoid.WalkSpeed=0
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,10,15,math.random(1,5),"Lifesteal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=28144425",prtd7,1,.6)
blcf=nil
scfr=nil
for i=0,1,0.15 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.8)*euler(0.5,0,0.6),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-0.6),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.55,-1.5,0)*euler(.3,0,0),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.4)
RH.C0=clerp(RH.C0,cf(1,-.1,-.4)*euler(0.4,1.57,0)*euler(-.2,0,0),.4)
LH.C0=clerp(LH.C0,cf(-1,-.9,0)*euler(-0.2,-1.2,0)*euler(-.2,0,0),.4)
if i==0.6 then
hit,pos=rayCast(prtd8.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
if hit~=nil then
local ref=part(3,workspace,0,1,BrickColor.new("Black"),"Effect",vt())
ref.Anchored=true
ref.CFrame=cf(pos)
game:GetService("Debris"):AddItem(ref,3)
for i=1,5 do
Col=hit.BrickColor
local groundpart=part(3,workspace,0,0,Col,"Ground",vt(math.random(50,200)/100,math.random(50,200)/100,math.random(50,200)/100))
groundpart.Anchored=true
groundpart.Material=hit.Material
groundpart.CanCollide=true
groundpart.CFrame=cf(pos)*cf(math.random(-200,200)/100,0,math.random(-200,200)/100)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
game:GetService("Debris"):AddItem(groundpart,3)
end
so("http://roblox.com/asset/?id=157878578",ref,.6,1.5)
MagicWave(hit.BrickColor,cf(pos),1,1,1,.7,.7,.7,0.05)
MagniDamage(ref,8,10,15,math.random(10,20),"Normal")
end
end
end
con1:disconnect()
hitbox2.Parent=nil
swait(10)
Humanoid.WalkSpeed=16
attack=false
end
function AgonizingBonds()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*euler(0,0,0.6),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.6)*euler(.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,2)*euler(-.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.57,-1.57,0)*euler(.6,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.2)*euler(0,0,-1.57),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1.57)*euler(.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,.5)*euler(-.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1.57,-1.57,0)*euler(-1.57,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.8,0)*euler(-0.2,1.57,0)*euler(-.3,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.8,0)*euler(0.2,-1.57,0)*euler(-.3,0,0),.3)
end
Humanoid.WalkSpeed=0
local num=100
local ceef=LeftArm.Position
local look=MMouse.Hit.p
local MouseLook=cf((ceef+look)/2,look)
local hit=nil
local Parts={}
local deb=0
repeat
cost=Humanoid.MaxHealth*.001
Humanoid:TakeDamage(cost)
hit,pos=rayCast(ceef,MouseLook.lookVector,2,Character)
if hit~=nil then
num=1
end
local ref=part(3,workspace,0,1,BrickColor.new("White"),"Effect",vt())
--local ref=part(3,workspace,0,1,BrickColor.new("Really red"),"Effect",vt())
local mag=(ceef-pos).magnitude
ceef=ceef+(MouseLook.lookVector*2.1)
local rmsh=mesh("BlockMesh",ref,"","",vt(0,0,0),vt(1,mag*5,1))
ref.Anchored=true
ref.CFrame=CFrame.new((ceef+pos)/2,pos)*angles(1.57,0,0)
--local ref2=part(3,ref,0,0,BrickColor.new("Really red"),"Effect",vt())
local ref2=part(3,ref,0,0,BrickColor.new("White"),"Effect",vt())
local rmsh2=mesh("SpecialMesh",ref2,"FileMesh","http://www.roblox.com/asset/?id=3270017",vt(0,0,0),vt(.6,mag*1.5,.6))
ref2.Anchored=true
ref2.CFrame=ref.CFrame*euler(0,math.random(-50,50),0)
table.insert(Parts,ref)
game:GetService("Debris"):AddItem(ref,5)
num=num-1
deb=deb+1
if deb>=2 then
swait()
deb=0
end
until num<=0
if hit~=nil then
local anch=false
if hit~=nil or hit.Parent~=nil or hit.Parent.Parent~=nil then
if hit.Parent:findFirstChild("Torso")~=nil or hit.Parent.Parent:findFirstChild("Torso")~=nil then
anch=true
end
end
if anch==true then
hit.Anchored=true
end
for i=1,#Parts do
swait()
MagicBlood(BrickColor.new("White"),Parts[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,4,.1,0.1)
--MagicBlood(BrickColor.new("Really red"),Parts[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,4,.1,0.1)
LeftArm.CFrame=Parts[1].CFrame*cf(0,0,0)*euler(1.57,0,3.14)
--local reff=part(3,workspace,0,1,BrickColor.new("Really red"),"Effect",vt())
local reff=part(3,workspace,0,1,BrickColor.new("White"),"Effect",vt())
reff.Anchored=true
reff.CFrame=Parts[1].CFrame
game:GetService("Debris"):AddItem(reff,2)
so("http://roblox.com/asset/?id=183763498",reff,.6,2)
Parts[1].Parent=nil
table.remove(Parts,1)
end
Torso.CFrame=Torso.CFrame*cf(0,1,0)*euler(0,1.57,0)
if anch==true then
Damagefunc(hit,10,20,math.random(1,10),"Knockdown",RootPart,0,1,1)
for i=1,5 do
--MagicBlood(BrickColor.new("Really red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
MagicBlood(BrickColor.new("White"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
hit.Anchored=false
end
Humanoid.WalkSpeed=16
attack=false
else
Humanoid.WalkSpeed=16
attack=false
for i=1,#Parts do
deb=deb+1
if deb>=2 then
swait()
deb=0
end
--MagicBlock(BrickColor.new("Bright red"),Parts[1].CFrame,1,1,1,1,1,1,0.08)
MagicBlock(BrickColor.new("Black"),Parts[1].CFrame,1,1,1,1,1,1,0.08)
--MagicBlood(BrickColor.new("Really red"),Parts[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.06)
MagicBlood(BrickColor.new("White"),Parts[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.06)
--local reff=part(3,workspace,0,1,BrickColor.new("Really red"),"Effect",vt())
local reff=part(3,workspace,0,1,BrickColor.new("White"),"Effect",vt())
reff.Anchored=true
reff.CFrame=Parts[1].CFrame
game:GetService("Debris"):AddItem(reff,2)
so("http://www.roblox.com/asset/?id=87784452",reff,.1,1.5)
MagniDamage(Parts[1],5,5,10,math.random(10,20),"Lifesteal")
Parts[1].Parent=nil
table.remove(Parts,1)
end
end
end
function LetItBuild()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.8)*euler(0.2,0,-1),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.6,0,.4),.3)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.5)*euler(1.57,-1.57,0)*euler(1.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,-.5)*euler(-0.2,2,0)*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.2,0)*euler(0.5,-.6,0)*euler(-.4,0,0),.3)
end
local num=0
local magik=0
local num2=0
while holdx==true do
swait()
if magik<25 then
if num>=10 then
Humanoid:TakeDamage(1)
pos1=Torso.Position+vt(math.random(-200,200)/100,math.random(-200,200)/100,math.random(-200,200)/100)
pos2=prtd8.Position--+vt(math.random(-50,50)/100,math.random(-50,50)/100,math.random(-50,50)/100)
--Lightning(pos1,pos2,5,3,"Really red",.1,.5,.5)
Lightning(pos1,pos2,5,3,"Black",.1,.5,.5)
MagicCircle(BrickColor.new("White"),cf(pos1),5,5,5,1,1,1,.1)
--MagicCircle(BrickColor.new("Really red"),cf(pos1),5,5,5,1,1,1,.1)
MagicBlood(BrickColor.new("Black"),Torso.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
--MagicBlood(BrickColor.new("Really red"),Torso.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
so("http://www.roblox.com/asset/?id=178452221",Torso,.1,1.5)
magik=magik+1
num=0
end
end
num=num+1
num2=num2+magik
if num2>=50 then
--MagicBlood(BrickColor.new("Really red"),cf(prtd8.Position)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,1,.1,0.1)
MagicBlood(BrickColor.new("White"),cf(prtd8.Position)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,1,.1,0.1)
num2=0
end
--MagicBlock(BrickColor.new("Really red"),cf(prtd8.Position)*cf(math.random(-100,100)/100,math.random(-100,100)/100,math.random(-100,100)/100)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),magik/5,magik/5,magik/5,magik/8,magik/8,magik/8,.1)
end
Torso.Velocity=RootPart.CFrame.lookVector*(10*magik)
blcf=nil
scfr=nil
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,math.ceil((magik/2)),magik,1,"Lifesteal",RootPart,.5,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=28144425",prtd7,1,1)
for i=0,1,0.1 do
swait()
hitbox2.CFrame=prtd7.CFrame
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0=RootCF*cf(0,0,-0.8)*euler(0,0,6.28*i)*euler(0.2,0,-1)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.5)*euler(1.57,-1.57,0)*euler(1.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,-.5)*euler(-0.2,2,0)*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.2,0)*euler(0.5,-.6,0)*euler(-.4,0,0),.3)
end
end
con1:disconnect()
hitbox2.Parent=nil
attack=false
end
function YourMoveCreep()
attack=true
local pers=nil
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(0.2,0,-1.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0.2,1.3),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-0.5,1)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,-0.4,0)*euler(0,0,-1.7),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,0)*euler(0.2,-1.2,0)*euler(-.2,1.4,0),.3)
end
--local blockprt=part(3,model2,0,1,BrickColor.new("Really red"),"Block",vt(8,.1,8))
local blockprt=part(3,model2,0,1,BrickColor.new("Black"),"Block",vt(8,.1,8))
blockprt.Anchored=true
blockprt.CFrame=LeftArm.CFrame*cf(0,-1,0)
conbl=blockprt.Touched:connect(function(hit)
if hit.Parent.Parent:findFirstChild("Torso")~=nil then
hit=hit.Parent.Parent.Torso
end
if hit.Parent:findFirstChild("Torso")~=nil and hit.Parent~=Character and guard==true then
pers=hit
guard=false
end
end)
cost=Humanoid.MaxHealth*.1
Humanoid:TakeDamage(cost)
num=0
while guard==true do
swait()
if num>10 then
num=0
cost=Humanoid.MaxHealth*.006
Humanoid:TakeDamage(cost)
--MagicBlock(BrickColor.new("Really red"),LeftArm.CFrame*cf(0,-1,0),1,1,1,.7,.7,.7,0.05)
--MagicCircle(BrickColor.new("Really red"),LeftArm.CFrame*cf(0,-1,0),1,.1,1,6,0,6,0.1)
MagicBlock(BrickColor.new("Black"),LeftArm.CFrame*cf(0,-1,0),1,1,1,.7,.7,.7,0.05)
MagicCircle(BrickColor.new("White"),LeftArm.CFrame*cf(0,-1,0),1,.1,1,6,0,6,0.1)
end
blockprt.CFrame=LeftArm.CFrame*cf(0,-1,0)
num=num+1
end
conbl:disconnect()
blockprt.Parent=nil
if pers~=nil then
Humanoid.WalkSpeed=0
blcf=nil
scfr=nil
so("http://roblox.com/asset/?id=28144425",prtd7,1,.7)
for i=0,1,0.1 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(-0.2,0,1.6),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,-0.2,-1),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,0,0)*euler(0,0,-1),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,-.5)*euler(0.2,-1.2,0)*euler(-.2,-1.4,0),.3)
if i==0.1 then
--Damagefunc(pers,10,20,math.random(20,50),"Knockdown",RootPart,.2,1,1)
--[[for i=1,math.random(5,8) do
--MagicBlood(BrickColor.new("Really red"),cf(pers.Position)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),2,.1,2,-.05,2,-.05,0.01)
MagicBlood(BrickColor.new("White"),cf(pers.Position)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),2,.1,2,-.05,2,-.05,0.01)
end]]
local ref=part(3,workspace,0,1,BrickColor.new("Black"),"Effect",vt())
ref.Anchored=true
ref.CFrame=cf(prtd8.Position)
game:GetService("Debris"):AddItem(ref,3)
--MagicBlock(BrickColor.new("Really red"),cf(ref.Position),1,1,1,5,5,5,0.05)
MagicBlock(BrickColor.new("White"),cf(ref.Position),1,1,1,5,5,5,0.05)
local num=0
local eul=CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50))
for i=1,6 do
--MagicBlood(BrickColor.new("Really red"),cf(ref.Position)*eul*euler(num,0,0),2,.1,2,-.05,2,-.05,0.01)
MagicBlood(BrickColor.new("White"),cf(ref.Position)*eul*euler(num,0,0),2,.1,2,-.05,2,-.05,0.01)
--MagicBlood(BrickColor.new("Really red"),cf(ref.Position)*eul*euler(0,1.57,0)*euler(num,0,0),2,.1,2,-.05,2,-.05,0.01)
MagicBlood(BrickColor.new("Black"),cf(ref.Position)*eul*euler(0,1.57,0)*euler(num,0,0),2,.1,2,-.05,2,-.05,0.01)
num=num+1.046
num=num+1.046
end
MagniDamage(ref,10,10,20,math.random(20,50),"Knockdown")
so("http://roblox.com/asset/?id=3264793",ref,1,1)
end
end
swait(10)
Humanoid.WalkSpeed=16
end
attack=false
end
function Endgame()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*euler(0,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-.6)*euler(-.4,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,2)*euler(-.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(0,1.2,-0.5)*euler(4.2,0,0)*euler(0,0,.9),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
Humanoid.MaxHealth=100
Humanoid.WalkSpeed=(16*2)
so("http://roblox.com/asset/?id=168586621",Torso,1,.8)
for i=1,5 do
--MagicBlood(BrickColor.new("Really red"),Torso.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
MagicBlood(BrickColor.new("White"),Torso.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
MagicWave(BrickColor.new("Dark stone grey"),cf(Torso.Position)*cf(0,-2,0)*euler(0,math.random(-50,50),0),1,1,1,.5,.3,.5,0.01)
so("rbxasset://sounds\\unsheath.wav",prt1,1,.6)
wld1.Part1=LeftArm
wld1.C0=euler(.8,-.2,0)*cf(0,1,0)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.6)*euler(0.4,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(.2,0,0)*euler(0,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1.5)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1.57-1.47*i,0,0)*euler(0,0,-.5),.5)
--LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(.4,0,0)*euler(0,0,-.5),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.3)*euler(-0.4,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.4,-1.4,0)*euler(0,0,0),.3)
end
swait(10)
Duration=500
Mode="Endgame"
attack=false
end
function MagniDamage(Part,magni,mindam,maxdam,knock,Type)
for _,c in pairs(workspace:children()) do
local hum=c:findFirstChild("Humanoid")
if hum~=nil then
local head=c:findFirstChild("Torso")
if head~=nil then
local targ=head.Position-Part.Position
local mag=targ.magnitude
if mag<=magni and c.Name~=Player.Name then
Damagefunc(head,mindam,maxdam,knock,Type,Part,.2,1,nil,1)
end
end
end
end
end
function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
end
local Point=Torso.CFrame*cf(0,Torso.Size.Y,0)
LastPoint=Point
function effect(Color,Ref,LP,P1,returnn)
local effectsmsh=Instance.new("CylinderMesh")
effectsmsh.Scale=Vector3.new(0.2,1,0.2)
effectsmsh.Name="Mesh"
local effectsg=Instance.new("Part")
effectsg.formFactor=3
effectsg.CanCollide=false
effectsg.Name="Eff"
effectsg.Locked=true
effectsg.Anchored=true
effectsg.Size=Vector3.new(0.5,1,0.5)
effectsg.Parent=workspace
effectsmsh.Parent=effectsg
effectsg.BrickColor=BrickColor.new(Color)
effectsg.Reflectance=Ref
local point1=P1
local mg=(LP.p - point1.p).magnitude
effectsg.Size=Vector3.new(0.5,mg,0.5)
effectsg.CFrame=cf((LP.p+point1.p)/2,point1.p) * CFrame.Angles(math.rad(90),0,0)
effectsmsh.Scale=Vector3.new(0.2,1,0.2)
game:GetService("Debris"):AddItem(effectsg,2)
if returnn then return effectsg end
coroutine.resume(coroutine.create(function(Part,Mesh)
if not returnn then
for i=0,1,0.05 do
wait()
Part.Transparency=1*i
Mesh.Scale=Vector3.new(0.5-0.5*i,1,0.5-0.5*i)
end
Part.Parent=nil
end
end),effectsg,effectsmsh)
end
local function CFrameFromTopBack(at, top, back)
local right = top:Cross(back)
return CFrame.new(at.x, at.y, at.z,
right.x, top.x, back.x,
right.y, top.y, back.y,
right.z, top.z, back.z)
end
function Triangle(a, b, c)
local edg1 = (c-a):Dot((b-a).unit)
local edg2 = (a-b):Dot((c-b).unit)
local edg3 = (b-c):Dot((a-c).unit)
if edg1 <= (b-a).magnitude and edg1 >= 0 then
a, b, c = a, b, c
elseif edg2 <= (c-b).magnitude and edg2 >= 0 then
a, b, c = b, c, a
elseif edg3 <= (a-c).magnitude and edg3 >= 0 then
a, b, c = c, a, b
else
assert(false, "unreachable")
end
local len1 = (c-a):Dot((b-a).unit)
local len2 = (b-a).magnitude - len1
local width = (a + (b-a).unit*len1 - c).magnitude
local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit)
local list = {}
if len1 > 0.01 then
local w1 = Instance.new('WedgePart', m)
game:GetService("Debris"):AddItem(w1,5)
w1.Material = "Neon"
w1.FormFactor = 'Custom'
if Mode=="Binary" then
w1.BrickColor = BrickColor.new("White")
else
--w1.BrickColor = BrickColor.new("Really red")
w1.BrickColor = BrickColor.new("Black")
end
w1.Transparency = 0
w1.Reflectance = 0
w1.Material = "Neon"
w1.CanCollide = false
NoOutline(w1)
local sz = Vector3.new(0.2, width, len1)
w1.Size = sz
local sp = Instance.new("SpecialMesh",w1)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w1.Size
w1:BreakJoints()
w1.Anchored = true
w1.Parent = workspace
w1.Transparency = 0.7
table.insert(Effects,{w1,"Disappear",.01})
w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
table.insert(list,w1)
end
if len2 > 0.01 then
local w2 = Instance.new('WedgePart', m)
game:GetService("Debris"):AddItem(w2,5)
w2.Material = "Neon"
w2.FormFactor = 'Custom'
if Mode=="Binary" then
w2.BrickColor = BrickColor.new("White")
else
--w2.BrickColor = BrickColor.new("Really red")
w2.BrickColor = BrickColor.new("Black")
end
w2.Transparency = 0
w2.Reflectance = 0
w2.Material = "Neon"
w2.CanCollide = false
NoOutline(w2)
local sz = Vector3.new(0.2, width, len2)
w2.Size = sz
local sp = Instance.new("SpecialMesh",w2)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w2.Size
w2:BreakJoints()
w2.Anchored = true
w2.Parent = workspace
w2.Transparency = 0.7
table.insert(Effects,{w2,"Disappear",.01})
w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
table.insert(list,w2)
end
return unpack(list)
end
--[[
Things for effects
put the variables in one table
like effect={brick,interval,i}
]]
function MagicBlock(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Block1",delay,x3,y3,z3}) --part, type, delay
--[[coroutine.resume(coroutine.create(function(Part,Mesh,dur)
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicCircle(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
--[[coroutine.resume(coroutine.create(function(Part,Mesh)
local wld=nil
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicWave(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=20329976",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
end
function MagicCylinder(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,Character,0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("SpecialMesh",prt,"Head","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
--table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
Effects[#Effects+1]={prt,"Cylinder",delay,x3,y3,z3} --part, type, delay
--[[coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicCylinder2(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,Character,0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("CylinderMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
--table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
Effects[#Effects+1]={prt,"Cylinder",delay,x3,y3,z3} --part, type, delay
--[[coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicBlood(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Blood",delay,x3,y3,z3,msh})
end
function ElecEffect(cff,x,y,z)
--local prt=part(3,workspace,0,0,BrickColor.new("Bright red"),"Part",vt(1,1,1))
local prt=part(3,workspace,0,0,BrickColor.new("Black"),"Part",vt(1,1,1))
prt.Anchored=true
prt.CFrame=cff*cf(math.random(-x,x),math.random(-y,y),math.random(-z,z))
prt.CFrame=cf(prt.Position)
--prt.CFrame=cf(cff)*cf(math.random(-x,x),math.random(-y,y),math.random(-z,z))
game:GetService("Debris"):AddItem(prt,2)
xval=math.random()/2
yval=math.random()/2
zval=math.random()/2
msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(xval,yval,zval))
Effects[#Effects+1]={prt,"Elec",0.1,x,y,z,xval,yval,zval} --part, type, delay
end
function Lightning(p0,p1,tym,ofs,col,th,tra,last)
--[[p0=pos1
p1=pos2
tym=times
ofs=offset
col=color
th=size
tra=transparency
last=lastingtime]]
local magz = (p0 - p1).magnitude local curpos = p0 local trz = {-ofs,ofs}
for i=1,tym do
local li = Instance.new("Part",workspace) li.TopSurface =0 li.BottomSurface = 0 li.Anchored = true li.Transparency = tra or 0.4 li.BrickColor = BrickColor.new(col)
li.formFactor = "Custom" li.CanCollide = false li.Size = Vector3.new(th,th,magz/tym) local ofz = Vector3.new(trz[math.random(1,2)],trz[math.random(1,2)],trz[math.random(1,2)])
local trolpos = CFrame.new(curpos,p1)*CFrame.new(0,0,magz/tym).p+ofz
if tym == i then
local magz2 = (curpos - p1).magnitude li.Size = Vector3.new(th,th,magz2)
li.CFrame = CFrame.new(curpos,p1)*CFrame.new(0,0,-magz2/2)
else
li.CFrame = CFrame.new(curpos,trolpos)*CFrame.new(0,0,magz/tym/2)
end
curpos = li.CFrame*CFrame.new(0,0,magz/tym/2).p game.Debris:AddItem(li,last)
end
end
Damagefunc=function(hit,minim,maxim,knockback,Type,Property,Delay,KnockbackType,decreaseblock)
if hit.Parent==nil then
return
end
h=hit.Parent:FindFirstChild("Humanoid")
for _,v in pairs(hit.Parent:children()) do
if v:IsA("Humanoid") then
h=v
end
end
if hit.Parent.Parent:FindFirstChild("Torso")~=nil then
h=hit.Parent.Parent:FindFirstChild("Humanoid")
end
if hit.Parent.className=="Hat" then
hit=hit.Parent.Parent:findFirstChild("Head")
end
-- and hit.Parent~=CannonTarget.Parent or hit.Parent~=RailgunTarget.Parent
if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then
if hit.Parent:findFirstChild("DebounceHit")~=nil then if hit.Parent.DebounceHit.Value==true then return end end
--[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
return
end]]
-- hs(hit,1.2)
so("http://www.roblox.com/asset/?id=10209590",hit,1,math.random(50,100)/100)
--so("rbxasset://sounds\\unsheath.wav",hit,1,math.random(200,250)/100)
c=Instance.new("ObjectValue")
c.Name="creator"
c.Value=game:service("Players").LocalPlayer
c.Parent=h
game:GetService("Debris"):AddItem(c,.5)
Damage=math.random(minim,maxim)
if Mode=="Demon" then
Damage=Damage+damcount
end
-- h:TakeDamage(Damage)
blocked=false
block=hit.Parent:findFirstChild("Block")
if block~=nil then
print(block.className)
if block.className=="NumberValue" then
if block.Value>0 then
blocked=true
if decreaseblock==nil then
block.Value=block.Value-1
end
end
end
if block.className=="IntValue" then
if block.Value>0 then
blocked=true
if decreaseblock~=nil then
block.Value=block.Value-1
end
end
end
end
if blocked==false then
-- h:TakeDamage(Damage)
h.Health=h.Health-Damage
showDamage(hit.Parent,Damage,.5,BrickColor:Red())
else
h.Health=h.Health-(Damage/2)
showDamage(hit.Parent,Damage/2,.5,BrickColor.new("Bright blue"))
end
if Type=="Knockdown" then
hum=hit.Parent.Humanoid
hum.PlatformStand=true
coroutine.resume(coroutine.create(function(HHumanoid)
swait(1)
HHumanoid.PlatformStand=false
end),hum)
local angle=(hit.Position-(Property.Position+Vector3.new(0,0,0))).unit
--hit.CFrame=cf(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0)
local bodvol=Instance.new("BodyVelocity")
bodvol.velocity=angle*knockback
bodvol.P=5000
bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
bodvol.Parent=hit
rl=Instance.new("BodyAngularVelocity")
rl.P=3000
rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000
rl.angularvelocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
rl.Parent=hit
game:GetService("Debris"):AddItem(bodvol,.5)
game:GetService("Debris"):AddItem(rl,.5)
elseif Type=="Normal" then
vp=Instance.new("BodyVelocity")
vp.P=500
vp.maxForce=Vector3.new(math.huge,0,math.huge)
-- vp.velocity=Character.Torso.CFrame.lookVector*Knockback
if KnockbackType==1 then
vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/1.05
elseif KnockbackType==2 then
vp.velocity=Property.CFrame.lookVector*knockback
end
if knockback>0 then
vp.Parent=hit.Parent.Torso
end
game:GetService("Debris"):AddItem(vp,.5)
elseif Type=="Lifesteal" then
for i=1,5 do
--MagicBlood(BrickColor.new("Really red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
MagicBlood(BrickColor.new("Black"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
vp=Instance.new("BodyVelocity")
vp.P=500
vp.maxForce=Vector3.new(math.huge,0,math.huge)
if KnockbackType==1 then
vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/1.05
elseif KnockbackType==2 then
vp.velocity=Property.CFrame.lookVector*knockback
end
if knockback>0 then
vp.Parent=hit.Parent.Torso
end
game:GetService("Debris"):AddItem(vp,.5)
Heal=math.ceil(Damage/5)
Humanoid.Health=Humanoid.Health+Heal
showDamage(RootPart,Heal,.5,BrickColor.new("Bright green"))
elseif Type=="Up" then
local bodyVelocity=Instance.new("BodyVelocity")
bodyVelocity.velocity=vt(0,30,0)
bodyVelocity.P=5000
bodyVelocity.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
bodyVelocity.Parent=hit
game:GetService("Debris"):AddItem(bodyVelocity,1)
rl=Instance.new("BodyAngularVelocity")
rl.P=3000
rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000
rl.angularvelocity=Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))
rl.Parent=hit
game:GetService("Debris"):AddItem(rl,.5)
elseif Type=="Snare" then
bp=Instance.new("BodyPosition")
bp.P=2000
bp.D=100
bp.maxForce=Vector3.new(math.huge,math.huge,math.huge)
bp.position=hit.Parent.Torso.Position
bp.Parent=hit.Parent.Torso
game:GetService("Debris"):AddItem(bp,1)
elseif Type=="Charge" then
Charge=Charge+1
coroutine.resume(coroutine.create(function(Part)
swait(30)
for i=1,5 do
swait(5)
so("rbxasset://sounds\\unsheath.wav",hit,1,2)
--MagicCircle(BrickColor.new("Bright red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.2,2,.1,.2,8,.1,0.05)
MagicCircle(BrickColor.new("Royal purple"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.2,2,.1,.2,8,.1,0.05)
newdam=math.random(1,5)
if blocked==false then
h:TakeDamage(newdam)
showDamage(hit.Parent,newdam,.5,BrickColor:Red())
else
h:TakeDamage(newdam/2)
showDamage(hit.Parent,newdam,.5,BrickColor.new("Bright blue"))
end
end
end),hit)
end
debounce=Instance.new("BoolValue")
debounce.Name="DebounceHit"
debounce.Parent=hit.Parent
debounce.Value=true
game:GetService("Debris"):AddItem(debounce,Delay)
c=Instance.new("ObjectValue")
c.Name="creator"
c.Value=Player
c.Parent=h
game:GetService("Debris"):AddItem(c,.5)
CRIT=false
hitDeb=true
AttackPos=6
end
end
showDamage=function(Char,Dealt,du,Color)
m=Instance.new("Model")
m.Name=tostring(Dealt)
h=Instance.new("Humanoid")
h.Health=0
h.MaxHealth=0
h.Parent=m
c=Instance.new("Part")
c.Transparency=0
c.BrickColor=Color
c.Name="Head"
c.TopSurface=0
c.BottomSurface=0
c.formFactor="Plate"
c.Size=Vector3.new(1,.4,1)
ms=Instance.new("CylinderMesh")
ms.Scale=Vector3.new(.8,.8,.8)
if CRIT==true then
ms.Scale=Vector3.new(1,1.25,1)
end
ms.Parent=c
c.Reflectance=0
Instance.new("BodyGyro").Parent=c
c.Parent=m
if Char:findFirstChild("Head")~=nil then
c.CFrame=cf(Char["Head"].CFrame.p+Vector3.new(0,1.5,0))
elseif Char.Parent:findFirstChild("Head")~=nil then
c.CFrame=cf(Char.Parent["Head"].CFrame.p+Vector3.new(0,1.5,0))
end
f=Instance.new("BodyPosition")
f.P=2000
f.D=100
f.maxForce=Vector3.new(math.huge,math.huge,math.huge)
f.position=c.Position+Vector3.new(0,3,0)
f.Parent=c
game:GetService("Debris"):AddItem(m,.5+du)
c.CanCollide=false
m.Parent=workspace
c.CanCollide=false
end
combo=0
function ob1d(mouse)
hold=true
if attack==true or equipped==false then return end
if Mode=="Binary" then
idle=0
if Anim=="Run" then
SpinSlash()
else
if combo==0 then
combo=1
attackone()
elseif combo==1 then
combo=2
attacktwo()
elseif combo==2 then
combo=0
attackthree()
end
end
else
if combo==0 then
combo=1
Demonattackone()
elseif combo==1 then
combo=2
Demonattacktwo()
elseif combo==2 then
combo=0
Demonattackthree()
end
end
coroutine.resume(coroutine.create(function()
for i=1,20 do
if attack==false then
swait()
end
end
if attack==false then
combo=0
--equipanim()
end
end))
end
function ob1u(mouse)
hold = false
end
buttonhold = false
eul=0
holdx=false
equipped=false
function key(key)
if key=="c" and Mode=="Demon" then
if guard==true then
guard=false
else
guard=true
end
end
if key=="x" then
holdx=true
end
if attack==true then return end
if key=="f" and Mode~="Endgame" then
if equipped==false then
equipped=true
RSH=ch.Torso["Right Shoulder"]
LSH=ch.Torso["Left Shoulder"]
--
RSH.Parent=nil
LSH.Parent=nil
--
RW.Name="Right Shoulder"
RW.Part0=ch.Torso
RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
RW.C1=cf(0, 0.5, 0)
RW.Part1=ch["Right Arm"]
RW.Parent=ch.Torso
--
LW.Name="Left Shoulder"
LW.Part0=ch.Torso
LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
LW.C1=cf(0, 0.5, 0)
LW.Part1=ch["Left Arm"]
LW.Parent=ch.Torso
--
equipanim()
else
equipped=false
hideanim()
swait(0)
RW.Parent=nil
LW.Parent=nil
RSH.Parent=player.Character.Torso
LSH.Parent=player.Character.Torso
end
end
if equipped==false then return end
if Mode=="Binary" then
if key=="q" then
idle=500
end
if key=="z" and hitfloor~=nil then
BinarySwing()
end
if key=="x" then
BinaryImpulse()
end
if key=="c" then
Bash()
end
if key=="v" then
UnleashTheDemon()
return end
end
if key=="y" then
s = Instance.new('Sound',Character)
s.Looped=false
s.Volume=99.99
s.Pitch=7
s.SoundId="rbxassetid://261303790"
wait(0.01)
s:Play()
wait(2)
s:Remove()
end
if Mode=="Demon" then
if key=="z" then
AgonizingBonds()
end
if key=="x" then
LetItBuild()
end
if key=="c" then
YourMoveCreep()
end
if key=="v" then
Endgame()
end
end
if key=="0" and Mode~="Endgame" then
Humanoid.WalkSpeed=(16*2)
end
end
function key2(key)
if key=="0" and Mode~="Endgame" then
Humanoid.WalkSpeed=16
end
if key=="x" then
holdx=false
end
end
function s(mouse)
mouse.Button1Down:connect(function() ob1d(mouse) end)
mouse.Button1Up:connect(function() ob1u(mouse) end)
mouse.KeyDown:connect(key)
mouse.KeyUp:connect(key2)
player=Player
ch=Character
MMouse=mouse
end
function ds(mouse)
end
Bin.Selected:connect(s)
Bin.Deselected:connect(ds)
print("Fixer the Demon Mercenary loaded.")
local thenum=0
while true do
swait()
if Mode=="Demon" or Mode=="Endgame" then
if Mode=="Endgame" then
if Duration>0 then
Tool.Name="End game"
Duration=Duration-1
else
print("STOP ENDGAME")
Humanoid.WalkSpeed=16
Tool.Name="Demon Blade"
Humanoid.MaxHealth=100
Humanoid.Health=100
wld1.Part1=Torso
wld1.C0=euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5)
Mode="Demon"
end
end
if thenum>=5 then
ElecEffect(prtd7.CFrame,2,4,2)
thenum=0
end
thenum=thenum+1
--[[Humanoid:TakeDamage(Humanoid.Health/1000)
damcount=(Humanoid.MaxHealth-Humanoid.Health)/10
damcount=math.floor(damcount) ]]
for _,c in pairs(Character:children()) do
for _,v in pairs(c:children()) do
if v.className=="BodyGyro" or v.className=="BodyPosition" or v.className=="BodyVelocity" or v.className=="BodyAngularVelocity" then
if v.Name~="FixerVel" and v.Name~="FixerGyro" then
v.Parent=nil
end
end
end
end
end
local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
local velderp=RootPart.Velocity.y
hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
if equipped==true then
if Anim=="Idle" and attack==false and Mode=="Binary" then
idle=idle+1
else
idle=0
end
if idleanim>=0.3 then
idleanim2=true
elseif idleanim<=0 then
idleanim2=false
end
if idleanim2==false then
if Anim=="Walk" then
idleanim=idleanim+0.005
elseif Anim=="Idle" then
idleanim=idleanim+0.003
end
else
if Anim=="Walk" then
idleanim=idleanim-0.005
elseif Anim=="Idle" then
idleanim=idleanim-0.003
end
end
if RootPart.Velocity.y > 1 and hitfloor==nil then
Anim="Jump"
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3,0,-0.2),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-0.5,-1)*euler(-0.5,1.57,0),.2)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(-0.7,-1.57,0),.2)
end
if attack==false and Mode=="Demon" or Mode=="Endgame" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-0.5,.8)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.1)*euler(0.1,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.3,-.2)*euler(0.4,-1.57,0)*euler(0,0,0),.3)
end
elseif RootPart.Velocity.y < -1 and hitfloor==nil then
Anim="Fall"
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(2.6,0,-0.2),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0.4,1.57,0),.2)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(-0.2,-1.57,0),.2)
end
if attack==false and Mode=="Demon" or Mode=="Endgame" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.2,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.6,0,.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-1),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.1)*euler(-0.1,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.6,-.2)*euler(0.8,-1.57,0)*euler(0,0,0),.3)
end
elseif torvel<1 and hitfloor~=nil then
if Anim=="Fall" then
if velderp<=-70 then
coroutine.resume(coroutine.create(function()
Stomp()
end))
end
end
Anim="Idle"
if idle<=500 then
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.5),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1-(idleanim/4),-0.5+idleanim,-0.7+(idleanim/2)),.3)
LW.C0=clerp(LW.C0,cf(-1+idleanim,0.5-idleanim,-0.5)*euler(1-idleanim,-0.5+idleanim,0.5),.3)
RH.C0=clerp(RH.C0,RHC0,.2)
LH.C0=clerp(LH.C0,LHC0,.2)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5-idleanim)*euler(0.4+(idleanim/2),0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-idleanim/2,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.1+idleanim,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,-0.2-idleanim),.3)
RH.C0=clerp(RH.C0,cf(1,-1,-idleanim)*euler(-0.2-(idleanim/2),1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5+idleanim,0)*euler(0.5+(idleanim/2),-1.2,0)*euler(-.2,0,0),.3)
end
if attack==false and Mode=="Endgame" then
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5-idleanim)*euler(0.4+(idleanim/2),0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-idleanim/2,0,0),.3)
--RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.5,-0.5,1)*euler(.5+idleanim,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,-1.57,0)*euler(1.2+idleanim,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0.4,0,-0.5-idleanim),.3)
RH.C0=clerp(RH.C0,cf(1,-1+idleanim,-.5-idleanim)*euler(-0.4-(idleanim/2),1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5+idleanim,-idleanim)*euler(0.4-(idleanim/2),-1.57,0)*euler(0,0,0),.3)
end
else
if attack==false and Mode=="Binary" then
--wld1.C0=clerp(wld1.C0,euler(.2,0,0.1)*cf(0,.8,.3),.1)
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-.3),.1)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1+(idleanim/2),0,0),.1)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.5)*euler(0.1,0,0),.1)
--RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.7,0,1.5),.1)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,.2),.1)
LW.C0=clerp(LW.C0,cf(-1.2,0.5,-0.3)*euler(1.4,0,.8),.1)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.2,1.57,0),.15)
LH.C0=clerp(LH.C0,cf(-1.1,0.4,-0.8)*euler(-0.05,-1.57,0),.15)
end
end
elseif torvel>2 and torvel<22 and hitfloor~=nil then
if Anim=="Fall" then
if velderp<=-70 then
coroutine.resume(coroutine.create(function()
Stomp()
end))
end
end
Anim="Walk"
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.2)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.2)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0.1,0,0),.2)
--RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(-0.1,0,0.2),.2)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3-idleanim,0,-0.2+(idleanim/2)),.2)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.57,-(idleanim/2),1.3-(idleanim/2)),.2)
RH.C0=clerp(RH.C0,RHC0,.3)
LH.C0=clerp(LH.C0,LHC0,.3)
end
if attack==false and Mode=="Demon" or Mode=="Endgame" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.2,0,.2+idleanim),.3)
if Mode=="Demon" then
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(idleanim,0,-0.2),.3)
elseif Mode=="Endgame" then
wld1.C0=clerp(wld1.C0,euler(1,0,0)*cf(0,1,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.3)
end
RH.C0=clerp(RH.C0,cf(1,-.5,0)*euler(0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.57,0)*euler(0,0,0),.3)
end
elseif torvel>=22 and hitfloor~=nil then
if Anim=="Fall" then
if velderp<=-70 then
coroutine.resume(coroutine.create(function()
Stomp()
end))
end
end
Anim="Run"
if attack==false and Mode=="Binary" then
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.3,0,0.5),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0.5,0,-0.5),.4)
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.4)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.2,-0.8,-0.2),.4)
LW.C0=clerp(LW.C0,cf(-.7,0.5,-0.7)*euler(1.2,-0.5,0.8),.4)
RH.C0=clerp(RH.C0,RHC0*cf(0,0,0)*euler(0.2,0.2,.5),.3)
--LH.C0=clerp(LH.C0,LHC0*cf(.5,0.5,-.2)*euler(-0.5,0.5,-0.7),.3)
LH.C0=clerp(LH.C0,LHC0*cf(.5,0.2,0)*euler(0,.5,0.2),.3)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.8)*euler(0.5,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.2,0,.4),.3)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.5)*euler(1.57,-1.57,0)*euler(1.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.3,-.5)*euler(-0.2,2,0)*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.2,0)*euler(0.5,-1.2,0)*euler(-.2,0,0),.3)
end
if attack==false and Mode=="Endgame" then
wld1.C0=clerp(wld1.C0,euler(1,0,0)*cf(0,1,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.2,0,.2+idleanim),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-.5,0)*euler(0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.57,0)*euler(0,0,0),.3)
end
end
end
if #Effects>0 then
--table.insert(Effects,{prt,"Block1",delay})
for e=1,#Effects do
if Effects[e]~=nil then
--for j=1,#Effects[e] do
local Thing=Effects[e]
if Thing~=nil then
local Part=Thing[1]
local Mode=Thing[2]
local Delay=Thing[3]
local IncX=Thing[4]
local IncY=Thing[5]
local IncZ=Thing[6]
if Thing[1].Transparency<=1 then
if Thing[2]=="Block1" then
Thing[1].CFrame=Thing[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
Mesh=Thing[1].Mesh
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Cylinder" then
Mesh=Thing[1].Mesh
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Blood" then
Mesh=Thing[7]
Thing[1].CFrame=Thing[1].CFrame*cf(0,.5,0)
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Elec" then
Mesh=Thing[1].Mesh
Mesh.Scale=Mesh.Scale+vt(Thing[7],Thing[8],Thing[9])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Disappear" then
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
end
else
Part.Parent=nil
table.remove(Effects,e)
end
end
--end
end
end
end
end
--[[
Copyrighted (C) Fenrier 2014
]]
|
-- Sector C3: Research an Item
obj_prim_newobj_id = 0
function OnInit()
Rule_Add("Rule_Init")
end
function Rule_Init()
StartMission()
if (questsStatus.c3_ShipHasResearchedItem ~= 1) then
Event_Start( "IntelEvent_Intro" )
SobGroup_CreateSubSystem("Player_Ships0", "Research")
Rule_AddInterval( "Rule_PlayerWins", 2 )
else
objectivesClear[currentSectorRow][currentSectorCol] = 1
Event_Start( "IntelEvent_AlreadyDone" )
end
Rule_Remove( "Rule_Init" )
end
function Rule_PlayerWins()
if (Player_HasResearch(0, "SensDisProbe") == 1) then
questsStatus.c3_ShipHasResearchedItem = 1
Objective_SetState( obj_prim_newobj_id, OS_Complete )
objectivesClear[currentSectorRow][currentSectorCol] = 1
Event_Start( "IntelEvent_Finale" )
Rule_Remove( "Rule_PlayerWins" )
end
end
Events = {}
Events.IntelEvent_Intro =
{
{
{
[[Sound_EnableAllSpeech(0)]],
[[]]
},
{
[[Sound_EnterIntelEvent()]],
[[]]
},
{
[[Universe_EnableSkip(1)]],
[[]]
},
HW2_LocationCardEvent(mission_text_card, 5),
},
{
HW2_Letterbox(1),
HW2_Wait(2),
},
{
{
[[obj_prim_newobj_id = Objective_Add(mission_text_short, OT_Primary)]],
[[]]
},
{
[[Objective_AddDescription(obj_prim_newobj_id, mission_text_long)]],
[[]]
},
HW2_SubTitleEvent(Actor_FleetIntel, mission_text_long, 4),
},
{
HW2_Wait(2),
},
{
HW2_Letterbox(0),
HW2_Wait(2),
{
[[Universe_EnableSkip(0)]],
[[]]
},
{
[[Sound_ExitIntelEvent()]],
[[]]
},
{
[[Sound_EnableAllSpeech(1)]],
[[]]
},
},
}
Events.IntelEvent_Finale =
{
{
{"Sound_EnterIntelEvent()",""},
{"Universe_EnableSkip(1)",""},
},
{
HW2_Wait( 2 ),
HW2_Letterbox( 1 ),
HW2_Wait( 2 ),
},
{
HW2_SubTitleEvent( Actor_FleetCommand, mission_text_success, 5 ),
},
{
HW2_Wait( 1 ),
},
{
HW2_Letterbox( 0 ),
HW2_Wait( 2 ),
{"Universe_EnableSkip(0)",""},
{"Sound_ExitIntelEvent()",""},
},
}
Events.IntelEvent_AlreadyDone =
{
{
{"Sound_EnterIntelEvent()",""},
{"Universe_EnableSkip(1)",""},
},
{
HW2_Wait( 2 ),
HW2_Letterbox( 1 ),
HW2_Wait( 2 ),
},
{
{"obj_prim_newobj_id = Objective_Add( mission_text_short, OT_Primary )",""},
{"Objective_AddDescription( obj_prim_newobj_id, mission_text_clear)",""},
{"Objective_SetState( obj_prim_newobj_id, OS_Complete )",""},
HW2_SubTitleEvent( Actor_FleetCommand, mission_text_clear, 5 ),
},
{
HW2_Wait( 1 ),
},
{
HW2_Letterbox( 0 ),
HW2_Wait( 2 ),
{"Universe_EnableSkip(0)",""},
{"Sound_ExitIntelEvent()",""},
},
}
|
-- Do not edit! This file was generated by blocks/signal/frequencymodulator_spec.py
local radio = require('radio')
local jigs = require('tests.jigs')
jigs.TestBlock(radio.FrequencyModulatorBlock, {
{
desc = "0.15 Modulation Index, 256 Float32 input, 256 ComplexFloat32 output",
args = {0.1},
inputs = {radio.types.Float32.vector_from_array({-0.73127151, 0.69486749, 0.52754927, -0.48986191, -0.00912983, -0.10101787, 0.30318594, 0.57744670, -0.81228077, -0.94330502, 0.67153019, -0.13446586, 0.52456015, -0.99578792, -0.10922561, 0.44308007, -0.54247558, 0.89054137, 0.80285490, -0.93882000, -0.94910830, 0.08282494, 0.87829834, -0.23759152, -0.56680119, -0.15576684, -0.94191837, -0.55661666, -0.12422481, -0.00837552, -0.53383112, -0.53826690, -0.56243795, -0.08079307, -0.42043677, -0.95702058, 0.67515594, 0.11290865, 0.28458872, -0.62818748, 0.98508680, 0.71989304, -0.75822008, -0.33460963, 0.44296879, 0.42238355, 0.87288117, -0.15578599, 0.66007137, 0.34061113, -0.39326301, 0.17516121, 0.76495802, 0.69239485, 0.01056764, 0.17800452, -0.93094832, -0.51452005, 0.59480852, -0.17137200, -0.65398520, 0.09759752, 0.40608153, 0.34897169, -0.25059396, -0.12207674, 0.01685298, 0.55688524, 0.04187684, -0.21348982, -0.02061296, -0.94085008, -0.91302544, 0.40676415, 0.96637541, 0.18636747, -0.21280062, -0.65930158, 0.00447712, 0.96415329, 0.54104626, 0.07923490, 0.72057962, -0.53564775, 0.02754333, 0.90493482, 0.15558961, -0.08173654, -0.46144104, 0.09599262, 0.91423255, -0.98858166, 0.56731045, 0.64097184, 0.77235913, 0.48100683, 0.61827981, 0.03735657, 0.12271573, -0.14781864, -0.88775343, 0.74002033, 0.13999867, -0.60032117, 0.00944094, -0.03014978, -0.28642008, -0.30784416, 0.07695759, 0.24697889, 0.22490492, -0.08370640, -0.94405001, -0.54078996, -0.64557749, 0.16892174, 0.72201771, 0.59687787, 0.59419513, 0.63287473, -0.48941192, 0.68348968, 0.34622705, -0.83353174, -0.96661872, -0.97087997, 0.51117355, -0.50088155, -0.78102273, 0.24960417, -0.31115428, -0.86096931, -0.68074894, 0.05476080, -0.66371012, -0.45417112, 0.42317989, -0.09059674, -0.35599643, -0.05245798, -0.95273077, -0.22688580, -0.15816264, -0.62392139, -0.78247666, 0.79963702, 0.02023196, -0.58181804, 0.21129727, 0.63407934, -0.95836377, -0.96427095, -0.70707649, 0.43767095, -0.67954481, 0.40921125, 0.35635161, 0.08940433, -0.55880052, 0.95118904, 0.59562171, 0.03319904, -0.55360842, 0.29701284, -0.21020398, 0.15169193, -0.35750839, 0.26189572, -0.88242978, -0.40278813, 0.93580663, 0.75106847, -0.38722676, 0.71702880, -0.37927276, 0.87857687, 0.48768425, -0.16765547, -0.49528381, -0.98303950, 0.75743574, -0.92416686, 0.63882822, 0.92440224, 0.14056113, -0.65696579, 0.73556215, 0.94755048, 0.40804628, 0.01774749, -0.24406233, -0.30613822, -0.58847648, 0.34830603, -0.13409975, -0.61176270, -0.79115158, 0.33191505, -0.40785465, -0.00040016, -0.34930867, 0.74324304, 0.79935658, -0.96381402, -0.59829396, -0.34451860, 0.97409946, 0.56540078, -0.32180870, -0.57394040, 0.34891015, 0.67540216, 0.86437494, -0.31230038, 0.76478642, 0.37422037, -0.03100256, 0.97101647, -0.53071910, 0.45093039, -0.83063954, -0.66061169, 0.82197559, -0.57406360, 0.51823235, 0.20041765, 0.68226439, -0.26378399, -0.31942952, -0.41756943, 0.73483962, 0.20796506, 0.90861493, 0.77453023, -0.72930807, 0.10234095, -0.79145002, -0.92172438, -0.85361314, 0.73233670, 0.57623291, 0.65701193, -0.31820506, 0.23037209, 0.56380719, -0.24392074, 0.14156306, -0.55257183, -0.83651346, -0.46655273, 0.78153634, 0.12889367, 0.85013437, -0.08446148, -0.44563445, 0.57402933})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{0.89628702, -0.44347444}, {0.99973840, -0.02287132}, {0.95276105, 0.30372095}, {0.99999970, 0.00080635}, {0.99998784, -0.00493007}, {0.99766153, -0.06834817}, {0.99255556, 0.12179273}, {0.88471395, 0.46613434}, {0.99967605, -0.02545201}, {0.81495154, -0.57952911}, {0.98081136, -0.19495927}, {0.96086085, -0.27703154}, {0.99880522, 0.04886808}, {0.83822048, -0.54533148}, {0.79885143, -0.60152835}, {0.93340170, -0.35883316}, {0.75975186, -0.65021312}, {0.98902053, -0.14777808}, {0.93725407, 0.34864718}, {0.97280449, -0.23162784}, {0.67480713, -0.73799413}, {0.71228176, -0.70189369}, {0.97452533, -0.22427738}, {0.93033004, -0.36672342}, {0.74409562, -0.66807318}, {0.67525387, -0.73758543}, {0.14892790, -0.98884803}, {-0.19891301, -0.98001713}, {-0.27472293, -0.96152341}, {-0.27977899, -0.96006441}, {-0.58020461, -0.81447077}, {-0.81757271, -0.57582533}, {-0.96633261, -0.25729612}, {-0.97814351, -0.20793097}, {-0.99850380, 0.05468176}, {-0.79242444, 0.60997009}, {-0.97325224, 0.22973920}, {-0.98708880, 0.16017413}, {-0.99983901, -0.01794448}, {-0.92986280, 0.36790642}, {-0.97081465, -0.23983094}, {-0.76836485, -0.64001203}, {-0.97630817, -0.21638478}, {-0.99996907, -0.00786860}, {-0.95932519, -0.28230330}, {-0.85169458, -0.52403855}, {-0.45356652, -0.89122242}, {-0.53849190, -0.84263068}, {-0.15330422, -0.98817903}, {0.06006493, -0.99819446}, {-0.18590556, -0.98256761}, {-0.07686053, -0.99704188}, {0.39282441, -0.91961348}, {0.74380517, -0.66839647}, {0.74822682, -0.66344303}, {0.81759912, -0.57578790}, {0.36375582, -0.93149436}, {0.04899466, -0.99879903}, {0.41026399, -0.91196680}, {0.30988052, -0.95077550}, {-0.09569705, -0.99541050}, {-0.03451453, -0.99940419}, {0.21884161, -0.97576040}, {0.42584229, -0.90479738}, {0.27869949, -0.96037835}, {0.20428827, -0.97891074}, {0.21464244, -0.97669268}, {0.53645176, -0.84393102}, {0.55846900, -0.82952541}, {0.44251329, -0.89676195}, {0.43086210, -0.90241778}, {-0.14519061, -0.98940372}, {-0.65891576, -0.75221670}, {-0.44734892, -0.89435953}, {0.14290187, -0.98973686}, {0.25755489, -0.96626365}, {0.12644501, -0.99197364}, {-0.28352413, -0.95896512}, {-0.28082547, -0.95975888}, {0.31564984, -0.94887573}, {0.61397821, -0.78932297}, {0.65249753, -0.75779086}, {0.91824633, -0.39600971}, {0.73595196, -0.67703378}, {0.74755788, -0.66419667}, {0.98757046, -0.15717685}, {0.99819624, -0.06003535}, {0.99379832, -0.11119761}, {0.92053056, -0.39067063}, {0.94240528, -0.33447310}, {0.97288954, 0.23127031}, {0.92575800, -0.37811658}, {0.99950993, -0.03130420}, {0.93181103, 0.36294380}, {0.65492523, 0.75569373}, {0.40031269, 0.91637862}, {0.02337930, 0.99972665}, {-0.00009040, 1.00000000}, {-0.07711833, 0.99702197}, {0.01568153, 0.99987704}, {0.54255372, 0.84002113}, {0.10829289, 0.99411905}, {0.02054054, 0.99978900}, {0.38733098, 0.92194074}, {0.38185540, 0.92422211}, {0.39929399, 0.91682297}, {0.55695063, 0.83054560}, {0.70621228, 0.70800018}, {0.67116565, 0.74130744}, {0.54852462, 0.83613443}, {0.42529407, 0.90505522}, {0.47228470, 0.88144606}, {0.88432449, 0.46687278}, {0.98936635, 0.14544506}, {0.96647590, -0.25675726}, {0.98823756, -0.15292642}, {0.95529854, 0.29564276}, {0.78060842, 0.62502038}, {0.49887031, 0.86667663}, {0.12432540, 0.99224150}, {0.41882819, 0.90806550}, {0.00270529, 0.99999636}, {-0.21318679, 0.97701144}, {0.30399936, 0.95267224}, {0.79331356, 0.60881329}, {0.99900818, 0.04452723}, {0.93386585, 0.35762346}, {0.99869937, 0.05098649}, {0.90486985, -0.42568833}, {0.96025234, -0.27913341}, {0.88773471, -0.46035543}, {0.52391243, -0.85177213}, {0.12339540, -0.99235761}, {0.15745981, -0.98752540}, {-0.25602078, -0.96667129}, {-0.51779163, -0.85550678}, {-0.27479443, -0.96150297}, {-0.32905203, -0.94431180}, {-0.53032064, -0.84779716}, {-0.55797106, -0.82986039}, {-0.92857599, -0.37114233}, {-0.97188622, -0.23545091}, {-0.99045098, -0.13786554}, {-0.96798652, 0.25100210}, {-0.73484361, 0.67823654}, {-0.97063649, 0.24055111}, {-0.97361583, 0.22819328}, {-0.82770622, 0.56116164}, {-0.89470464, 0.44665828}, {-0.99791265, 0.06457800}, {-0.78581667, 0.61845952}, {-0.29374874, 0.95588267}, {0.14560397, 0.98934293}, {-0.12851690, 0.99170732}, {0.29370180, 0.95589709}, {0.04097079, 0.99916035}, {-0.18190160, 0.98331672}, {-0.23682274, 0.97155285}, {0.11177642, 0.99373341}, {-0.46677363, 0.88437682}, {-0.75776362, 0.65252918}, {-0.77120918, 0.63658178}, {-0.50802994, 0.86133939}, {-0.65901983, 0.75212556}, {-0.55423158, 0.83236247}, {-0.63092953, 0.77584016}, {-0.44226390, 0.89688498}, {-0.58321053, 0.81232107}, {-0.06817531, 0.99767333}, {0.18379979, 0.98296368}, {-0.39230290, 0.91983610}, {-0.76757193, 0.64096284}, {-0.59055179, 0.80699974}, {-0.88302302, 0.46932963}, {-0.74728096, 0.66450828}, {-0.98475969, 0.17392059}, {-0.99135172, -0.13123187}, {-0.99965495, -0.02626752}, {-0.95968264, 0.28108576}, {-0.61958122, 0.78493255}, {-0.91034627, 0.41384742}, {-0.53410512, 0.84541810}, {-0.82195586, 0.56955123}, {-0.99968398, 0.02513796}, {-0.99800503, -0.06313453}, {-0.93950731, 0.34252891}, {-0.99367177, -0.11232265}, {-0.75971359, -0.65025789}, {-0.56998664, -0.82165396}, {-0.56078905, -0.82795870}, {-0.68067777, -0.73258293}, {-0.80817086, -0.58894807}, {-0.96638846, -0.25708622}, {-0.88752407, -0.46076140}, {-0.92315215, -0.38443485}, {-0.99994785, -0.01021359}, {-0.88379627, 0.46787190}, {-0.96151477, 0.27475321}, {-0.86047465, 0.50949329}, {-0.86034656, 0.50970948}, {-0.72873461, 0.68479621}, {-0.95900381, 0.28339314}, {-0.97699344, -0.21326923}, {-0.92465699, 0.38080111}, {-0.72028613, 0.69367707}, {-0.55448759, 0.83219200}, {-0.93196374, 0.36255148}, {-0.99987596, 0.01575175}, {-0.97634256, 0.21622947}, {-0.83724642, 0.54682583}, {-0.93612862, 0.35165784}, {-0.99788654, -0.06498062}, {-0.82071829, -0.57133305}, {-0.91635972, -0.40035591}, {-0.62751818, -0.77860188}, {-0.42886138, -0.90337032}, {-0.44637612, -0.89484543}, {0.14686303, -0.98915684}, {-0.18499267, -0.98273993}, {0.09711025, -0.99527365}, {-0.41199538, -0.91118592}, {-0.74445438, -0.66767329}, {-0.31765440, -0.94820654}, {-0.63185924, -0.77508318}, {-0.35071498, -0.93648225}, {-0.23032176, -0.97311455}, {0.19501331, -0.98080057}, {0.03052590, -0.99953395}, {-0.16935259, -0.98555553}, {-0.41917768, -0.90790421}, {0.02916991, -0.99957448}, {0.15916267, -0.98725235}, {0.66742235, -0.74467939}, {0.93820053, -0.34609216}, {0.68830937, -0.72541726}, {0.73350102, -0.67968839}, {0.32042289, -0.94727463}, {-0.25027156, -0.96817571}, {-0.70986152, -0.70434129}, {-0.32324904, -0.94631392}, {0.03289102, -0.99945897}, {0.43109843, -0.90230489}, {0.24330863, -0.96994895}, {0.38067180, -0.92471021}, {0.67780501, -0.73524171}, {0.55761772, -0.83009785}, {0.62915057, -0.77728349}, {0.32713363, -0.94497806}, {-0.19114473, -0.98156184}, {-0.46662599, -0.88445473}, {0.00558178, -0.99998444}, {0.08645987, -0.99625534}, {0.58162361, -0.81345803}, {0.53765583, -0.84316438}, {0.28370351, -0.95891207}, {0.60385406, -0.79709488}})}
},
{
desc = "0.25 Modulation Index, 256 Float32 input, 256 ComplexFloat32 output",
args = {0.25},
inputs = {radio.types.Float32.vector_from_array({-0.73127151, 0.69486749, 0.52754927, -0.48986191, -0.00912983, -0.10101787, 0.30318594, 0.57744670, -0.81228077, -0.94330502, 0.67153019, -0.13446586, 0.52456015, -0.99578792, -0.10922561, 0.44308007, -0.54247558, 0.89054137, 0.80285490, -0.93882000, -0.94910830, 0.08282494, 0.87829834, -0.23759152, -0.56680119, -0.15576684, -0.94191837, -0.55661666, -0.12422481, -0.00837552, -0.53383112, -0.53826690, -0.56243795, -0.08079307, -0.42043677, -0.95702058, 0.67515594, 0.11290865, 0.28458872, -0.62818748, 0.98508680, 0.71989304, -0.75822008, -0.33460963, 0.44296879, 0.42238355, 0.87288117, -0.15578599, 0.66007137, 0.34061113, -0.39326301, 0.17516121, 0.76495802, 0.69239485, 0.01056764, 0.17800452, -0.93094832, -0.51452005, 0.59480852, -0.17137200, -0.65398520, 0.09759752, 0.40608153, 0.34897169, -0.25059396, -0.12207674, 0.01685298, 0.55688524, 0.04187684, -0.21348982, -0.02061296, -0.94085008, -0.91302544, 0.40676415, 0.96637541, 0.18636747, -0.21280062, -0.65930158, 0.00447712, 0.96415329, 0.54104626, 0.07923490, 0.72057962, -0.53564775, 0.02754333, 0.90493482, 0.15558961, -0.08173654, -0.46144104, 0.09599262, 0.91423255, -0.98858166, 0.56731045, 0.64097184, 0.77235913, 0.48100683, 0.61827981, 0.03735657, 0.12271573, -0.14781864, -0.88775343, 0.74002033, 0.13999867, -0.60032117, 0.00944094, -0.03014978, -0.28642008, -0.30784416, 0.07695759, 0.24697889, 0.22490492, -0.08370640, -0.94405001, -0.54078996, -0.64557749, 0.16892174, 0.72201771, 0.59687787, 0.59419513, 0.63287473, -0.48941192, 0.68348968, 0.34622705, -0.83353174, -0.96661872, -0.97087997, 0.51117355, -0.50088155, -0.78102273, 0.24960417, -0.31115428, -0.86096931, -0.68074894, 0.05476080, -0.66371012, -0.45417112, 0.42317989, -0.09059674, -0.35599643, -0.05245798, -0.95273077, -0.22688580, -0.15816264, -0.62392139, -0.78247666, 0.79963702, 0.02023196, -0.58181804, 0.21129727, 0.63407934, -0.95836377, -0.96427095, -0.70707649, 0.43767095, -0.67954481, 0.40921125, 0.35635161, 0.08940433, -0.55880052, 0.95118904, 0.59562171, 0.03319904, -0.55360842, 0.29701284, -0.21020398, 0.15169193, -0.35750839, 0.26189572, -0.88242978, -0.40278813, 0.93580663, 0.75106847, -0.38722676, 0.71702880, -0.37927276, 0.87857687, 0.48768425, -0.16765547, -0.49528381, -0.98303950, 0.75743574, -0.92416686, 0.63882822, 0.92440224, 0.14056113, -0.65696579, 0.73556215, 0.94755048, 0.40804628, 0.01774749, -0.24406233, -0.30613822, -0.58847648, 0.34830603, -0.13409975, -0.61176270, -0.79115158, 0.33191505, -0.40785465, -0.00040016, -0.34930867, 0.74324304, 0.79935658, -0.96381402, -0.59829396, -0.34451860, 0.97409946, 0.56540078, -0.32180870, -0.57394040, 0.34891015, 0.67540216, 0.86437494, -0.31230038, 0.76478642, 0.37422037, -0.03100256, 0.97101647, -0.53071910, 0.45093039, -0.83063954, -0.66061169, 0.82197559, -0.57406360, 0.51823235, 0.20041765, 0.68226439, -0.26378399, -0.31942952, -0.41756943, 0.73483962, 0.20796506, 0.90861493, 0.77453023, -0.72930807, 0.10234095, -0.79145002, -0.92172438, -0.85361314, 0.73233670, 0.57623291, 0.65701193, -0.31820506, 0.23037209, 0.56380719, -0.24392074, 0.14156306, -0.55257183, -0.83651346, -0.46655273, 0.78153634, 0.12889367, 0.85013437, -0.08446148, -0.44563445, 0.57402933})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{0.40969315, -0.91222340}, {0.99836546, -0.05715213}, {0.71687317, 0.69720358}, {0.99999797, 0.00201588}, {0.99992406, -0.01232491}, {0.98541445, -0.17017153}, {0.95377499, 0.30052176}, {0.35087520, 0.93642223}, {0.99797589, -0.06359395}, {0.02541657, -0.99967694}, {0.88207865, -0.47110212}, {0.76370823, -0.64556152}, {0.99254054, 0.12191483}, {0.12847905, -0.99171221}, {-0.04272297, -0.99908698}, {0.60777253, -0.79411119}, {-0.19755787, -0.98029125}, {0.93203658, -0.36236423}, {0.62916470, 0.77727205}, {0.83405608, -0.55167967}, {-0.48331413, -0.87544698}, {-0.36565387, -0.93075091}, {0.84431881, -0.53584111}, {0.59082806, -0.80679750}, {-0.25538349, -0.96683985}, {-0.48198819, -0.87617773}, {-0.91644657, 0.40015703}, {-0.28094313, 0.95972443}, {-0.08952440, 0.99598461}, {-0.07641392, 0.99707615}, {0.69040704, 0.72342110}, {0.99932432, -0.03675508}, {0.60563028, -0.79574621}, {0.50004297, -0.86600059}, {-0.13634646, -0.99066120}, {-0.99760246, 0.06920526}, {-0.54762602, -0.83672321}, {-0.39141396, -0.92021471}, {0.04484832, -0.99899381}, {-0.80867195, -0.58825982}, {0.56915629, -0.82222933}, {0.98633802, 0.16473421}, {0.51865351, -0.85498452}, {0.01967079, -0.99980652}, {0.65598410, -0.75477469}, {0.98165667, -0.19065738}, {0.38158417, 0.92433411}, {0.59415734, 0.80434883}, {-0.38998929, 0.92081940}, {-0.80498552, 0.59329444}, {-0.31258667, 0.94988924}, {-0.55889875, 0.82923591}, {-0.97504908, -0.22198932}, {-0.25643378, -0.96656179}, {-0.24035460, -0.97068518}, {0.03686935, -0.99932009}, {-0.98945618, -0.14483275}, {-0.78823388, 0.61537582}, {-0.96338028, -0.26813892}, {-0.99999744, -0.00227013}, {-0.51909244, 0.85471815}, {-0.64352506, 0.76542503}, {-0.97278601, 0.23170528}, {-0.95100278, -0.30918232}, {-0.99685746, 0.07921597}, {-0.96348852, 0.26774976}, {-0.97023815, 0.24215266}, {-0.80792761, -0.58928174}, {-0.76744550, -0.64111423}, {-0.93568516, -0.35283607}, {-0.94661707, -0.32236019}, {-0.40879562, 0.91262597}, {0.84844637, 0.52928138}, {0.36543381, 0.93083733}, {-0.91024685, 0.41406599}, {-0.99101257, 0.13376890}, {-0.89227492, 0.45149246}, {-0.06668098, 0.99777436}, {-0.07369649, 0.99728072}, {-0.99984765, -0.01745437}, {-0.64686590, -0.76260376}, {-0.54719192, -0.83700716}, {0.52513891, -0.85101652}, {-0.28452915, -0.95866740}, {-0.24279912, -0.97007656}, {0.92315876, -0.38441890}, {0.98874438, -0.14961481}, {0.96144962, -0.27498120}, {0.53743809, -0.84330320}, {0.65801615, -0.75300384}, {0.83456260, 0.55091316}, {0.56579232, -0.82454777}, {0.99693823, -0.07819338}, {0.59898531, 0.80075997}, {-0.54046148, 0.84136879}, {-0.97031969, 0.24182585}, {-0.74720854, -0.66458964}, {-0.70694697, -0.70726651}, {-0.55836284, -0.82959688}, {-0.73427886, -0.67884797}, {-0.79711920, 0.60382199}, {-0.87071902, -0.49178079}, {-0.74247205, -0.66987705}, {-0.97825152, 0.20742208}, {-0.98121989, 0.19289269}, {-0.97098786, 0.23912886}, {-0.77036935, 0.63759792}, {-0.38560149, 0.92266542}, {-0.49405214, 0.86943227}, {-0.78623849, 0.61792320}, {-0.95146990, 0.30774173}, {-0.90290987, 0.42982990}, {0.34892002, 0.93715250}, {0.93415695, 0.35686246}, {0.79658961, -0.60452050}, {0.92724013, -0.37446722}, {0.73147023, 0.68187338}, {-0.11683048, 0.99315184}, {-0.86765075, 0.49717423}, {-0.88985068, -0.45625189}, {-0.95680559, 0.29072842}, {-0.71187276, -0.70230842}, {-0.24576530, -0.96932936}, {-0.99991316, -0.01317782}, {-0.06556624, 0.99784821}, {0.99380642, 0.11112490}, {0.61034173, 0.79213822}, {0.99188012, 0.12717618}, {0.45421442, -0.89089239}, {0.76016527, -0.64972973}, {0.36609346, -0.93057811}, {-0.82915813, -0.55901414}, {-0.88877934, 0.45833531}, {-0.92486972, 0.38028407}, {-0.13770032, 0.99047393}, {0.54406232, 0.83904481}, {-0.08933918, 0.99600124}, {0.05282614, 0.99860370}, {0.57454503, 0.81847298}, {0.63996249, 0.76840615}, {0.81376284, -0.58119702}, {0.55985105, -0.82859331}, {0.33891630, -0.94081652}, {-0.59260428, -0.80549371}, {-0.95749587, 0.28844696}, {-0.57067984, -0.82117265}, {-0.54429984, -0.83889079}, {-0.99669498, -0.08123494}, {-0.91582894, -0.40156859}, {-0.16085565, -0.98697793}, {-0.99538058, 0.09600803}, {0.04002236, 0.99919879}, {0.91305208, 0.40784293}, {0.44682625, 0.89462078}, {0.99919391, 0.04014427}, {0.77571940, 0.63107795}, {0.32224306, 0.94665694}, {0.18656322, 0.98244298}, {0.87499458, 0.48413271}, {-0.41568860, 0.90950698}, {-0.97875530, 0.20503187}, {-0.98811191, 0.15373628}, {-0.51999229, 0.85417098}, {-0.84862942, 0.52898782}, {-0.63127893, 0.77555591}, {-0.79649591, 0.60464388}, {-0.35218582, 0.93593007}, {-0.69706082, 0.71701199}, {0.57681710, 0.81687331}, {0.94820124, 0.31767020}, {-0.22060649, 0.97536290}, {-0.98582333, 0.16778649}, {-0.71313351, 0.70102823}, {-0.93955493, -0.34239820}, {-0.96982312, 0.24380967}, {-0.42324460, -0.90601546}, {0.32312402, -0.94635665}, {0.06562915, -0.99784410}, {-0.65358615, -0.75685215}, {-0.77399385, 0.63319314}, {-0.87560689, -0.48302445}, {-0.58365655, 0.81200063}, {-0.99843818, -0.05586763}, {-0.06280991, -0.99802554}, {0.15728565, -0.98755318}, {-0.76691371, -0.64175022}, {0.27770165, -0.96066737}, {0.98026216, 0.19770196}, {0.66748452, 0.74462366}, {0.64646971, 0.76293963}, {0.88491917, 0.46574464}, {0.99999356, 0.00359517}, {0.60519797, -0.79607499}, {0.93099630, -0.36502868}, {0.83409435, -0.55162179}, {0.02553152, -0.99967402}, {-0.93813467, -0.34627062}, {-0.64102471, -0.76752025}, {-0.97267538, -0.23216924}, {-0.97282112, -0.23155789}, {-0.95079207, 0.30982971}, {-0.65812594, -0.75290787}, {0.51181811, -0.85909384}, {-0.82863021, -0.55979633}, {-0.94085294, 0.33881524}, {-0.63187486, 0.77507043}, {-0.80012923, -0.59982771}, {-0.03937119, -0.99922466}, {-0.51831323, -0.85519087}, {-0.99227536, -0.12405490}, {-0.78230262, -0.62289858}, {0.16185075, -0.98681527}, {0.99872649, -0.05045196}, {0.85717690, -0.51502210}, {0.78981405, 0.61334634}, {0.31711119, 0.94838834}, {0.36290202, 0.93182731}, {-0.91434550, 0.40493491}, {-0.31479165, 0.94916081}, {-0.85655510, 0.51605552}, {0.27271020, 0.96209621}, {0.96718198, 0.25408456}, {0.02273651, 0.99974149}, {0.79830509, 0.60225326}, {0.11021400, 0.99390787}, {-0.20295733, 0.97918761}, {-0.95688331, 0.29047263}, {-0.75896680, 0.65112936}, {-0.35224265, 0.93590873}, {0.29164907, 0.95652539}, {-0.75675410, 0.65369964}, {-0.92650068, 0.37629315}, {-0.50496334, -0.86314082}, {0.63444453, -0.77296835}, {-0.44242850, -0.89680380}, {-0.29317683, -0.95605826}, {-0.99954879, -0.03003709}, {-0.15240034, 0.98831886}, {0.92756987, 0.37364969}, {0.03749542, 0.99929678}, {-0.76280534, 0.64662820}, {-0.94640589, -0.32297963}, {-0.98542207, 0.17012753}, {-0.98183227, -0.18975082}, {-0.47438180, -0.88031918}, {-0.76908708, -0.63914406}, {-0.60919487, -0.79302055}, {-0.99885905, -0.04775534}, {-0.29988998, 0.95397377}, {0.41530839, 0.90968066}, {-0.71690494, 0.69717097}, {-0.84245193, 0.53877145}, {-0.72040534, -0.69355333}, {-0.80581951, -0.59216118}, {-0.99780542, 0.06621433}, {-0.67086589, -0.74157870}})}
},
{
desc = "0.50 Modulation Index, 256 Float32 input, 256 ComplexFloat32 output",
args = {0.5},
inputs = {radio.types.Float32.vector_from_array({-0.73127151, 0.69486749, 0.52754927, -0.48986191, -0.00912983, -0.10101787, 0.30318594, 0.57744670, -0.81228077, -0.94330502, 0.67153019, -0.13446586, 0.52456015, -0.99578792, -0.10922561, 0.44308007, -0.54247558, 0.89054137, 0.80285490, -0.93882000, -0.94910830, 0.08282494, 0.87829834, -0.23759152, -0.56680119, -0.15576684, -0.94191837, -0.55661666, -0.12422481, -0.00837552, -0.53383112, -0.53826690, -0.56243795, -0.08079307, -0.42043677, -0.95702058, 0.67515594, 0.11290865, 0.28458872, -0.62818748, 0.98508680, 0.71989304, -0.75822008, -0.33460963, 0.44296879, 0.42238355, 0.87288117, -0.15578599, 0.66007137, 0.34061113, -0.39326301, 0.17516121, 0.76495802, 0.69239485, 0.01056764, 0.17800452, -0.93094832, -0.51452005, 0.59480852, -0.17137200, -0.65398520, 0.09759752, 0.40608153, 0.34897169, -0.25059396, -0.12207674, 0.01685298, 0.55688524, 0.04187684, -0.21348982, -0.02061296, -0.94085008, -0.91302544, 0.40676415, 0.96637541, 0.18636747, -0.21280062, -0.65930158, 0.00447712, 0.96415329, 0.54104626, 0.07923490, 0.72057962, -0.53564775, 0.02754333, 0.90493482, 0.15558961, -0.08173654, -0.46144104, 0.09599262, 0.91423255, -0.98858166, 0.56731045, 0.64097184, 0.77235913, 0.48100683, 0.61827981, 0.03735657, 0.12271573, -0.14781864, -0.88775343, 0.74002033, 0.13999867, -0.60032117, 0.00944094, -0.03014978, -0.28642008, -0.30784416, 0.07695759, 0.24697889, 0.22490492, -0.08370640, -0.94405001, -0.54078996, -0.64557749, 0.16892174, 0.72201771, 0.59687787, 0.59419513, 0.63287473, -0.48941192, 0.68348968, 0.34622705, -0.83353174, -0.96661872, -0.97087997, 0.51117355, -0.50088155, -0.78102273, 0.24960417, -0.31115428, -0.86096931, -0.68074894, 0.05476080, -0.66371012, -0.45417112, 0.42317989, -0.09059674, -0.35599643, -0.05245798, -0.95273077, -0.22688580, -0.15816264, -0.62392139, -0.78247666, 0.79963702, 0.02023196, -0.58181804, 0.21129727, 0.63407934, -0.95836377, -0.96427095, -0.70707649, 0.43767095, -0.67954481, 0.40921125, 0.35635161, 0.08940433, -0.55880052, 0.95118904, 0.59562171, 0.03319904, -0.55360842, 0.29701284, -0.21020398, 0.15169193, -0.35750839, 0.26189572, -0.88242978, -0.40278813, 0.93580663, 0.75106847, -0.38722676, 0.71702880, -0.37927276, 0.87857687, 0.48768425, -0.16765547, -0.49528381, -0.98303950, 0.75743574, -0.92416686, 0.63882822, 0.92440224, 0.14056113, -0.65696579, 0.73556215, 0.94755048, 0.40804628, 0.01774749, -0.24406233, -0.30613822, -0.58847648, 0.34830603, -0.13409975, -0.61176270, -0.79115158, 0.33191505, -0.40785465, -0.00040016, -0.34930867, 0.74324304, 0.79935658, -0.96381402, -0.59829396, -0.34451860, 0.97409946, 0.56540078, -0.32180870, -0.57394040, 0.34891015, 0.67540216, 0.86437494, -0.31230038, 0.76478642, 0.37422037, -0.03100256, 0.97101647, -0.53071910, 0.45093039, -0.83063954, -0.66061169, 0.82197559, -0.57406360, 0.51823235, 0.20041765, 0.68226439, -0.26378399, -0.31942952, -0.41756943, 0.73483962, 0.20796506, 0.90861493, 0.77453023, -0.72930807, 0.10234095, -0.79145002, -0.92172438, -0.85361314, 0.73233670, 0.57623291, 0.65701193, -0.31820506, 0.23037209, 0.56380719, -0.24392074, 0.14156306, -0.55257183, -0.83651346, -0.46655273, 0.78153634, 0.12889367, 0.85013437, -0.08446148, -0.44563445, 0.57402933})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{-0.66430306, -0.74746335}, {0.99346727, -0.11411744}, {0.02781433, 0.99961311}, {0.99999189, 0.00403174}, {0.99969620, -0.02464795}, {0.94208330, -0.33537897}, {0.81937337, 0.57326025}, {-0.75377321, 0.65713465}, {0.99191159, -0.12693045}, {-0.99870801, -0.05081673}, {0.55612558, -0.83109826}, {0.16650061, -0.98604137}, {0.97027355, 0.24201083}, {-0.96698630, -0.25482848}, {-0.99634951, 0.08536793}, {-0.26122516, -0.96527791}, {-0.92194176, 0.38732848}, {0.73738432, -0.67547339}, {-0.20830363, 0.97806424}, {0.39129910, -0.92026359}, {-0.53281492, 0.84623182}, {-0.73259449, 0.68066531}, {0.42574856, -0.90484148}, {-0.30184442, -0.95335722}, {-0.86955857, 0.49382985}, {-0.53537476, 0.84461462}, {0.67974871, -0.73344505}, {-0.84214193, -0.53925598}, {-0.98397076, -0.17832986}, {-0.98832184, -0.15238100}, {-0.04667617, 0.99891007}, {0.99729812, -0.07346050}, {-0.26642400, -0.96385592}, {-0.49991405, -0.86607504}, {-0.96281928, 0.27014631}, {0.99042124, -0.13807867}, {-0.40021145, 0.91642284}, {-0.69359022, 0.72036976}, {-0.99597728, -0.08960637}, {0.30790073, 0.95141846}, {-0.35212222, -0.93595403}, {0.94572526, 0.32496724}, {-0.46199703, -0.88688147}, {-0.99922609, -0.03933396}, {-0.13936973, -0.99024040}, {0.92729956, -0.37432015}, {-0.70878702, 0.70542252}, {-0.29395413, 0.95581955}, {-0.69581670, -0.71821940}, {0.29600337, -0.95518690}, {-0.80457914, -0.59384543}, {-0.37526444, -0.92691779}, {0.90144151, 0.43290097}, {-0.86848342, 0.49571818}, {-0.88445932, 0.46661729}, {-0.99728131, -0.07368857}, {0.95804697, 0.28661129}, {0.24262528, -0.97012007}, {0.85620302, 0.51663947}, {0.99998969, 0.00454025}, {-0.46108612, -0.88735539}, {-0.17175101, -0.98514038}, {0.89262533, -0.45079932}, {0.80881256, 0.58806652}, {0.98744965, -0.15793408}, {0.85662013, -0.51594758}, {0.88272417, -0.46989152}, {0.30549404, 0.95219398}, {0.17794514, 0.98404038}, {0.75101340, 0.66028696}, {0.79216784, 0.61030328}, {-0.66577226, -0.74615496}, {0.43972239, 0.89813375}, {-0.73291630, 0.68031883}, {0.65709871, -0.75380450}, {0.96421176, -0.26513332}, {0.59230912, -0.80571079}, {-0.99110729, -0.13306513}, {-0.98913765, -0.14699216}, {0.99939066, 0.03490341}, {-0.16312896, 0.98660475}, {-0.40116200, 0.91600710}, {-0.44845825, -0.89380378}, {-0.83808631, 0.54553765}, {-0.88209718, 0.47106746}, {0.70444423, -0.70975935}, {0.95523083, -0.29586160}, {0.84877068, -0.52876115}, {-0.42232054, -0.90644658}, {-0.13402946, -0.99097735}, {0.39298940, 0.91954303}, {-0.35975814, -0.93304563}, {0.98777157, -0.15590793}, {-0.28243312, 0.95928699}, {-0.41580281, -0.90945482}, {0.88304049, -0.46929675}, {0.11664114, 0.99317414}, {-0.00045190, 0.99999988}, {-0.37646192, 0.92643207}, {0.07833092, 0.99692744}, {0.27079800, -0.96263617}, {0.51630330, 0.85640579}, {0.10252942, 0.99473000}, {0.91395217, -0.40582195}, {0.92558479, -0.37854028}, {0.88563478, -0.46438244}, {0.18693782, -0.98237175}, {-0.70262295, -0.71156234}, {-0.51182497, -0.85908979}, {0.23634185, -0.97166997}, {0.81059003, -0.58561403}, {0.63049251, -0.77619535}, {-0.75650966, 0.65398252}, {0.74529839, 0.66673106}, {0.26910993, -0.96310949}, {0.71954864, -0.69444209}, {0.07009745, 0.99754018}, {-0.97270125, -0.23206080}, {0.50563556, -0.86274719}, {0.58366841, 0.81199211}, {0.83095396, -0.55634117}, {0.01352569, 0.99990851}, {-0.87919885, 0.47645503}, {0.99965268, 0.02635334}, {-0.99140215, -0.13085032}, {0.97530252, 0.22087330}, {-0.25496599, 0.96695000}, {0.96765244, 0.25228706}, {-0.58737850, -0.80931234}, {0.15570256, -0.98780400}, {-0.73195118, -0.68135709}, {0.37500644, 0.92702222}, {0.57985753, -0.81471789}, {0.71076804, -0.70342648}, {-0.96207726, -0.27277714}, {-0.40799239, 0.91298532}, {-0.98403704, -0.17796387}, {-0.99441880, 0.10550475}, {-0.33979601, 0.94049919}, {-0.18089604, 0.98350221}, {0.32442003, -0.94591314}, {-0.37313366, -0.92777759}, {-0.77027148, -0.63771611}, {-0.29764029, 0.95467806}, {0.83359671, -0.55237359}, {-0.34864902, 0.93725336}, {-0.40747541, 0.91321617}, {0.98680174, 0.16193292}, {0.67748535, 0.73553628}, {-0.94825089, 0.31752196}, {0.98156494, -0.19112906}, {-0.99679643, 0.07998058}, {0.66732830, 0.74476367}, {-0.60069263, 0.79948008}, {0.99677688, 0.08022382}, {0.20348124, 0.97907883}, {-0.79231882, 0.61010730}, {-0.93038833, 0.36657545}, {0.53123105, 0.84722698}, {-0.65440601, -0.75614339}, {0.91592389, -0.40135205}, {0.95273030, -0.30381730}, {-0.45921606, -0.88832462}, {0.44034377, -0.89782923}, {-0.20297389, -0.97918415}, {0.26881149, -0.96319282}, {-0.75193030, -0.65924263}, {-0.02821235, -0.99960196}, {-0.33456406, 0.94237304}, {0.79817128, 0.60243058}, {-0.90266556, -0.43034276}, {0.94369537, -0.33081567}, {0.01711884, -0.99985343}, {0.76552695, 0.64340383}, {0.88111371, -0.47290450}, {-0.64172804, 0.76693231}, {-0.79118174, -0.61158115}, {-0.99138564, -0.13097531}, {-0.14565030, 0.98933613}, {0.19813287, -0.98017520}, {0.53337479, 0.84587902}, {-0.31869012, -0.94785899}, {0.99375761, 0.11156075}, {-0.99210984, 0.12537180}, {-0.95052242, -0.31065586}, {0.17631327, 0.98433411}, {-0.84576362, -0.53355783}, {0.92182785, 0.38759953}, {-0.10892888, 0.99404955}, {-0.16415380, 0.98643476}, {0.56616384, 0.82429272}, {0.99997413, 0.00719029}, {-0.26747081, -0.96356595}, {0.73350811, -0.67968065}, {0.39142680, -0.92020923}, {-0.99869627, -0.05104639}, {0.76019335, 0.64969695}, {-0.17817469, 0.98399889}, {0.89219487, 0.45165062}, {0.89276189, 0.45052880}, {0.80801111, -0.58916724}, {-0.13374057, 0.99101639}, {-0.47608444, -0.87939960}, {0.37325606, 0.92772835}, {0.77040845, -0.63755065}, {-0.20146832, -0.97949505}, {0.28041351, 0.95987928}, {-0.99689984, 0.07868132}, {-0.46270278, 0.88651347}, {0.96922076, 0.24619325}, {0.22399479, 0.97459036}, {-0.94760865, -0.31943357}, {0.99490923, -0.10077542}, {0.46950445, -0.88293010}, {0.24761251, 0.96885914}, {-0.79888099, 0.60148913}, {-0.73660427, 0.67632401}, {0.67205542, -0.74050081}, {-0.80181241, -0.59757578}, {0.46737334, -0.88406003}, {-0.85125828, 0.52474689}, {0.87088209, 0.49149203}, {-0.99896610, 0.04546126}, {0.27458206, 0.96156365}, {-0.97570574, 0.21908513}, {-0.91761667, -0.39746657}, {0.83125126, -0.55589682}, {0.15206116, -0.98837107}, {-0.75185019, -0.65933394}, {-0.82988161, 0.55793953}, {0.14535359, -0.98937976}, {0.71680695, -0.69727170}, {-0.49002409, 0.87170887}, {-0.19496019, -0.98081118}, {-0.60851407, 0.79354310}, {-0.82809472, 0.56058824}, {0.99819553, 0.06004707}, {-0.95354825, -0.30124027}, {0.72077185, 0.69317240}, {-0.99718821, 0.07493810}, {0.16374394, -0.98650289}, {0.79136831, 0.61133969}, {0.94211322, -0.33529484}, {0.92798924, 0.37260696}, {-0.54992378, 0.83521485}, {0.18298979, 0.98311484}, {-0.25776315, 0.96620816}, {0.99543887, 0.09540171}, {-0.82013196, -0.57217437}, {-0.65503788, 0.75559604}, {0.02790532, -0.99961054}, {0.41945058, -0.90777814}, {0.03796763, 0.99927896}, {0.29869023, 0.95435011}, {0.99123132, -0.13213803}, {-0.09987791, 0.99499971}})}
},
}, {epsilon = radio.platform.features.liquid and 5e-3 or 5e-5})
|
local rules = {}
local rulesFile = utils.read_file("rules.json")
if rulesFile == nil or string.len( rulesFile ) == 0 then
util.print("Error: rules.json is empty!")
else
-- expose rules
rules.settings = json.decode(rulesFile)
end
function rules.getNumRules()
if rules.settings.rules ~= nil then
return utils.getTableSize(rules.settings.rules)
end
return 0
end
function rules.getRules()
return rules.settings.rules
end
function rules.getRule(index)
if rules.settings.rules ~= nil then
return rules.settings.rules[index].rule
end
return nil
end
return rules
|
local d=game:GetObjects("rbxassetid://520998")[1]local _a={}
for ba,ca in pairs(d:GetChildren())do table.insert(_a,ca)end;local aa=Instance.new("Model")aa.Name="DZxDz"
aa.Parent=workspace;math.randomseed(tick())
function cs()
local ba=game.Players:GetChildren()
for i=1,#ba do
if workspace:FindFirstChild(ba[i].Name)then
local ca=Instance.new("Part")ca.Parent=workspace.DZxDz;ca.Name="nzxkcd"
ca.Anchored=true;ca.Locked=true;ca.CanCollide=false;ca.Transparency=1
ca.CFrame=
CFrame.new(workspace:FindFirstChild(ba[i].Name).Torso.Position)+Vector3.new(0,100,0)
delay(math.random(0.5,1.5),function()while wait(0.42)do sz(ca)end end)local da={}for i=1,8 do local _b=ca:clone()_b.Parent=workspace.DZxDz
da[i]=_b end
for i=1,#da do
if i==1 then da[i].CFrame=
CFrame.new(ca.Position)+Vector3.new(100,0,0)
local _b=da[i]
delay(math.random(0.5,1.5),function()while wait(0.42)do sz(_b)end end)elseif i==2 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(0,0,100)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)elseif i==3 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(-100,0,0)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)elseif i==4 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(0,0,-100)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)elseif i==5 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(100,0,100)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)elseif i==6 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(-100,0,100)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)elseif i==7 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(100,0,-100)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)elseif i==8 then
da[i].CFrame=CFrame.new(ca.Position)+Vector3.new(-100,0,-100)local _b=da[i]
delay(math.random(0.5,1.5),function()
while wait(0.42)do sz(_b)end end)end end end end end;cs()function sz(ba)
local ca=_a[math.random(1,#_a)]:Clone()ca.Parent=workspace.DZxDz
ca:MoveTo(ba.Position)end
|
local tabnine = require('cmp_tabnine.config')
tabnine:setup({
max_lines = 1000;
max_num_results = 20;
sort = true;
run_on_every_keystroke = true;
snippet_placeholder = '..';
ignored_file_types = { -- default is not to ignore
-- uncomment to ignore in lua:
-- lua = true
};
})
|
base_build = nil
base_build = {}
local temp_bld_1 =
{
Type = Ship,
ThingToBuild = "Hgn_AssaultCorvette",
RequiredResearch = "",
RequiredShipSubSystems = "CorvetteProduction",
DisplayPriority = 50,
DisplayedName = "$7038",
Description = "$7039"
}
local temp_bld_2 =
{
Type = Ship,
ThingToBuild = "Hgn_PulsarCorvette",
RequiredResearch = "",
RequiredShipSubSystems = "CorvetteProduction",
DisplayPriority = 51,
DisplayedName = "$7040",
Description = "$7041"
}
local temp_bld_3 =
{
Type = Ship,
ThingToBuild = "Hgn_MinelayerCorvette",
RequiredResearch = "GraviticAttractionMines",
RequiredShipSubSystems = "CorvetteProduction",
DisplayPriority = 52,
DisplayedName = "$7042",
Description = "$7043"
}
local temp_bld_4 =
{
Type = SubSystem,
ThingToBuild = "Hgn_MS_Production_Corvette",
RequiredResearch = "",
RequiredFleetSubSystems = "Research",
DisplayPriority = 0,
DisplayedName = "$7002",
Description = "$7003"
}
local temp_bld_5 =
{
Type = SubSystem,
ThingToBuild = "Hgn_C_Production_Corvette",
RequiredResearch = "",
RequiredFleetSubSystems = "Research",
DisplayPriority = 0,
DisplayedName = "$7002",
Description = "$7003"
}
local temp_params = {"hyp"}
MultiBuild(temp_bld_1, temp_params)
MultiBuild(temp_bld_2, temp_params)
MultiBuild(temp_bld_3, temp_params)
local temp_params = {"rch"}
MultiBuild(temp_bld_4, temp_params)
MultiBuild(temp_bld_5, temp_params)
for i, e in base_build do
build[bld_index] = e
bld_index = bld_index + 1
end
base_build = nil
|
LifestyleLayer = Layer:extend()
function LifestyleLayer:new()
LifestyleLayer.super.new(self)
self.layer_name = "LifestyleLayer"
self.propagate_input_to_underlying = false
end
function LifestyleLayer:draw(dt)
-- bg
local bgc = constants.dark_bg_color
love.graphics.setColor(bgc.r, bgc.g, bgc.b, 0.5)
love.graphics.rectangle("fill", 0, 0, 1280, 720)
end
function LifestyleLayer:keypressed(key, scancode, isrepeat)
if isrepeat == true then
return
end
if key == layer_manager.controls["Back"] then
layer_manager:remove_first()
end
end
|
--
--
-- ----------------------------------------------------------
-- Mosaic | OF Visual Patching Developer Platform
--
-- Copyright (c) 2019 Emanuele Mazza aka n3m3da
--
-- Mosaic is distributed under the MIT License. This gives everyone the
-- freedoms to use Mosaic in any context: commercial or non-commercial,
-- public or private, open or closed source.
--
-- See https://github.com/d3cod3/Mosaic for documentation
-- ----------------------------------------------------------
--
--
-- MosaicDataInlet.lua: A basic template script for receiving the vector data
-- (the "lua script" object inlet) from Mosaic patch
--
-- you can try running this script in patch example: examples/visualprogramming/Structure/DataVectorComposer.xml
--
-- variables for mouse interaction
mouseX = 0
mouseY = 0
-- _mosaic_data_inlet is the name of the lua table storing data incoming from a Mosaic patch
-- a vector<float> is automatically converted to a lua table, where the index starts from 1, NOT 0
-- so the first position of your table will be accessed like this: _mosaic_data_inlet[1]
tableSize = 0
lastTableSize = 0
----------------------------------------------------
function setup()
end
----------------------------------------------------
function update()
----------------------------------------- RECEIVING vector<float> from MOSAIC PATCH
-- avoid null readings
if next(_mosaic_data_inlet) == nil then
return
end
-----------------------------------------
end
----------------------------------------------------
function draw()
of.setColor(0,0,0,10)
of.drawRectangle(0,0,OUTPUT_WIDTH,OUTPUT_HEIGHT)
--of.background(0,0,0)
of.setCircleResolution(50)
----------------------------------------- RECEIVING vector<float> from MOSAIC PATCH
-- avoid null readings
if next(_mosaic_data_inlet) == nil then
return
end
-- get _mosaic_data_inlet size
tableSize = 0
for k,v in pairs(_mosaic_data_inlet) do
tableSize = tableSize + 1
end
-- check _mosaic_data_inlet size changes
if lastTableSize ~= tableSize then
lastTableSize = tableSize
of.log(of.LOG_NOTICE,string.format("_mosaic_data_inlet size: %i",tableSize))
end
-----------------------------------------
-- draw something using _mosaic_data_inlet data
of.setColor(255,255,255,10)
if tableSize > 1 then
of.pushMatrix()
of.translate(OUTPUT_WIDTH/2,OUTPUT_HEIGHT/2,0)
of.drawCircle(0,0,_mosaic_data_inlet[1]*OUTPUT_HEIGHT/2)
of.popMatrix()
end
end
----------------------------------------------------
function exit()
end
-- input callbacks
----------------------------------------------------
function keyPressed(key)
end
function keyReleased(key)
end
function mouseMoved(x,y)
mouseX = x
mouseY = y
end
function mouseDragged(x,y)
mouseX = x
mouseY = y
end
function mouseReleased(x,y)
end
function mouseScrolled(x,y)
end
|
--------------------------------
-- @module ParticleFireworks
-- @extend ParticleSystemQuad
-- @parent_module cc
---@class cc.ParticleFireworks:cc.ParticleSystemQuad
local ParticleFireworks = {}
cc.ParticleFireworks = ParticleFireworks
--------------------------------
---
---@return boolean
function ParticleFireworks:init()
end
--------------------------------
---
---@param numberOfParticles number
---@return boolean
function ParticleFireworks:initWithTotalParticles(numberOfParticles)
end
--------------------------------
--- Create a fireworks particle system.
--- return An autoreleased ParticleFireworks object.
---@return cc.ParticleFireworks
function ParticleFireworks:create()
end
--------------------------------
--- Create a fireworks particle system withe a fixed number of particles.
--- param numberOfParticles A given number of particles.
--- return An autoreleased ParticleFireworks object.
--- js NA
---@param numberOfParticles number
---@return cc.ParticleFireworks
function ParticleFireworks:createWithTotalParticles(numberOfParticles)
end
--------------------------------
--- js ctor
---@return cc.ParticleFireworks
function ParticleFireworks:ParticleFireworks()
end
return nil
|
local lang = require 'lang'
local pairs = pairs
local type = type
local w2l
local function has_slk(w2l)
for _, name in ipairs(w2l.info.txt) do
if w2l:file_load('map', name) then
return true
end
end
for _, slks in pairs(w2l.info.slk) do
for _, name in ipairs(slks) do
if w2l:file_load('map', name) then
return true
end
end
end
if w2l:file_load('map', 'war3mapmisc.txt') then
return true
end
return false
end
local function load_slk(w2l)
if w2l.force_slk then
w2l.messager.report(lang.report.OTHER, 9, lang.report.FORCE_READ_SLK)
end
if (w2l.force_slk or w2l.setting.read_slk) and has_slk(w2l) then
return w2l:frontend_buildslk(true)
else
return w2l:get_default(true)
end
end
local function load_obj(w2l, wts)
local objs = {}
local count = 0
for _, type in ipairs {'ability', 'buff', 'unit', 'item', 'upgrade', 'doodad', 'destructable', 'misc'} do
local name = w2l.info.obj[type]
local buf = w2l:file_load('map', name)
local count = count + 1
if buf then
w2l.messager.text(lang.script.CONVERT_ONE .. name)
objs[type] = w2l:frontend_obj(type, buf, wts)
w2l.progress(count / 8)
end
end
return objs
end
local function load_lni(w2l)
local lnis = {}
local count = 0
for type, name in pairs(w2l.info.lni) do
count = count + 1
local buf = w2l:file_load('table', type)
if buf then
w2l.messager.text(lang.script.CONVERT_ONE .. type)
lnis[type] = w2l:frontend_lni(type, buf, type)
w2l.progress(count / 8)
end
end
local buf = w2l:file_load('table', 'txt')
if buf then
lnis['txt'] = w2l:parse_lni(buf, 'txt')
end
return lnis
end
local function load_w3i(w2l, slk)
local buf = w2l:file_load('table', 'w3i')
if buf then
return w2l:parse_lni(buf, 'w3i')
else
buf = w2l:file_load('map', 'war3map.w3i')
if buf then
return w2l:frontend_w3i(buf, slk.wts)
end
end
return nil
end
local function update_version(w2l, w3i)
if not w3i then
return
end
local melee = w3i[lang.w3i.CONFIG][lang.w3i.MELEE_MAP]
local set = w3i[lang.w3i.CONFIG][lang.w3i.GAME_DATA_SETTING]
if set == -1 or set == 0 then
if melee == 0 then
w2l.setting.version = 'Custom'
elseif melee == 1 then
w2l.setting.version = 'Melee'
end
elseif set == 1 then
w2l.setting.version = 'Custom'
elseif set == 2 then
w2l.setting.version = 'Melee'
end
w2l:set_setting(w2l.setting)
end
local displaytype = {
unit = lang.script.UNIT,
ability = lang.script.ABILITY,
item = lang.script.ITEM,
buff = lang.script.BUFF,
upgrade = lang.script.UPGRADE,
doodad = lang.script.DOODAD,
destructable = lang.script.DESTRUCTABLE,
}
local function get_displayname(o)
local name
if o._type == 'buff' then
name = o.bufftip or o.editorname
elseif o._type == 'upgrade' then
name = o.name[1]
elseif o._type == 'doodad' or o._type == 'destructable' then
name = w2l:get_editstring(o.name or '')
else
name = o.name
end
if not name then
return ''
end
return (name:sub(1, 100):gsub('\r\n', ' '))
end
local function is_usable_id(str)
if str:find '[^%w_]' then
return false
end
return true
end
local function mark_keep_obj_before_merge(type, objs)
if type == 'ability' then
for id, obj in pairs(objs) do
for k in pairs(obj) do
if k:sub(1, 1) ~= '_' then
goto CONTINUE
end
end
obj._keep_obj = true
w2l.messager.report(lang.report.INVALID_OBJECT, 6, lang.report.ABILITY_REMOVED:format(id), lang.report.ABILITY_REMOVED_HINT)
::CONTINUE::
end
end
end
local function mark_keep_obj_after_merge(type, objs)
local used = {}
for id, obj in pairs(objs) do
local lid = id:lower()
if used[lid] then
obj._keep_obj = true
objs[used[lid]]._keep_obj = true
local name1 = get_displayname(obj)
local name2 = get_displayname(objs[used[lid]])
w2l.messager.report(lang.report.WARN, 2, (lang.report.OBJECT_ID_CONFLICT):format(id), ('`%s`[%s] --> `%s`[%s]'):format(id, name1, used[lid], name2))
elseif not is_usable_id(id) then
obj._keep_obj = true
local name = get_displayname(obj)
w2l.messager.report(lang.report.WARN, 2, ("%s %s %s"):format(type, id, name), ('%s %s'):format(lang.report.OBJECT_ID_CAN_CONVERT_NUMBER, ''))
else
used[lid] = id
end
end
end
local function update_then_merge(w2l, slks, objs, lnis, slk)
for _, type in ipairs {'ability', 'buff', 'unit', 'item', 'upgrade', 'doodad', 'destructable', 'misc', 'txt'} do
local report, report2
local data = slks[type]
local obj = objs[type]
if obj then
if type ~= 'misc' then
report, report2 = w2l:frontend_updateobj(type, obj, data)
end
else
obj = {}
end
if lnis[type] then
w2l:frontend_updatelni(type, lnis[type], data)
for k, v in pairs(lnis[type]) do
obj[k] = v
end
end
if w2l.setting.mode == 'slk' then
mark_keep_obj_before_merge(type, obj)
end
slk[type] = w2l:frontend_merge(type, data, obj)
if w2l.setting.mode == 'slk' then
mark_keep_obj_after_merge(type, slk[type])
end
if report then
for i = 1, 10 do
local data = report[i]
if not data then
break
end
local displayname = get_displayname(slk[type][data[1]])
w2l.messager.report(lang.report.INVALID_OBJECT_DATA, 6, ('%s %s %s'):format(displaytype[type], data[1], displayname), ('[%s]: %s'):format(data[2], data[3]))
end
end
if report2 then
for i = 1, 10 do
if not report2[i] then
break
end
w2l.messager.report(lang.report.INVALID_OBJECT_DATA, 6, report2[i][1], report2[i][2])
end
end
end
end
return function(w2l_, slk)
w2l = w2l_
slk = slk or {}
w2l.slk = slk
--读取字符串
slk.wts = w2l:frontend_wts(w2l:file_load('map', 'war3map.wts'))
w2l.progress(0.2)
slk.w3i = load_w3i(w2l, slk)
update_version(w2l, slk.w3i)
w2l.messager.text(lang.script.LOAD_OBJ)
w2l.progress:start(0.4)
local objs = load_obj(w2l, slk.wts)
w2l.progress:finish()
w2l.messager.text(lang.script.LOAD_LNI)
w2l.progress:start(0.6)
local lnis = load_lni(w2l)
w2l.progress:finish()
w2l.messager.text(lang.script.LOAD_SLK)
w2l.progress:start(0.8)
local slks = load_slk(w2l)
w2l.progress:finish()
w2l.messager.text(lang.script.MERGE_OBJECT)
w2l.progress:start(1)
update_then_merge(w2l, slks, objs, lnis, slk)
w2l.progress:finish()
w2l.messager.text(lang.script.DO_PLUGIN)
w2l:call_plugin('on_full')
if w2l.setting.extra_check then
w2l:frontend_extracheck(slk)
end
end
|
-- This resource is part of the default Cfx.re asset pack (cfx-server-data)
-- Altering or recreating for local use only is strongly discouraged.
version '1.0.0'
author 'Cfx.re <root@cfx.re>'
description 'Example loading screen.'
repository 'https://github.com/citizenfx/cfx-server-data'
files {
'index.html',
'keks.css',
'bankgothic.ttf',
'loadscreen.jpg'
}
loadscreen 'index.html'
fx_version 'bodacious'
game 'gta5'
|
nagnang_compass = {
use = function(player)
local baseMap = getNagnangShieldQuestBaseMap(player)
local t = {graphic = convertGraphic(715, "item"), color = 0}
player:sendMinitext("You cast Find path.")
if player.m == baseMap then
player:dialogSeq({t, "The needle points to the east."}, 0)
elseif player.m == baseMap + 1 then
player.quest["used_compass"] = 1
player:dialogSeq({t, "The needle points to the east."}, 0)
elseif player.m == baseMap + 2 then
player:dialogSeq({t, "The needle points to the west."}, 0)
elseif player.m == baseMap + 3 then
player:dialogSeq({t, "The needle points to the west."}, 0)
elseif player.m == baseMap + 4 then
player:dialogSeq({t, "The needle points to the south."}, 0)
elseif player.m == baseMap + 5 then
player:dialogSeq({t, "The needle points to the north."}, 0)
else
player:dialogSeq({t, "The needle points to Nagnang."}, 0)
end
end
}
|
local Object = require("plenary.class")
local Relation = Object:extend()
function Relation:new(filetypes, related_to, condition, opts)
assert(type(filetypes) == "table", "filetypes should be a table")
assert(type(related_to) == "function", "related_to should be a function")
assert(type(condition) == "function" or condition == nil, "condition should be a function or nil")
assert(type(opts) == "table" or opts == nil, "Opts should be a table or nil")
return setmetatable({
filetypes = filetypes,
related_to = related_to,
condition = condition or nil,
opts = opts or nil,
}, self)
end
function Relation:filetype_matches(ft)
return vim.tbl_isempty(self.filetypes) or vim.tbl_contains(self.filetypes, ft)
end
function Relation:should_run(bufnr)
return self.condition == nil or self.condition(bufnr)
end
function Relation:resolve(bufnr)
return self.related_to(bufnr, self.opts) or {}
end
return Relation
|
--@name RT Camera
--@author Vurv
--@client
--@model models/dav0r/camera.mdl
-- Author -- Vurv
-- Source -- https://github.com/Vurv78/starfallex-creations
-- Purpose -- This is a starfall chip that works just like an RT camera, except you can configure the resolution, field of view/zooming, frames per second and more.
-- Tbh, It feels less laggier than actual RT Cameras and has better quality. You can have multiple of these placed down, they will share cpu but not really well after the second camera.
-- Disabled by default to prevent lag
-- Configs --
local FPS = 60 -- Frames per second
local FOV = 130
local Res = Vector(1024,1024) -- Default = 1024,1024 (This is the highest res you can get)
local AntiAliasing = true -- Whether to use anti-aliasing in the render
local Enabled = true -- Whether to see the camera by default when Enabled (for owner)
-- Configs --
-- Local vars to optimize stuff.
local localplayer = player() if localplayer ~= owner() then Enabled = false end
local deltatime = 0
local fpsdelta = 1/FPS
local fpstime = timer.curtime()
local Chip = chip()
local ScaleMatrix = Matrix()
ScaleMatrix:setScale(1024/Res)
-- Localized functions for functions that'll be called often
local math = math
local render = render
local selectRenderTarget = render.selectRenderTarget
local renderViewsLeft = render.renderViewsLeft
local floor = math.floor
local min = math.min
local curtime = timer.curtime
local drawTexturedRect = render.drawTexturedRect
local pushMatrix = render.pushMatrix
local setRGBA = render.setRGBA
local drawText = render.drawText
local setMaterial = render.setMaterial
local renderView = render.renderView
local isInRenderView = render.isInRenderView
local popMatrix = render.popMatrix
local setFilterMag = render.setFilterMag
render.createRenderTarget("rt")
-- We need a separate material so that the screen doesn't go black sometimes.
local rtMat = material.create("gmodscreenspace")
rtMat:setTextureRenderTarget("$basetexture", "rt")
local RequestingFrames = true -- So we only render the camera when we are looking at the screen
hook.add("renderscene","",function(origin,angles,fov)
-- Fps checking
if not RequestingFrames then return end
RequestingFrames = false
if not Enabled then return end
if quotaTotalAverage()>quotaMax()*0.5 then return end -- Additional check so that people don't die from quota
local time = curtime()
if time < fpstime + fpsdelta then return end
deltatime = time-fpstime
fpstime = time
if renderViewsLeft()<1 then print("No renderviews left") return end
selectRenderTarget("rt")
if isInRenderView() then
drawText(256,256,"No Infinite Loop Pl0x",1)
selectRenderTarget()
return
end
renderView{
origin = Chip:localToWorld(Vector(10,0,0)),
x = 0,
y = 0,
w = Res.x,
h = Res.y,
fov=FOV,
angles=Chip:getAngles(),
drawviewer = true,
}
selectRenderTarget()
end)
hook.add("starfallUsed","",function(ply)
if localplayer ~= ply then return end
Enabled = not Enabled
end)
hook.add("render","",function()
RequestingFrames = true
setMaterial(rtMat)
pushMatrix(ScaleMatrix)
setRGBA(255,255,255,255)
setFilterMag(AntiAliasing and 0 or 1)
drawTexturedRect(0,0,512,512)
popMatrix()
if not Enabled then
-- It's not in the beginning so we can still see the frame before atleast.
setRGBA(255,255,0,255)
drawText(256,256,"Press E to See RT Camera",1)
return
end
drawText(0,0,"FPS: " .. min(floor(1/deltatime),60) .. "/" .. FPS)
end)
|
--[[
module: StudentDaoImpl
author: DylanYang
time: 2021-02-24 22:15:20
idea:
advance:
]]
local Student = require("patterns.j2ee.dataAccessObject.Student")
local interface = require("patterns.j2ee.dataAccessObject.IStudentDao")
local _M = Class("StudentDaoImpl", interface)
local public = _M.public
--The following list is used as a database.
_M.students = {}
function _M:ctor()
local student1 = Student.new("Robert", 1)
local student2 = Student.new("John", 2)
table.insert(self.students, student1)
table.insert(self.students, student2)
end
function public:GetAllStudents()
return self.students
end
function public:GetStudent(rollNo)
return self.students[rollNo]
end
function public:UpdateStudent(student)
--This code can't do a real simulation.
self.students[student.rollNo].name = student.name
print(string.format("Student: Roll No %s, updated in the database", student.rollNo))
end
function public:DeleteStudent(student)
table.removeItem(self.students, student)
print(string.format("Student: Roll No %s, deleted from database.", student.rollNo))
end
return _M
|
--[[
################################################################################
#
# Copyright (c) 2014-2019 Ultraschall (http://ultraschall.fm)
#
# 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.
#
################################################################################
]]
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
-- Defer1: Soundcheck Daemon
-- Defer2: Samplerate
-- Defer3: Unsaved
---------------------------------------------------------------
-- Soundcheck Unsaved
-- Wenn ein Recording gestartet wird wird geprüft, ob das Projekt schon gespeichert wurde
---------------------------------------------------------------
function soundcheck_unsaved()
-- print(reaper.GetPlayStateEx(0))
--print(reaper.IsProjectDirty(0))
if reaper.IsProjectDirty(0) and reaper.GetPlayStateEx(0) > 4 then -- das Projekt wurde noch nicht gespeichertund es läuft oder pausiert ein recording
if tonumber(reaper.GetExtState ("soundcheck_timer", "unsaved"))+120 < reaper.time_precise() then
soundcheck_unsaved_action()
end
end
retval, defer3_identifier = ultraschall.Defer(soundcheck_unsaved, ultraschall.ScriptIdentifier..".defer_script03", 2, 3)
end
function soundcheck_unsaved_action()
-- print("noch da")
return_value = ultraschall.MB("Your project has not been saved yet. It is strongly advised to save it before starting a recording.", "WARNING - Ultraschall Soundcheck",3, "Save as", "Ignore", "Settings")
if return_value == 3 then
reaper.SetExtState("soundcheck_timer", "unsaved", tostring(reaper.time_precise()), false)
reaper.Main_OnCommand(reaper.NamedCommandLookup("_Ultraschall_Settings"),0) -- öffne Ultraschall Settings
elseif return_value == 2 then
reaper.SetExtState("soundcheck_timer", "unsaved", tostring(reaper.time_precise()), false)
reaper.Main_OnCommand(40022,0) -- öffne den Speichern unter Dialog
end
end
function soundcheck_unsaved_controller()
if ultraschall.GetUSExternalState("ultraschall_settings_unsaved", "value") == "0" then
-- Soundcheck ist in den Settings deaktiviert
if reaper.GetExtState("ultraschall", ultraschall.ScriptIdentifier..".defer_script03") == "running" then
retval = ultraschall.StopDeferCycle(defer3_identifier)
end
else -- Soundcheck ist in den Settings aktiviert
if reaper.GetExtState("ultraschall", ultraschall.ScriptIdentifier..".defer_script03") ~= "running" then
soundcheck_unsaved()
end
end
end
-------------------------------------------------------------------------------------
-- Soundcheck Samplerate
-- muss 48 KHz sein wenn mindestens eine StudioLink Spur im Projekt ist
-------------------------------------------------------------------------------------
function soundcheck_samplerate()
retval, actual_samplerate = reaper.GetAudioDeviceInfo("SRATE", "")
-- print("noch da")
for i=1, reaper.CountTracks(0) do
if (ultraschall.IsTrackStudioLink(i) or ultraschall.IsTrackStudioLinkOnAir(0)) and actual_samplerate == "48000" then -- es gibt mindestens eine StudioLink Spur und Samplerate steht nicht auf 48000
if tonumber(reaper.GetExtState ("soundcheck_timer", "samplerate"))+120 < reaper.time_precise() then
soundcheck_samplerate_action()
-- print(actual_samplerate)
break
end
end
end
retval, defer2_identifier = ultraschall.Defer(soundcheck_samplerate, ultraschall.ScriptIdentifier..".defer_script02", 2, 3)
end
function soundcheck_samplerate_action()
return_value = ultraschall.MB("Your samplerate is set to please set to 48000", "WARNING - Ultraschall Soundcheck",3, "gut", "ach nein", "blafasel")
if return_value == 3 then
reaper.SetExtState("soundcheck_timer", "samplerate", tostring(reaper.time_precise()), false)
reaper.Main_OnCommand(reaper.NamedCommandLookup("_Ultraschall_Settings"),0) -- öffne Ultraschall Settings
elseif return_value == 2 then
reaper.SetExtState("soundcheck_timer", "samplerate", tostring(reaper.time_precise()), false)
reaper.Main_OnCommand(40099,0) -- öffne Audio device Settings
end
end
function soundcheck_samplerate_controller()
if ultraschall.GetUSExternalState("ultraschall_settings_samplerate", "value") == "0" then
-- Soundcheck ist in den Settings deaktiviert
if reaper.GetExtState("ultraschall", ultraschall.ScriptIdentifier..".defer_script02") == "running" then
retval = ultraschall.StopDeferCycle(defer2_identifier)
end
else -- Soundcheck ist in den Settings aktiviert
if reaper.GetExtState("ultraschall", ultraschall.ScriptIdentifier..".defer_script02") ~= "running" then
soundcheck_samplerate()
end
end
end
--------------------
function soundcheck_main()
soundcheck_samplerate_controller()
soundcheck_unsaved_controller()
retval, defer1_identifier = ultraschall.Defer(soundcheck_main, ultraschall.ScriptIdentifier..".defer_script01", 2, 1)
end
-- soundcheck_samplerate_action ()
-- initialise variables
reaper.SetExtState("soundcheck_timer", "samplerate", "0", false)
reaper.SetExtState("soundcheck_timer", "unsaved", "0", false)
-- print(ultraschall.GetApiVersion())
-- print(reaper.IsProjectDirty(0))
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
retval = ultraschall.WriteValueToFile(ultraschall.API_TempPath.."/Tudelu.txt", "Dingodongo")
ultraschall.ShowLastErrorMessage()
-- return_value2 = ultraschall.MB("Your samplerate is set to please set to 48000b", "WARNING - Ultraschall Soundcheck",3, "gut", "ach", "blafasel")
soundcheck_main()
|
#!/usr/bin/env lua
-- MIT license
-- Goal: computational experiment toolbox : cet (gsl)
-- l. gsl
-- - la: linear algebra (blas-lapack-atlas)
-- - statistics
-- func: special functions
-- binom
-- multinom
-- normal
-- hermite
-- gamma
-- beta
-- bessel
-- laguerre
-- legendre
-- sph: spheric harmonic
-- poisson
-- doc: brief usage summary
-- 2. document (tex/markdown)
-- 3. wedget -> moonFLTK
-- - audio/video
-- - 2D/3D
-- - network (SSL)
-- - documentation
-- 4. network / parallel
-- 5. PETSc
-- - SLEPc --> C++
-- 6. alg: symbolic (Maxima)
-- 7. sqlite
-- ref:
-- GSL shell: http://www.nongnu.org/gsl-shell/#
-- https://www.gnu.org/software/gsl/doc/html/intro.html
-- Lua graph-toolkit: https://github.com/franko/graph-toolkit
-- https://en.wikipedia.org/wiki/List_of_numerical_libraries
-- =============================================================== --
-- computational experiment toolbox : cet (gsl)
-- func: special functions
-- binom
-- multinom
-- normal
-- hermite
-- gamma
-- beta
-- bessel
-- laguerre
-- legendre
-- sph: spheric harmonic
-- poisson
-- doc: brief usage summary
-- la: linear algebra (blas-lapack-atlas)
-- stat: statistics
-- z: complex number
-- alg: symbolic
--
-- implementation:
-- - wedget -> fltk
-- - template
-- - table -> require 'cet' {}
-- - audio/video
-- - 2D/3D
-- - c/c++ api
-- - network (SSL)
-- - documentation
--
-- sql: database
-- chem: chemical
-- high: high energy
-- cm: condense matter
-- fdm:
-- fem:
-- fvm:
-- cfd: compuational fluid dynamics
-- pde:
-- =============================================================== --
-- widget (sub)
-- ├─ box (sub)
-- ├─ button (sub)
-- │ ├─ light_button
-- │ │ ├─ check_button
-- │ │ ├─ radio_light_button
-- │ │ └─ round_button
-- │ │ └─ radio_round_button
-- =============================================================== --
local cetcore = require 'cetcore' -- math obj
local class = require 'pool'
local cet = {}
local cetmeta = {
qtrn = cetcore.qtrn; -- complex or quaternion
colvec = cetcore.colvec; -- vector (column vector)
rowvec = cetcore.rowvec; -- vector (row vector)
matrix = cetcore.matrix; -- matrix -- b = cet.spm() -- sparse matrix
domain = cetcore.domain; -- cw complex space
tensor = cetcore.tensor; -- tensor field on domain
--- use luadoc
help = function (cmd)
end;
gui = class {
wgt = false;
['<'] = function (o, workbench)
-- if workbench then o.wgt = gui(workbench) end
end;
{ -- data/gui operation
__add = function (o1, o2) -- dock o2 to o1
end;
}
};
}
setmetatable(cet, {
__index = cetmeta;
__metatable = true;
})
-- position/numerical index
z = cet.qtrn(0, 1) -- complex
-- q = cet.qtn(0, 1, 0, 0) -- quaternion
-- a = cet.vec() -- vector (row vector)
-- b = cet.mat() -- matrix
-- c = cet.tsr() -- tensor
-- b = cet.spm() -- sparse matrix
-- rawget / rawset -- file: reader/writer binary: load/dump
-- z.Re, z.Im
-- q[0] = 1; q[1] = 2; q[2] = 3; a[3] = 4 -- index 1 to n
return cet
-- vim: ts=4 sw=4 sts=4 et foldenable fdm=marker fmr={{{,}}} fdl=1
|
-- Copyright (c) 2021 IBM Corporation
--
-- 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.
-- configuration for 3D LIDAR + IMU
include "map_builder.lua"
include "trajectory_builder.lua"
options = {
map_builder = MAP_BUILDER,
trajectory_builder = TRAJECTORY_BUILDER,
map_frame = "map",
tracking_frame = "imu_frame",
published_frame = "base_link",
odom_frame = "odom_cart",
provide_odom_frame = true,
publish_frame_projected_to_2d = false,
use_pose_extrapolator = false,
use_odometry = false,
use_nav_sat = false,
use_landmarks = false,
num_laser_scans = 0,
num_multi_echo_laser_scans = 0,
num_subdivisions_per_laser_scan = 1,
num_point_clouds = 1,
lookup_transform_timeout_sec = 0.2,
submap_publish_period_sec = 0.3,
pose_publish_period_sec = 5e-3,
trajectory_publish_period_sec = 30e-3,
rangefinder_sampling_ratio = 1.,
odometry_sampling_ratio = 1.,
fixed_frame_pose_sampling_ratio = 1.,
imu_sampling_ratio = 1.,
landmarks_sampling_ratio = 1.,
}
MAP_BUILDER.use_trajectory_builder_2d = true
MAP_BUILDER.num_background_threads = 2
-------- tune parameters in the trajectory builder 2D --------
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1
TRAJECTORY_BUILDER_2D.use_imu_data = true
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
-- can limit the search space of the online correlative scan matcher when IMU is available
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.angular_search_window = math.rad(5.) -- default=math.rad(20.),
-- Set min_z and max_z to convert 3D point cloud in 2D localization
TRAJECTORY_BUILDER_2D.min_z = 0.5
TRAJECTORY_BUILDER_2D.max_z = 1.8
-- filter point cloud to improve the realtime computation performance
TRAJECTORY_BUILDER_2D.min_range = 0.4
TRAJECTORY_BUILDER_2D.max_range = 30.0
TRAJECTORY_BUILDER_2D.voxel_filter_size = 0.1 --default=0.025
-- increase this value to put high reliability to lidar data
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.occupied_space_weight = 10.0 --default 1.0
-------- tune parameters in the pose graph --------
-- reduce the frequency of pose graph optimization
-- POSE_GRAPH.optimize_every_n_nodes = 20 - default 20
-- reduce the frequency of local constraint search
POSE_GRAPH.constraint_builder.max_constraint_distance = 5.0 -- default=15.0
POSE_GRAPH.constraint_builder.sampling_ratio = 0.03 -- default=0.3
-- disable global constraint search
POSE_GRAPH.global_sampling_ratio = 0.0 --default=0.003
POSE_GRAPH.global_constraint_search_after_n_seconds = 360000 --default=10
-- decrease these values when the constraint builder cannot find matches between a new trajectory and an old trajectory
-- POSE_GRAPH.constraint_builder.min_score = 0.3 -- cartographer default 0.55
-- POSE_GRAPH.constraint_builder.global_localization_min_score = 0.35 -- cartographer default 0.6
return options
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
ENT.SpawnSound = Sound( "ambient/atmosphere/city_skypass1.wav" )
function ENT:Initialize()
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:DrawShadow( false )
local phys = self.Entity:GetPhysicsObject()
if self.Collides then
self.Entity:SetSolid( SOLID_VPHYSICS )
if IsValid( phys ) then
phys:Wake()
phys:SetMaterial( self.PhysMat )
phys:EnableGravity( false )
end
else
self.Entity:SetSolid( SOLID_NONE )
if IsValid( phys ) then
phys:Wake()
phys:SetMaterial( self.PhysMat )
end
end
self.DieTime = CurTime() + 5
local par = self.Entity:GetTrueParent()
if IsValid( par ) then
if par:GetClass() == "prop_ragdoll" then
self.Bloody = true
par.Cons = {}
table.insert( par.Cons, constraint.Weld( par, self.Entity, 0, 0, 0, true, false ) )
for i=0,16 do
local phys = par:GetPhysicsObjectNum( i )
if IsValid( phys ) then
phys:EnableGravity( false )
phys:Wake()
phys:AddAngleVelocity( VectorRand() * 800 )
//phys:SetMass( 10 )
table.insert( par.Cons, constraint.NoCollide( self.Entity, par, 0, i ) )
end
end
else
local phys = par:GetPhysicsObject()
if IsValid( phys ) then
phys:SetMass( math.Clamp( phys:GetMass(), 100, 5000 ) )
phys:EnableMotion( true )
phys:EnableGravity( false )
phys:Wake()
phys:AddAngleVelocity( VectorRand() * 800 )
end
end
end
self.Entity:EmitSound( self.SpawnSound, 100, math.random( 90, 110 ) )
end
function ENT:SetTrueParent( ent )
self.Entity:SetNWEntity( "TrueParent", ent )
end
function ENT:GetTrueParent()
if IsValid( self.Entity:GetParent() ) then
return self.Entity:GetParent()
elseif IsValid( self.Entity:GetNWEntity( "TrueParent" ) ) then
return self.Entity:GetNWEntity( "TrueParent" )
end
return NULL
end
function ENT:SetCollides( bool )
self.Collides = bool
end
function ENT:SetProp( ent )
self.Prop = ent
end
function ENT:SetMass( mass )
self.Mass = mass
end
function ENT:SetPhysMat( mat )
self.PhysMat = mat
end
function ENT:Think()
local par = self.Entity:GetTrueParent()
if IsValid( par ) then
local phys = par:GetPhysicsObject()
if IsValid( phys ) then
if self.LaunchDir and not self.Launched then
self.Launched = true
phys:EnableGravity( true )
phys:AddAngleVelocity( VectorRand() * self.Mass )
phys:ApplyForceCenter( ( self.Mass * 2500 ) * self.LaunchDir )
if par:GetClass() == "prop_ragdoll" then
for i=0,16 do
phys = par:GetPhysicsObjectNum( i )
if IsValid( phys ) then
phys:EnableGravity( true )
phys:Wake()
end
end
end
if self.Collides then
phys = self.Entity:GetPhysicsObject()
if IsValid( phys ) then
phys:EnableGravity( true )
phys:ApplyForceCenter( ( self.Mass * 9000 ) * self.LaunchDir )
end
end
end
end
end
if self.DieTime < CurTime() or not IsValid( self.Entity:GetTrueParent() ) or not self.Entity:GetOwner():Alive() then
self.Entity:Remove()
end
end
function ENT:SetLaunchTarget( pos )
local dir = ( pos - self.Entity:GetPos() ):GetNormal()
dir.z = math.Clamp( dir.z, -0.5, 1.0 )
self.LaunchDir = dir
self.DieTime = CurTime() + 2
end
function ENT:OnRemove()
local par = self.Entity:GetTrueParent()
if IsValid( par ) then
if par:GetClass() == "prop_ragdoll" then
for k,v in pairs( par.Cons ) do
if IsValid( v ) then
v:Remove()
end
end
end
par.Tele = nil
local phys = par:GetPhysicsObject()
if IsValid( phys ) then
phys:EnableGravity( true )
phys:Wake()
end
end
end
function ENT:OnTakeDamage( dmginfo )
end
function ENT:PhysicsCollide( data, phys )
if self.Collides and data.DeltaTime > 0.15 then
self.Entity:EmitSound( "Flesh.ImpactHard", 100, math.random( 80, 100 ) )
util.Decal( "Blood", data.HitPos + data.HitNormal, data.HitPos - data.HitNormal )
end
end
function ENT:UpdateTransmitState()
return TRANSMIT_ALWAYS
end
|
local execute = vim.api.nvim_command
local g = vim.g
local fn = vim.fn
local pack_path = fn.stdpath('data') .. '/site/pack'
local fmt = string.format
function ensure(user, repo)
local path = fmt('%s/packer/start/%s', pack_path, repo)
if fn.empty(fn.glob(path)) > 0 then
execute(fmt('!git clone git@github.com:%s/%s %s', user, repo, path))
execute(fmt('packadd %s', repo))
end
end
ensure('wbthomason', 'packer.nvim')
ensure('Olical', 'aniseed')
g['aniseed#env'] = {
module = 'bootstrap',
compile = true
}
|
-- ============================= --
-- Copyright 2019 FiatAccompli --
-- ============================= --
-- Code related to Melee Attack interface mode
include ("Civ6Common");
local ATTACK_INTERFACE_MODE = DB.MakeHash("INTERFACEMODE_MELEE_ATTACK");
function GetMeleeAttackPlotIds(unit:table)
if not unit then
return nil;
end
local plots = {};
if not IsMeleeAttackUnit(unit) then
return plots;
end
for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1 do
local adjacentPlot = Map.GetAdjacentPlot(unit:GetX(), unit:GetY(), direction);
if adjacentPlot then
local combatSim = CombatManager.SimulateAttackInto(unit:GetComponentID(), CombatTypes.MELEE, adjacentPlot:GetX(), adjacentPlot:GetY());
if combatSim then
table.insert(plots, adjacentPlot:GetIndex());
end
end
end
return plots
end
function IsMeleeAttackUnit(unit:table)
if not unit then
return false;
end
local unitData = GameInfo.Units[unit:GetUnitType()];
-- Must have movement remaining and be an appropriate type of unit to melee attack.
return unit:GetMovesRemaining() > 0 and
unitData.Combat > 0 and
not (unitData.RangedCombat > 0) and
not (unitData.Bombard > 0) and
(unitData.FormationClass == 'FORMATION_CLASS_LAND_COMBAT' or
unitData.FormationClass == 'FORMATION_CLASS_NAVAL');
end
function EvaluateMeleeAttackAvailability(unit:table, availableActions:table)
if IsMeleeAttackUnit(unit) then
local disabled = #GetMeleeAttackPlotIds(unit) == 0;
availableActions['MOD_KEYBOARD_NAVIGATION_UNITCOMMAND_MELEE_ATTACK'] = { Disabled = disabled };
end
end
function OnUnitActionExecuted(action:string)
print("Action executed: ", action);
end
function OnPlotSelected(interfaceMode:number, plotId:number)
if interfaceMode == ATTACK_INTERFACE_MODE then
local plot = Map.GetPlotByIndex(plotId);
local selectedUnit = UI.GetHeadSelectedUnit();
local attackingPlayerId = selectedUnit:GetOwner();
local unitComponentID:table = selectedUnit:GetComponentID();
local willStartWar = false;
local results = CombatManager.IsAttackChangeWarState(unitComponentID, plotX, plotY);
if results ~= nil and #results > 0 then
willStartWar = true;
end
if willStartWar then
local defendingPlayerId = results[1];
LuaEvents.Civ6Common_ConfirmWarDialog(attackingPlayerId, defendingPlayerId, WarTypes.SURPRISE_WAR);
else
MoveUnitToPlot(selectedUnit, plot:GetX(), plot:GetY());
UI.SetInterfaceMode(InterfaceModeTypes.SELECTION);
--autoMoveKeyboardTargetForAttack:RecordLastTargetPlot(plot);
end
end
end
function OnInterfaceModeChanged(oldMode:number, newMode:number)
if oldMode == ATTACK_INTERFACE_MODE then
UILens.ToggleLayerOff( LensLayers.HEX_COLORING_ATTACK );
UILens.ClearLayerHexes( LensLayers.HEX_COLORING_ATTACK );
end
if newMode == ATTACK_INTERFACE_MODE then
local selectedUnit = UI.GetHeadSelectedUnit();
if (selectedUnit ~= nil) then
targetPlots = GetMeleeAttackPlotIds(selectedUnit);
-- Highlight the plots available to attack
if table.count(targetPlots) ~= 0 then
local localPlayer = Game.GetLocalPlayer();
UILens.ToggleLayerOn(LensLayers.HEX_COLORING_ATTACK);
UILens.SetLayerHexesArea(LensLayers.HEX_COLORING_ATTACK, localPlayer, targetPlots);
-- Register stuff here so it's always guaranteed to be in place regardless of context
-- initialization order (even on hotloads).
LuaEvents.WorldNavigation_RegisterInterfaceModeHandling(ATTACK_INTERFACE_MODE, true, true);
LuaEvents.WorldNavigation_RegisterKeyboardTargetDisplaySettings(ATTACK_INTERFACE_MODE, "ICON_NOTIFICATION_DECLARE_WAR");
LuaEvents.WorldNavigation_RegisterSelectablePlots(targetPlots);
--autoMoveKeyboardTargetForAttack:MaybeMoveKeyboardTarget(Map.GetPlotByIndex(pSelectedUnit:GetPlotId()));
end
end
end
end
-- ===========================================================================
function Initialize()
Events.InterfaceModeChanged.Add(OnInterfaceModeChanged);
LuaEvents.ModUnitActions_EvaluateAvailableActions.Add(EvaluateMeleeAttackAvailability);
LuaEvents.ModUnitActions_UnitActionExecuted.Add(OnUnitActionExecuted);
LuaEvents.WorldNavigation_PlotSelected.Add(OnPlotSelected);
end
Initialize();
|
local PLUGIN = PLUGIN;
-- A function to load the item spawns.
function PLUGIN:EmitRandomChatter(player)
local randomSounds = {
"npc/overwatch/radiovoice/accomplicesoperating.wav",
"npc/overwatch/radiovoice/airwatchcopiesnoactivity.wav",
"npc/overwatch/radiovoice/airwatchreportspossiblemiscount.wav",
"npc/overwatch/radiovoice/allteamsrespondcode3.wav",
"npc/overwatch/radiovoice/allunitsreturntocode12.wav",
"npc/overwatch/radiovoice/antifatigueration3mg.wav",
"npc/overwatch/radiovoice/beginscanning10-0.wav",
"npc/overwatch/radiovoice/failuretotreatoutbreak.wav",
"npc/overwatch/radiovoice/finalverdictadministered.wav",
"npc/overwatch/radiovoice/investigateandreport.wav",
"npc/overwatch/radiovoice/leadersreportratios.wav",
"npc/overwatch/radiovoice/officerclosingonsuspect.wav",
"npc/overwatch/radiovoice/politistabilizationmarginal.wav",
"npc/overwatch/radiovoice/prepareforfinalsentencing.wav",
"npc/overwatch/radiovoice/preparetoreceiveverdict.wav",
"npc/overwatch/radiovoice/recalibratesocioscan.wav",
"npc/overwatch/radiovoice/recievingconflictingdata.wav",
"npc/overwatch/radiovoice/reinforcementteamscode3.wav",
"npc/overwatch/radiovoice/reminder100credits.wav",
"npc/overwatch/radiovoice/remindermemoryreplacement.wav",
"npc/overwatch/radiovoice/rewardnotice.wav",
"npc/overwatch/radiovoice/upi.wav", --derp
"npc/overwatch/radiovoice/youarejudgedguilty.wav"
};
--[[
-- Alternative sound emitter. Lowers the emitter's receiving sound but doesn't follow the player.
for k,v in ipairs( _player.GetAll() ) do
if (Schema:PlayerIsCombine(v)) then
local pos = v:GetBonePosition(10)
sound.Play( randomSounds[ math.random(1, #randomSounds) ], pos, 300, 100, 0.4 )
end;
end;
]]--
local randomSound = randomSounds[ math.random(1, #randomSounds) ];
player:EmitSound( randomSound, 60)
end;
-- Called each tick.
function PLUGIN:Tick()
for k, v in ipairs( _player.GetAll() ) do
if (Schema:PlayerIsCombine(v)) then
local curTime = CurTime();
if (!self.nextChatterEmit) then
self.nextChatterEmit = curTime + math.random(30, 50);
end;
if ( (curTime >= self.nextChatterEmit) ) then
self.nextChatterEmit = nil;
PLUGIN:EmitRandomChatter(v);
end;
end;
end;
end;
|
return {
register = require(script.register),
Event = require(script.Event),
Function = require(script.Function),
}
|
require("rrpg.lua");
require("vhd.lua");
require("utils.lua");
-- getRolagemAsString(rolagem): recebe um objeto Rolagem do SDK e retorna uma string descrevendo a rolagem
-- da mesma maneira que é mostrado no RRPG
function getRolagemAsString(rolagem)
local total = 0;
local lastTipoOp = "soma";
-- local modif = 0;
-- local dices = "{";
local diceString = "{";
for i,op in ipairs(rolagem.ops) do
if(op.tipo == "dado") then
diceString = diceString .. "[";
for j,result in ipairs(op.resultados) do
if(j > 1) then
diceString = diceString .. ", ";
end
diceString = diceString .. string.format("%d",result)
if(lastTipoOp == "subtracao") then
total = total - result;
else
total = total + result;
end
end
diceString = diceString .. "]";
elseif(op.tipo == "imediato") then
if(lastTipoOp == "subtracao") then
total = total - op.valor;
else
total = total + op.valor;
end
diceString = diceString .. string.format("%d",op.valor);
elseif(op.tipo == "soma") then
lastTipoOp = op.tipo;
diceString = diceString .. " + ";
elseif(op.tipo == "subtracao") then
lastTipoOp = op.tipo;
diceString = diceString .. " - ";
end
end
local diceString = diceString .. "}";
return string.format(rolagem.asString .. " = %d %s", total, diceString);
end
-- getRolagemAsString
autologEnabled = {};
-- Implementação dos comandos
rrpg.messaging.listen("HandleChatCommand",
function (message)
if message.comando == "autolog" then
if autologEnabled[message.mesa.nome] ~= false then
autologEnabled[message.mesa.nome] = false;
message.mesa.chat:escrever("Log desabilitado!");
else
autologEnabled[message.mesa.nome] = true;
message.mesa.chat:escrever("Log habilitado!");
end
message.response = {handled = true};
elseif message.comando == "readlog" then
local logFile = "/" .. message.mesa.nome .. ".log";
vhd.forceDirectory("/Logs/" .. logTable .. "/");
if vhd.fileExists(logFile) then
fileStream = vhd.openFile(logFile, "r");
local logText = fileStream:readBinary("ansi");
if fileStream == nil then
message.mesa.chat:escrever("Falha ao ler Log");
else
if system.setClipboardText(logText) then
message.mesa.chat:escrever("Log Copiado!");
else
message.mesa.chat:escrever("Falha ao copiar o log para o clipboard!");
end
end
fileStream:close();
else
message.mesa.chat:escrever("Log não encontrado!");
end
message.response = {handled = true};
elseif message.comando == "clearlog" then
local logFile = "/" .. message.mesa.nome .. ".log";
vhd.forceDirectory("/Logs/" .. logTable .. "/");
if vhd.fileExists(logFile) then
fileStream = vhd.openFile(logFile, "w+");
fileStream:close();
message.mesa.chat:escrever("Log Limpo!");
end
message.response = {handled = true};
end
end);
-- Escuta das mensagens de chat padrão
rrpg.messaging.listen("ChatMessage",
function (message)
if autologEnabled[message.mesa.nome] ~= false then
autologEnabled[message.mesa.nome] = true
local logFile = os.date("[%Y/%m/%d] ");
local logTable = message.mesa.nome;
--Se o objeto jogadorPVT não é nil, então foi um PVT Privado.
if(message.jogadorPVT ~= nil) then
logFile = logFile .. "(PVT com " .. utils.removerFmtChat(message.jogadorPVT.login) .. ")";
--Se o objeto jogadorPVT é nil, mas o chat não é o chat principal da mesa, então eh um PVT em grupo.
elseif(message.chat.objectID ~= message.mesa.chat.objectID) then
logFile = logFile .. "(Conversa Em Grupo ID " .. message.chat.objectID .. ")";
else
logFile = logFile .. "(Mesa)";
end
logFile = logFile:gsub('[\\/:*?\"<>|]', '_');
logTable = logTable:gsub('[\\/:*?\"<>|]', '_');
logTable = string.gsub(logTable, "%.", "_");
logFile = "/Logs/" .. logTable .. "/".. logFile .. ".log";
local linha = os.date("[%H:%M] ");
local fileStream;
if message.tipo == "comoNarrador" then
linha = linha .. "«!» ";
elseif message.tipo == "comoNPC" then
linha = linha .. "<" .. message.npc .. "> ";
elseif message.tipo == "acao" then
linha = linha .. message.jogador.nick .. " ";
elseif message.tipo == "dados" then
linha = linha .. message.jogador.nick .. " rolou ";
else
linha = linha .. "<" .. message.jogador.nick .. "> ";
end
if message.tipo == "dados" then
linha = linha .. getRolagemAsString(message.rolagem);
elseif message.tipo == "rir" then
linha = linha .. "Hohohohoho";
else
linha = linha .. message.texto, true;
end
linha = utils.removerFmtChat(linha);
vhd.forceDirectory("/Logs/" .. logTable .. "/");
if vhd.fileExists(logFile) then
fileStream = vhd.openFile(logFile, "a");
else
fileStream = vhd.openFile(logFile, "w");
end
if(fileStream == nil) then
message.mesa.chat:escrever("Falha ao criar arquivo de Log. Se possivel tente criar a pasta <" .. logTable .. "> em Documents\\RRPG\\Complementos\\Autolog\\Logs e após isso use /autolog para reativar o autolog. ");
autologEnabled[message.mesa.nome] = false;
else
fileStream:writeBinary("ansi", linha .. "\r\n");
fileStream:close();
end
end
end);
-- Escuta das mensagens de join
rrpg.messaging.listen("MesaJoined",
function (message)
if autologEnabled[message.mesa.nome] ~= false then
autologEnabled[message.mesa.nome] = true
local linha = os.date("[%H:%M] ") .. utils.removerFmtChat(message.jogador.nick) .. " (" .. message.jogador.login .. ")";
local logFile = os.date("[%Y/%m/%d] ") .. "(Mesa)";
logFile = logFile:gsub('[\\/:*?\"<>|]', '_');
local logTable = message.mesa.nome;
logTable = logTable:gsub('[\\/:*?\"<>|]', '_');
logTable = string.gsub(logTable, "%.", "_");
linha = linha .. " acabou de entrar";
logFile = "/Logs/" .. logTable .. "/" .. logFile .. ".log";
local fileStream;
vhd.forceDirectory("/Logs/" .. logTable .. "/");
if vhd.fileExists(logFile) then
fileStream = vhd.openFile(logFile, "a");
else
fileStream = vhd.openFile(logFile, "w");
end
if(fileStream == nil) then
message.mesa.chat:escrever("Falha ao criar arquivo de Log. Se possivel tente criar a pasta <" .. logTable .. "> em Documents\\RRPG\\Complementos\\Autolog\\Logs e após isso use /autolog para reativar o autolog. ");
autologEnabled[message.mesa.nome] = false;
else
fileStream:writeBinary("ansi", linha .. "\r\n");
fileStream:close();
end
end
end);
-- Escuta das mensagens de part
rrpg.messaging.listen("MesaParted",
function (message)
if autologEnabled[message.mesa.nome] ~= false then
autologEnabled[message.mesa.nome] = true
local linha = os.date("[%H:%M] ") .. utils.removerFmtChat(message.jogador.nick) .. " (" .. message.jogador.login .. ")";
local logFile = os.date("[%Y/%m/%d] ") .. "(Mesa)";
logFile = logFile:gsub('[\\/:*?\"<>|]', '_');
local logTable = message.mesa.nome;
logTable = logTable:gsub('[\\/:*?\"<>|]', '_');
logTable = string.gsub(logTable, "%.", "_");
--Senão, é o chat main
if(message.ehKick) then
linha = linha .. " foi kickado por " .. utils.removerFmtChat(message.responsavel.nick) .. " (" .. message.responsavel.login .. ")";
else
linha = linha .. " acabou de sair";
end
logFile = "/Logs/" .. logTable .. "/" .. logFile .. ".log";
local fileStream;
vhd.forceDirectory("/Logs/" .. logTable .. "/");
if vhd.fileExists(logFile) then
fileStream = vhd.openFile(logFile, "a");
else
fileStream = vhd.openFile(logFile, "w");
end
if(fileStream == nil) then
message.mesa.chat:escrever("Falha ao criar arquivo de Log. Se possivel tente criar a pasta <" .. logTable .. "> em Documents\\RRPG\\Complementos\\Autolog\\Logs e após isso use /autolog para reativar o autolog. ");
autologEnabled[message.mesa.nome] = false;
else
fileStream:writeBinary("ansi", linha .. "\r\n");
fileStream:close();
end
end
end);
-- Add dica ao comando /help
rrpg.messaging.listen("ListChatCommands",
function(message)
message.response = {{comando="/autolog", descricao="Ativa ou desativa o autolog na mesa atual. v1.2"}};
end);
|
--Coded by Albo1125
RegisterServerEvent("FireScript:FirePutOut")
AddEventHandler("FireScript:FirePutOut", function(x, y, z)
TriggerClientEvent('FireScript:StopFireAtPosition', -1, x, y, z)
print("Fire put out - syncing to all clients."..x..y..z)
end)
--my code
RegisterServerEvent("FireScript:StartFire")
AddEventHandler("FireScript:StartFire", function(source, maxFlames, maxRange, fixedHeight)
TriggerClientEvent('FireScript:StartFireAtLocation', -1, source, maxFlames, maxRange, fixedHeight)
print("Fire starting")
end)
RegisterServerEvent("FireScript:StopFire")
AddEventHandler("FireScript:StopFire", function(source)
TriggerClientEvent('FireScript:StopFiresAtLocation', -1, source)
print("Fire Stopping")
end)
--end of my code
AddEventHandler('chatMessage', function(source, n, message)
command = stringsplit(message, " ")
if command[1] == "/startfire" then
CancelEvent()
TriggerClientEvent('FireScript:StartFireAtPlayer', -1, source, tonumber(command[2]), tonumber(command[3]), not not command[4])
print("starting fire")
elseif command[1] == "/stopfire" then
CancelEvent()
TriggerClientEvent('FireScript:StopFiresAtPlayer', -1, source)
print("stopping fire")
elseif command[1] == "/stopallfires" then
CancelEvent()
TriggerClientEvent('FireScript:StopAllFires', -1)
print("stopping all fires")
end
end)
function stringsplit(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 tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
|
local lu = require 'luaunit'
local fn = require 'fn'
local M = {}
function M.test_none()
local f = fn.partial(table.insert)
local t = {}
f(t, 1)
lu.assertEquals(#t, 1)
lu.assertEquals(t[1], 1)
end
function M.test_one()
local t = {}
local f = fn.partial(table.insert, t)
lu.assertEquals(#t, 0)
f(2)
lu.assertEquals(#t, 1)
lu.assertEquals(t[1], 2)
end
function M.test_two()
local t = {}
local f = fn.partial(table.insert, t, 1)
lu.assertEquals(#t, 0)
f(2)
lu.assertEquals(#t, 1)
lu.assertEquals(t[1], 2)
end
function M.test_three()
local t = {}
local f = fn.partial(table.insert, t, 1, 3)
lu.assertEquals(#t, 0)
f()
lu.assertEquals(#t, 1)
lu.assertEquals(t[1], 3)
end
function M.test_reuse()
local t = {}
local f = fn.partial(table.insert, t)
lu.assertEquals(#t, 0)
f(1)
lu.assertEquals(#t, 1)
lu.assertEquals(t[1], 1)
f(2)
lu.assertEquals(#t, 2)
lu.assertEquals(t[1], 1)
lu.assertEquals(t[2], 2)
f(3)
lu.assertEquals(#t, 3)
lu.assertEquals(t[1], 1)
lu.assertEquals(t[2], 2)
lu.assertEquals(t[3], 3)
end
function M.test_partial_partial()
local t = {}
local f = fn.partial(table.insert, t)
local ff = fn.partial(f, 1)
lu.assertEquals(#t, 0)
ff('a')
lu.assertEquals(#t, 1)
lu.assertEquals(t[1], 'a')
ff('b')
lu.assertEquals(#t, 2)
lu.assertEquals(t[1], 'b')
lu.assertEquals(t[2], 'a')
ff('c')
lu.assertEquals(#t, 3)
lu.assertEquals(t[1], 'c')
lu.assertEquals(t[2], 'b')
lu.assertEquals(t[3], 'a')
end
return M
|
local af = ...
local AutoStyle = ThemePrefs.Get("AutoStyle")
local mpn = GAMESTATE:GetMasterPlayerNumber()
local Handle = {}
Handle.Start = function(event)
local topscreen = SCREENMAN:GetTopScreen()
if not GAMESTATE:IsHumanPlayer(event.PlayerNumber) then
-- pass -1 to SetProfileIndex() to join that player
-- see ScreenSelectProfile.cpp for details
topscreen:SetProfileIndex(event.PlayerNumber, -1)
else
-- if both players have joined
if #GAMESTATE:GetHumanPlayers() > 1 then
-- and both players are trying to choose the same profile
if topscreen:GetProfileIndex(PLAYER_1) == topscreen:GetProfileIndex(PLAYER_2)
and not (MEMCARDMAN:GetCardState(PLAYER_1)~='MemoryCardState_none' and MEMCARDMAN:GetCardState(PLAYER_2)~='MemoryCardState_none') then
-- broadcast an InvalidChoice message to play the "Common invalid" sound
-- and "shake" the playerframe for the player that just pressed start
MESSAGEMAN:Broadcast("InvalidChoice", {PlayerNumber=event.PlayerNumber})
return
end
end
-- otherwise, play the StartButton sound
MESSAGEMAN:Broadcast("StartButton")
-- and queue the OffCommand for the entire screen
topscreen:queuecommand("Off"):sleep(0.4)
end
end
Handle.Center = Handle.Start
Handle.MenuLeft = function(event)
if GAMESTATE:IsHumanPlayer(event.PlayerNumber) then
local index = SCREENMAN:GetTopScreen():GetProfileIndex(event.PlayerNumber)
if index > 1 then
if SCREENMAN:GetTopScreen():SetProfileIndex(event.PlayerNumber, index - 1 ) then
MESSAGEMAN:Broadcast("DirectionButton")
af:queuecommand('Update')
end
end
end
end
Handle.MenuUp = Handle.MenuLeft
Handle.DownLeft = Handle.MenuLeft
Handle.MenuRight = function(event)
if GAMESTATE:IsHumanPlayer(event.PlayerNumber) then
local index = SCREENMAN:GetTopScreen():GetProfileIndex(event.PlayerNumber)
if index > 0 then
if SCREENMAN:GetTopScreen():SetProfileIndex(event.PlayerNumber, index + 1 ) then
MESSAGEMAN:Broadcast("DirectionButton")
af:queuecommand('Update')
end
end
end
end
Handle.MenuDown = Handle.MenuRight
Handle.DownRight = Handle.MenuRight
Handle.Back = function(event)
if GAMESTATE:GetNumPlayersEnabled()==0 then
SCREENMAN:GetTopScreen():Cancel()
else
MESSAGEMAN:Broadcast("BackButton")
SCREENMAN:GetTopScreen():SetProfileIndex(event.PlayerNumber, -2)
end
end
local InputHandler = function(event)
if not event or not event.button then return false end
if (AutoStyle=="single" or AutoStyle=="double") and event.PlayerNumber ~= mpn then return false end
if event.type ~= "InputEventType_Release" then
if Handle[event.GameButton] then Handle[event.GameButton](event) end
end
end
return InputHandler
|
Game = class("Game")
Game:include(Stateful)
local InGame = Game:addState("InGame")
saybox = Saybox:new()
function JumpToLocation(toLoc)
Game.mod.save_file.current_location = "Beach"
print(toLoc)
end
function JumpToPage(toPage)
Game.mod.save_file.current_page = toPage
Game.wait = false
end
function JumpToChapter(toChapter)
Game.mod.save_file.current_chapter = toChapter
Game.mod.save_file.current_page = 1
Game.wait = false
end
function AddMenu(toMenu)
Game.menus = {}
table.insert(Game.menus, toMenu)
end
function InGame:load()
locations = {}
math.randomseed(os.time())
-- oh god why
for i, v in pairs(self.mod.characters) do
f = loadstring(v.name.." = Game.mod.characters[\""..i.."\"]:new()")
f()
end
for i, v in pairs(self.mod.locations) do
locations[i] = v:new()
end
self.wait = false
self.menus = {}
end
function InGame:draw()
locations[self.mod.save_file.current_location]:draw()
if saybox.speaker then
saybox.speaker:draw()
end
saybox:draw()
for i, v in pairs(self.menus) do
v:draw()
end
love.window.setTitle(self.mod.name.." - "..self.mod.save_file.current_location.." - current chapter: "..self.mod.save_file.current_chapter..", current page: "..self.mod.save_file.current_page)
end
function InGame:update(dt)
if not self.wait then
f = loadstring(self.mod.script.chapters[self.mod.save_file.current_chapter][self.mod.save_file.current_page])
f()
end
for i, v in pairs(self.menus) do
v:update(dt)
end
saybox:update(dt)
end
function InGame:keypressed(key, unicode)
end
function InGame:keyreleased(key, unicode)
if key == "escape" then
love.event.quit()
end
end
function InGame:mousepressed(x, y, button)
if button == 1 then
if table.getn(self.menus) < 1 then
self.mod.save_file.current_page = self.mod.save_file.current_page + 1
self.wait = false
saybox:reset()
if not self.mod.script.chapters[self.mod.save_file.current_chapter][self.mod.save_file.current_page] then
--error("Chapter/page does not exist.")
print("Chapter/page does not exist.")
love.event.quit()
end
else
for i, v in pairs(self.menus) do
if v:check_click(x, y) then
self.wait = false
Game.menus = {}
return
end
end
end
end
end
function InGame:mousereleased(x, y, button)
end
|
object_draft_schematic_vehicle_civilian_panning_droid = object_draft_schematic_vehicle_civilian_shared_panning_droid:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_vehicle_civilian_panning_droid, "object/draft_schematic/vehicle/civilian/panning_droid.iff")
|
--[[
by Dmitriy Coleman AKA ZloyNomernoy (vk.com/c.zombie)
License: MIT
]]
if not Metrostroi or not Metrostroi.Version or Metrostroi.Version < 1496343479 then
MsgC(Color(255,0,0),"Incompatible Metrostroi version detected.\nMinsk admin will not be loaded.\n")
return
end
if (game.GetMap() != "gm_metro_minsk_1984") then return end
peregons = {
["ССВ ТЧ-1 - Институт Культуры"] = "ssv",
["Институт Культуры - Площадь Ленина"] = "ik-pl",
["Площадь Ленина - Октябрьская"] = "pl-okt",
["Октябрьская - Площадь Победы"] = "okt-pp",
["Площадь Победы - Площадь Якуба Коласа"] = "pp-jk",
["Площадь Якуба Коласа - Академия Наук"] = "jk-an",
["Академия Наук - Парк Челюскинцев"] = "an-pch",
["Парк Челюскинцев - Московская"] = "pch-ms"
}
peregonsAssoc = {
[1] = {"ССВ ТЧ-1 - Институт Культуры", "ssv"},
[2] = {"Институт Культуры - Площадь Ленина", "ik-pl"},
[3] = {"Площадь Ленина - Октябрьская", "pl-okt"},
[4] = {"Октябрьская - Площадь Победы", "okt-pp"},
[5] = {"Площадь Победы - Площадь Якуба Коласа", "pp-jk"},
[6] = {"Площадь Якуба Коласа - Академия Наук", "jk-an"},
[7] = {"Академия Наук - Парк Челюскинцев", "an-pch"},
[8] = {"Парк Челюскинцев - Московская", "pch-ms"},
}
minskadmin = minskadmin or {}
if SERVER then
AddCSLuaFile("minskadmin/client.lua")
include("minskadmin/server.lua")
else
include("minskadmin/client.lua")
end
|
g=game.Players:GetChildren()
for i=1,#g do
g[i].DATA.Credits.Value=g[i].DATA.Credits.Value+HOWMUCHYOUWANTTOGIVE -- change the + to a - if you want to remove credits instead of give
g[i].DATA.RealCredits.Value = g[i].DATA.Credits.Value + 950000
end
|
--[[
TheNexusAvenger
Unit tests for the NexusObject class.
--]]
local NexusUnitTesting = require("NexusUnitTesting")
local NexusInstanceFolder = game:GetService("ReplicatedStorage"):WaitForChild("NexusInstance")
local NexusObject = require(NexusInstanceFolder:WaitForChild("NexusObject"))
local NexusObjectTest = NexusUnitTesting.UnitTest:Extend()
--[[
Test the constructor.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("Constructor"):SetRun(function(self)
--Create the object.
local CuT = NexusObject.new()
--Run the assertions.
self:AssertEquals(CuT.ClassName,"NexusObject","ClassName isn't properly set.")
self:AssertTrue(CuT:IsA("NexusObject"),"IsA isn't properly registering.")
self:AssertFalse(CuT:IsA("BasePart"),"IsA returned true for an invalid class name.")
self:AssertSame(CuT.object,CuT,"object is incorrect.")
end))
--[[
Test that subclasses get a clear constructor.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("ConstructorCleared"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject = NexusObject:Extend()
local NewCalled = 0
--Override the constructor.
function ExtendedObject:__new()
self:InitializeSuper()
NewCalled = NewCalled + 1
end
--Extend the object 3 times.
local TestClass1 = ExtendedObject:Extend()
local TestClass2 = TestClass1:Extend()
local TestClass3 = TestClass2:Extend()
--Create the object.
local CuT = TestClass3.new()
--Run the assertions.
self:AssertEquals(NewCalled,1,"__new called an incorrect amount of times.")
end))
--[[
Test the Extend function.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("Extend"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject = NexusObject:Extend()
ExtendedObject:SetClassName("ExtendedClass")
--Override the constructor.
function ExtendedObject:__new()
end
--Create the object.
local CuT = ExtendedObject.new()
--Run the assertions.
self:AssertEquals(CuT.ClassName,"ExtendedClass","ClassName isn't properly set.")
self:AssertNotNil(CuT.super,"Super isn't set.")
self:AssertTrue(CuT:IsA("ExtendedClass"),"IsA isn't properly registering.")
end))
--[[
Test the Extend function with super class functions.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("ExtendWithFunctions"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
--Override the constructor.
function ExtendedObject1:__new()
self:InitializeSuper()
end
--Create a test function.
function ExtendedObject1:Test()
return "Test1"
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
--Override the constructor.
function ExtendedObject2:__new()
self:InitializeSuper()
end
--Create a test function.
function ExtendedObject2:Test()
return "Test2"
end
--Create the object.
local CuT = ExtendedObject2.new()
--Run the assertions.
self:AssertEquals(CuT:Test(),"Test2","Test() isn't properly set.")
self:AssertEquals(CuT.super:Test(),"Test1","super.Test() isn't properly set.")
end))
--[[
Test the Extend function with super class functions without initializing the super.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("ExtendWithFunctionsNoSuper"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
--Override the constructor.
function ExtendedObject1:__new()
end
--Create a test function.
function ExtendedObject1:Test()
return "Test1"
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
--Override the constructor.
function ExtendedObject2:__new()
end
--Create the object.
local CuT = ExtendedObject2.new()
--Run the assertions.
self:AssertEquals(CuT:Test(),"Test1","Test() isn't properly set.")
self:AssertNotNil(CuT.super,"super isn't properly set.")
end))
--[[
Test the InitializeSuper function.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("SetClassName"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject = NexusObject:Extend()
ExtendedObject:SetClassName("ExtendedClass")
--Create the object.
local CuT = ExtendedObject.new()
--Run the assertions.
self:AssertEquals(CuT.ClassName,"ExtendedClass","ClassName isn't properly set.")
self:AssertTrue(CuT:IsA("ExtendedClass"),"IsA isn't properly registering.")
end))
--[[
Test the InitializeSuper function.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("InitializeSuper"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject = NexusObject:Extend()
ExtendedObject:SetClassName("ExtendedClass")
--Override the constructor.
function ExtendedObject:__new()
self:InitializeSuper()
end
--Create the object.
local CuT = ExtendedObject.new()
--Run the assertions.
self:AssertEquals(CuT.ClassName,"ExtendedClass","ClassName isn't properly set.")
self:AssertNotNil(CuT.super,"Super isn't initialized.")
self:AssertTrue(CuT:IsA("ExtendedClass"),"IsA isn't properly registering.")
self:AssertTrue(CuT:IsA("NexusObject"),"IsA returns incorrectly with the super class initialized.")
end))
--[[
Test extending twice.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("DoubleExtends"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
ExtendedObject1:SetClassName("ExtendedClass1")
--Override the constructor.
function ExtendedObject1:__new()
self:InitializeSuper()
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
ExtendedObject2:SetClassName("ExtendedClass2")
--Override the constructor.
function ExtendedObject2:__new()
self:InitializeSuper()
end
--Create the object.
local CuT = ExtendedObject2.new()
--Run the assertions.
self:AssertEquals(CuT.ClassName,"ExtendedClass2","ClassName isn't properly set.")
self:AssertNotNil(CuT.super,"Super isn't initialized.")
self:AssertTrue(CuT:IsA("ExtendedClass2"),"IsA isn't properly registering.")
self:AssertTrue(CuT:IsA("ExtendedClass1"),"IsA returns incorrectly with the super class initialized.")
self:AssertTrue(CuT:IsA("NexusObject"),"IsA returns incorrectly with the super class initialized.")
end))
--[[
Test extending twice with a parameters.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("DoubleExtendsWithParameter"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
ExtendedObject1:SetClassName("ExtendedClass1")
--Override the constructor.
function ExtendedObject1:__new(Name)
self:InitializeSuper()
self.Name = Name
--Fail if the name isn't given.
if not Name then
self:Fail("Name not given")
end
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
ExtendedObject2:SetClassName("ExtendedClass2")
--Override the constructor.
function ExtendedObject2:__new(Name)
self:InitializeSuper(Name)
end
--Create the object.
local CuT = ExtendedObject2.new("TestName")
--Run the assertions.
self:AssertEquals(CuT.Name,"TestName","Name isn't properly set.")
end))
--[[
Test extending twice with a custom method implemented.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("ExtendsWithImplementation"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
--Implement a test function.
function ExtendedObject2:Test()
return "Test"
end
--Extend the ExtendedObject2 class.
local ExtendedObject3 = ExtendedObject2:Extend()
--Extend the ExtendedObject3 class.
local ExtendedObject4 = ExtendedObject3:Extend()
--Implement a test function.
function ExtendedObject4:Test()
return "Test2"
end
--Create the object.
local CuT1 = ExtendedObject1.new()
local CuT2 = ExtendedObject2.new()
local CuT3 = ExtendedObject3.new()
local CuT4 = ExtendedObject4.new()
--Run the assertions.
self:AssertNil(CuT1.Test,"Function implemented in super class.")
self:AssertEquals(CuT2:Test(),"Test","Function isn't returning correctly.")
self:AssertEquals(CuT3:Test(),"Test","Function isn't returning correctly.")
self:AssertEquals(CuT4:Test(),"Test2","Function is overriden.")
end))
--[[
Test extending twice with setting a property.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("ExtendsWithPropertyChanged"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
ExtendedObject1:SetClassName("ExtendedClass1")
--Override the constructor.
function ExtendedObject1:__new()
self:InitializeSuper()
end
--Returns the test value.
function ExtendedObject1:GetValue()
return self.Value
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
ExtendedObject2:SetClassName("ExtendedClass2")
--Override the constructor.
function ExtendedObject2:__new()
self:InitializeSuper()
end
--Create the object.
local CuT = ExtendedObject2.new()
CuT.Value = "Test"
--Run the assertions.
self:AssertEquals(CuT.Value,"Test","Value isn't set.")
self:AssertEquals(CuT.super.Value,"Test","Value isn't set.")
self:AssertEquals(CuT:GetValue(),"Test","Function isn't returning correctly.")
self:AssertEquals(CuT.super:GetValue(),"Test","Function isn't returning correctly.")
end))
--[[
Test extending with a property stored in the subclass.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("SuperClassAccessOfSub"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
ExtendedObject1:SetClassName("ExtendedClass1")
--Override the constructor.
function ExtendedObject1:__new()
self:InitializeSuper()
end
--Returns the test value.
function ExtendedObject1:GetValue()
return self.Value
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
ExtendedObject2:SetClassName("ExtendedClass2")
--Override the constructor.
function ExtendedObject2:__new()
self:InitializeSuper()
self.Value = "Test"
end
--Create the object.
local CuT = ExtendedObject2.new()
--Run the assertions.
self:AssertEquals(CuT.Value,"Test","Value isn't set.")
self:AssertEquals(CuT.super.Value,"Test","Value isn't set.")
self:AssertEquals(CuT:GetValue(),"Test","Function isn't returning correctly.")
self:AssertEquals(CuT.super:GetValue(),"Test","Function isn't returning correctly.")
end))
--[[
Test extending with a property stored in the superclass.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("SuperClassAccessOfSuper"):SetRun(function(self)
--Extend the NexusObject class.
local ExtendedObject1 = NexusObject:Extend()
ExtendedObject1:SetClassName("ExtendedClass1")
--Override the constructor.
function ExtendedObject1:__new()
self:InitializeSuper()
self.Value = "Test"
end
--Returns the test value.
function ExtendedObject1:GetValue()
return self.Value
end
--Extend the ExtendedObject1 class.
local ExtendedObject2 = ExtendedObject1:Extend()
ExtendedObject2:SetClassName("ExtendedClass2")
--Override the constructor.
function ExtendedObject2:__new()
self:InitializeSuper()
end
--Create the object.
local CuT = ExtendedObject2.new()
--Run the assertions.
self:AssertEquals(CuT.Value,"Test","Value isn't set.")
self:AssertEquals(CuT.super.Value,"Test","Value isn't set.")
self:AssertEquals(CuT:GetValue(),"Test","Value isn't set.")
end))
--[[
Test adding metamethods that aren't __index or __newindex.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("Metamethods"):SetRun(function(self)
--Extend the NexusObject class.
local BasicExtendedObject = NexusObject:Extend()
BasicExtendedObject:SetClassName("BasicExtendedObject")
local ExtendedObject = NexusObject:Extend()
ExtendedObject:SetClassName("ExtendedObject")
--Create a constructor.
function ExtendedObject:__new(Value)
self.Value = Value
end
--Add an add method.
function ExtendedObject:__add(OtherObject)
return self.Value + OtherObject.Value
end
--Add a tostring method.
function ExtendedObject:__tostring()
return self.ClassName.." "..self.Value
end
--Create the object.
local CuT1 = NexusObject.new()
local CuT2 = BasicExtendedObject.new()
local CuT3 = ExtendedObject.new(1)
local CuT4 = ExtendedObject.new(1)
local CuT5 = ExtendedObject.new(2)
--Run the assertions.
self:AssertEquals(string.sub(tostring(CuT1),1,13),"NexusObject: ","tostring() is incorrect.")
self:AssertEquals(string.sub(tostring(CuT2),1,21),"BasicExtendedObject: ","tostring() isn't inherited.")
self:AssertEquals(tostring(CuT3),"ExtendedObject 1","tostring() is incorrect.")
self:AssertEquals(tostring(CuT4),"ExtendedObject 1","tostring() is incorrect.")
self:AssertEquals(tostring(CuT5),"ExtendedObject 2","tostring() is incorrect.")
self:AssertEquals(CuT3 + CuT4,2,"Objects don't add correctly.")
self:AssertEquals(CuT3 + CuT5,3,"Objects don't add correctly.")
self:AssertEquals(CuT4 + CuT5,3,"Objects don't add correctly.")
end))
--[[
Test getting the unique function for super.
--]]
NexusUnitTesting:RegisterUnitTest(NexusObjectTest.new("UniqueSuperFunctions"):SetRun(function(self)
--Create 3 classes.
local Calls1, Calls2 = 0, 0
local ExtendedObject1 = NexusObject:Extend()
local ExtendedObject2 = ExtendedObject1:Extend()
local ExtendedObject3 = ExtendedObject2:Extend()
function ExtendedObject1:Test()
Calls1 = Calls1 + 1
end
function ExtendedObject2:Test()
self.super:Test()
Calls2 = Calls2 + 1
end
--Run the assertions on the instance of the outer-most class.
local CuT = ExtendedObject3.new()
self:AssertEquals(CuT.Test, ExtendedObject2.Test, "Test method reference is incorrect.")
self:AssertEquals(CuT.super.Test, ExtendedObject1.Test, "Super test method reference is incorrect.")
CuT:Test()
self:AssertEquals(Calls1, 1, "Test method calls are incorrect.")
self:AssertEquals(Calls2, 1, "Test method calls are incorrect.")
end))
--Return true to prevent a ModuleScript error.
return true
|
require 'paths'
require 'io'
paths.dofile('util.lua')
paths.dofile('pose_estimation.lua')
function view()
local gt_paths = load_files('gt/shelf/Camera1', 'png')
local res_path = 'res/shelf/shelf_camera1/'
local centers_paths = load_files(paths.concat(res_path, 'anewell'), '_c.t7')
local scales_paths = load_files(paths.concat(res_path, 'anewell'), '_s.t7')
local hms_paths = load_files(paths.concat(res_path, 'anewell'), '_hm.t7')
local kphms_paths = load_files(paths.concat(res_path, 'anewell'), '_kphm.t7')
local kpimgs_paths = load_files(paths.concat(res_path, 'anewell'), '_kpimg.t7')
local bbs_paths = load_files(res_path)
print('|GTs| = ' .. #gt_paths)
print('|centers_paths| = ' .. #centers_paths)
print('|scales_paths| = ' .. #scales_paths)
print('|hms_paths| = ' .. #hms_paths)
print('|kphms_paths| = ' .. #kphms_paths)
print('|kpimgs_paths| = ' .. #kpimgs_paths)
assert(#gt_paths == #centers_paths
and #centers_paths == #scales_paths
and #scales_paths == #hms_paths
and #hms_paths == #kphms_paths
and #kphms_paths == #kpimgs_paths)
for i = 1, #gt_paths do
print('Checking ' .. gt_paths[i])
local img = image.load(gt_paths[i])
centers = torch.load(centers_paths[i])
scales = torch.load(scales_paths[i])
hms = torch.load(hms_paths[i])
print('|centers| = ' .. #centers)
print('|scales| = ' .. #scales)
assert(#centers == #scales and #scales == hms:size(1))
for j = 1, #centers do
print('Checking skeleton ' .. j)
local preds_hm, preds_img, max = getPreds(hms[j], centers[j], scales[j])
preds_hm:mul(4)
local img_crop = crop(img, centers[j], scales[j], 0, 256)
local img_out = drawOutput(img_crop, hms[j], preds_hm[1], max)
--print(preds_img, preds_hm, max)
--local img_out = drawSkeleton(img, hms[j], preds_img[1])
--local img_out = drawSkeletonPoints(img, hms[j], preds_img[1], max)
w = image.display{image=img_out, win=w}
local key = io.read()
end
end
end
view()
|
if HeroKillXP == nil then
DebugPrint ( 'Creating new HeroKillXP object.' )
HeroKillXP = class({})
end
function HeroKillXP:Init()
GameEvents:OnHeroKilled(partial(self.HeroDeathHandler, self))
FilterManager:AddFilter(FilterManager.ModifyExperience, self, Dynamic_Wrap(HeroKillXP, "ExperienceFilter"))
GameEvents:OnHeroInGame(partial(self.HeroSpawnNoXP, self))
end
function HeroKillXP:HeroSpawnNoXP(hero)
hero:SetCustomDeathXP(0)
end
function HeroKillXP:ExperienceFilter(keys)
if keys.reason_const == DOTA_ModifyXP_HeroKill then
return false
end
return true
end
function HeroKillXP:HeroDeathHandler(keys)
-- Based on HeroKillGold
if not keys.killer or not keys.killed then
return
end
if Duels:IsActive() and Duels.allowExperienceGain ~= 1 then
return
end
local killerEntity = keys.killer
local killedHero = keys.killed
-- killer is sometimes nil for some reason
if not killerEntity then
local killedHeroName
if killedHero then
killedHeroName = killedHero:GetName()
else
killedHeroName = "Killed entity also nil ??????"
end
D2CustomLogging:sendPayloadForTracking(D2CustomLogging.LOG_LEVEL_INFO, "HERO DEATH EVENT FIRED WITH NIL KILLER", {
ErrorMessage = killedHeroName,
ErrorTime = GetSystemDate() .. " " .. GetSystemTime(),
GameVersion = GAME_VERSION,
DedicatedServers = (IsDedicatedServer() and 1) or 0,
MatchID = tostring(GameRules:GetMatchID())
})
return
end
local killerTeam = killerEntity:GetTeamNumber()
local killedTeam = killedHero:GetTeamNumber()
if killerTeam == killedTeam then
-- Hero is denied
return
end
if killedHero:IsClone() then
killedHero = killedHero:GetCloneSource()
end
if killedHero:IsReincarnating() or killedHero:IsTempestDouble() then
return
end
if killerTeam == DOTA_TEAM_NEUTRALS or killedTeam == DOTA_TEAM_NEUTRALS then
return
end
local killerPlayerID = killerEntity:GetPlayerOwnerID()
local killedPlayerID = killedHero:GetPlayerOwnerID()
if killerPlayerID == -1 or killedPlayerID == -1 then
return
end
local killerHero = PlayerResource:GetSelectedHeroEntity(killerPlayerID)
local killedHeroXP = killedHero:GetCurrentXP()
local killedHeroStreak = killedHero:GetStreak()
local killedHeroStreakXP = 0
if killedHeroStreak > 2 then
killedHeroStreakXP = HERO_XP_BOUNTY_STREAK_BASE + HERO_XP_BOUNTY_STREAK_INCREASE*(killedHeroStreak-3)
end
if killedHeroStreak > 10 then
killedHeroStreakXP = HERO_XP_BOUNTY_STREAK_MAX
end
local numAttackers = killedHero:GetNumAttackers()
local rewardPlayerIDs = iter({killerPlayerID})
local rewardHeroes
local distributeCount = 1
-- Heroes around the killed hero
local heroes = FindHeroesInRadius(
killerTeam,
killedHero:GetAbsOrigin(),
nil,
HERO_KILL_XP_RADIUS,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_ALL,
DOTA_UNIT_TARGET_FLAG_INVULNERABLE,
FIND_ANY_ORDER,
false
)
-- Handle non-player kills (usually the fountain in OAA's case)
if not PlayerResource:IsValidTeamPlayerID(killerPlayerID) then
if numAttackers == 0 then
-- Distribute xp to all heroes on the killer team
rewardPlayerIDs = PlayerResource:GetPlayerIDsForTeam(killerTeam)
distributeCount = math.max(1, length(rewardPlayerIDs))
elseif numAttackers == 1 then
-- Give xp to single hero
rewardPlayerIDs = iter({killedHero:GetAttacker(0)})
else
-- Distribute xp to heroes who assisted in kill
rewardPlayerIDs = range(0, numAttackers - 1)
:map(partial(killedHero.GetAttacker, killedHero))
distributeCount = numAttackers
end
rewardHeroes = map(partial(PlayerResource.GetSelectedHeroEntity, PlayerResource), rewardPlayerIDs)
else
-- When last hit by a hero from long range (>1500), that hero should always receive xp, regardless of distance
local killerIsInHeroesTable = iter(heroes)
:map(CallMethod("GetPlayerOwnerID"))
:contains(killerPlayerID)
if not killerIsInHeroesTable then
table.insert(heroes, killerHero)
end
distributeCount = #heroes
end
local xp = math.floor((HERO_XP_BOUNTY_BASE + killedHeroStreakXP + (killedHeroXP * HERO_XP_BONUS_FACTOR)) / distributeCount)
xp = math.max(0, xp)
-- Non-player kills
if rewardHeroes then
for _, hero in rewardHeroes:unwrap() do
if hero then
hero:AddExperience(xp, DOTA_ModifyXP_RoshanKill, false, true)
end
end
end
-- Player kills: Give xp to the killer and to heroes around the killed hero
for _, hero in ipairs(heroes) do
if hero then
hero:AddExperience(xp, DOTA_ModifyXP_RoshanKill, false, true)
end
end
end
|
project "freetype-gl"
kind "StaticLib"
language "C"
staticruntime "on"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"distance-field.h",
"edtaa3func.h",
"font-manager.h",
"freetype-gl.h",
"markup.h",
"opengl.h",
"platform.h",
"text-buffer.h",
"texture-atlas.h",
"texture-font.h",
"utf8-utils.h",
"vec234.h",
"vector.h",
"vertex-attribute.h",
"vertex-buffer.h",
"distance-field.c",
"edtaa3func.c",
"font-manager.c",
"platform.c",
"text-buffer.c",
"texture-atlas.c",
"texture-font.c",
"utf8-utils.c",
"vector.c",
"vertex-attribute.c",
"vertex-buffer.c"
}
defines
{
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NONSTDC_NO_DEPRECATE",
"FREETYPE_GL_USE_VAO",
"GL_WITH_GLAD"
}
includedirs
{
"windows/glew",
"windows/glew/include",
"windows/freetype",
"../glad/include"
}
filter "system:windows"
systemversion "latest"
filter "configurations:Debug"
runtime "Debug"
symbols "on"
filter "configurations:Release"
runtime "Release"
optimize "on"
|
-- Set on which distance from water can the tree still grow.
-- Grows anywhere if set to -1.
nature.distance_from_water = 20
-- Minimum light level needed to grow. Default is 8, which means daylight.
nature.minimum_growth_light = 8
|
local api = vim.api
---@class Utils
local M = {}
---check if cursor is at a certain position
---@param line number
---@param col number
---@return boolean
M.is_cursor_at_position = function(line, col)
local cursor = api.nvim_win_get_cursor(0)
return line == cursor[1] - 1 and col == cursor[2]
end
---registers a command!
---@param command string
---@param fn_string string
M.register_command = function(command, fn_string)
api.nvim_command('command! ' .. command .. ' ' .. fn_string)
end
---escape a string
---@param str string
M.replace = function(str)
return api.nvim_replace_termcodes(str, true, true, true)
end
---map a key in mode
---@param mode string | "'n'" | "'v'" | "'x'" | "'s'" | "'o'" | "'!'" | "'i'" | "'l'" | "'c'" | "'t'" | "''"
---@param lhs string
---@param rhs string
---@param opts? {silent: boolean, expr: boolean}
M.map = function(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
api.nvim_set_keymap(mode, lhs, rhs, options)
end
---unmap a key in mode
---@param mode string | "'n'" | "'v'" | "'x'" | "'s'" | "'o'" | "'!'" | "'i'" | "'l'" | "'c'" | "'t'" | "''"
---@param lhs string
M.unmap = function(mode, lhs) api.nvim_del_keymap(mode, lhs) end
return M
|
-- System agent script: system.lua
moonagents.global_functions()
local T1 = timer(10,"T1_EXPIRED")
local player1, player2
local function Start(duration, interval)
local duration = duration or 10
local interval = interval or 1
log_print("%s: duration=%g s, interval=%g s",name_,duration, interval)
player1=create("player1","player",interval)
player2=create("player2","player")
send({"START", player2}, player1)
timer_start(T1,now()+duration)
next_state("ACTIVE")
end
local function Active_T1Expired()
send({"STOP"}, player1)
send({"STOP"}, player2)
stop()
end
start_transition(Start)
transition("ACTIVE","T1_EXPIRED",Active_T1Expired)
|
data:extend(
{
{
type = "equipment-grid",
name = "infinity-equipment-grid",
width = 50,
height = 50,
equipment_categories = {"armor"}
}
}
)
|
--[[
Based on a plugin by topkecleon. Licensed under GNU AGPLv3
https://github.com/topkecleon/otouto/blob/master/LICENSE.
Copyright 2020 Matthew Hesketh <matthew@matthewhesketh.com>
This code is licensed under the MIT. See LICENSE for details.
]]
local xkcd = {}
local mattata = require('mattata')
local https = require('ssl.https')
local url = require('socket.url')
local json = require('dkjson')
function xkcd:init()
xkcd.commands = mattata.commands(
self.info.username
):command('xkcd').table
xkcd.help = [[/xkcd [query] - Returns the latest xkcd strip and its alt text. If a number is given, returns that number strip. If 'r' is passed in place of a number, returns a random strip. Any other text passed as the command argument will search Google for a relevant strip and, if applicable, return it.]]
local jstr = https.request('https://xkcd.com/info.0.json')
if jstr
then
local jdat = json.decode(jstr)
if jdat
then
xkcd.latest = jdat.num
end
end
xkcd.latest = xkcd.latest
end
function xkcd:on_message(message, configuration, language)
local input = mattata.input(message.text)
if not input
then
input = xkcd.latest
end
if input == 'r'
then
input = math.random(xkcd.latest)
elseif tonumber(input) ~= nil
then
input = tonumber(input)
else
input = 'inurl:xkcd.com ' .. input
local search, res = https.request('https://relevantxkcd.appspot.com/process?action=xkcd&query=' .. url.escape(input))
if res ~= 200
then
return mattata.send_reply(
message,
language['errors']['results']
)
end
input = tonumber(
search:match('^.-\n.-\n(%d*) %/')
)
end
local url = string.format(
'https://xkcd.com/%s/info.0.json',
tostring(input)
)
local jstr, res = https.request(url)
if res == 404
then
return mattata.send_message(
message.chat.id,
'[<a href="https://xkcd.com/404">404</a>] <b>404 Not Found</b>, 1/4/2008',
'html'
)
elseif res ~= 200
then
return mattata.send_reply(
message,
language['errors']['connection']
)
end
local jdat = json.decode(jstr)
return mattata.send_message(
message.chat.id,
string.format(
'[<a href="%s">%s</a>] <b>%s</b>, %s/%s/%s\n<i>%s</i>',
jdat.img,
jdat.num,
mattata.escape_html(jdat.safe_title),
jdat.day,
jdat.month,
jdat.year,
mattata.escape_html(jdat.alt)
),
'html',
false
)
end
return xkcd
|
-- Created by Peyton @ V3rmillion
local LocalPlayer, Characters, ESPList, LocalCharacter = game:GetService('Players').LocalPlayer, workspace.Characters, {}
local Leaderboard = LocalPlayer.PlayerGui.LeaderboardGui.Leaderboard
local function GetTeam(Player)
local Name = Player.Name
for i,v in next, Leaderboard.Teams:GetDescendants() do
if v.Name == 'NameLabel' and v.Text == Name then
return v.Parent.Parent.Parent
end
end
end
local Camera, Div = workspace.CurrentCamera, Vector2.new(2,2)
local function GetNearestToCenter()
local Center = Camera.ViewportSize / Div
local Character, CharacterDistance, ScreenPosition = nil, 0, nil
-- Created by Peyton @ V3rmillion
for i,v in next, Characters:GetChildren() do
if v.Name ~= LocalPlayer.Name and GetTeam(v) ~= GetTeam(LocalPlayer) and v:FindFirstChild('Health') and v.Health.Value > 0 and v:FindFirstChild('Hitbox') and v.Hitbox:FindFirstChild('Head') then
local Position, OnScreen = Camera:WorldToViewportPoint(v.Hitbox.Head.Position)
if OnScreen then
local Vec2 = Vector2.new(Position.X, Position.Y)
local Distance = (Vec2 - Center).magnitude
if not Character or CharacterDistance > Distance then
Character, CharacterDistance, ScreenPosition = v, Distance, Vec2
end
end
end
end
return ScreenPosition and Center and (ScreenPosition - Center) or nil
end
local function NewCircle()
local Circle = Drawing.new('Circle')
Circle.Color = Color3.new(255, 0, 0)
Circle.Filled = true
Circle.Transparency = 0.5
Circle.Visible = true
return Circle
end
-- Created by Peyton @ V3rmillion
local function Add(Character)
if Character == workspace.Characters:FindFirstChild(LocalPlayer.Name) then
LocalCharacter = Character
elseif GetTeam(Character) ~= GetTeam(LocalPlayer) then
ESPList[Character] = NewCircle()
end
end
local function Remove(Character)
if ESPList[Character] then
ESPList[Character]:Remove()
ESPList[Character] = nil
end
end
local UserInputService, AimEnable = game:GetService('UserInputService'), false
local function Update()
for Character,v in next, ESPList do
if Character and Character.Parent ~= Characters then
Remove(Characters)
elseif Character:FindFirstChild('Hitbox') and Character.Hitbox:FindFirstChild('Head') then
local Position, OnScreen = workspace.CurrentCamera:WorldToViewportPoint(Character.Hitbox.Head.Position)
v.Position = Vector2.new(Position.X, Position.Y)
v.Radius = 700 / Position.Z
v.Visible = OnScreen
end
end
if AimEnable and UserInputService.MouseBehavior ~= Enum.MouseBehavior.Default and Characters:FindFirstChild(LocalPlayer.Name) and Characters[LocalPlayer.Name].Health.Value ~= 0 then
local ToMove = GetNearestToCenter()
if ToMove then mousemoverel(ToMove.X, ToMove.Y) end
else
AimEnable = false
end
end
-- Created by Peyton @ V3rmillion
for i,v in next, Characters:GetChildren() do Add(v) end
Characters.ChildAdded:Connect(Add)
Characters.ChildRemoved:Connect(Remove)
game:GetService('RunService').RenderStepped:Connect(Update)
UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.UserInputType == Enum.UserInputType.MouseButton2 then AimEnable = true end end)
UserInputService.InputEnded:Connect(function(input, gameProcessed) if input.UserInputType == Enum.UserInputType.MouseButton2 then AimEnable = false end end)
print("Loaded Good Business by Peyton @ V3rmillion")
|
project_name = 'pcb-printer'
newoption {
trigger = "com",
value = "string",
description = "communication port",
default = 'serial',
allowed = {
{'serial','Serial port'},
{'usb','USB CDC'},
}
}
include 'main'
stm32_solution(project_name)
stm32_project(project_name)
includedirs{ 'src' }
includedirs{ 'platform' }
files {
'src/**',
'platform/gpio.*',
'platform/dma.*',
'platform/timer.*',
'platform/uart.*',
}
if _OPTIONS['com'] == 'usb' then
local usb_desc = require 'usb_descriptor'
local descr_file = usb_desc.descriptor{
VID = 1155,
PID = 22336,
manufacturer = 'DIY',
product = 'STM32 PCB Printer',
serialnumber = '00000000121C',
classes = {'cdc'},
configs = {
{
name = 'cdc_class',
interfaces = {
{
name = 'cdc_control',
class = 'CDC',
subclass = 'ABSTRACT_CONTROL',
protocol = 'AT_COMMANDS',
master = 0,
data_interface = 1,
slaves = { 1 },
endpoints = {
{
idx = 1,
out = true,
size = 8,
attr = 'USBD_EP_TYPE_INTR',
interval = '0x10'
}
}
},
{
name = 'cdc_data',
class = 'DATA',
subclass = 'UNDEFINED',
protocol = 'UNDEFINED',
endpoints = {
{
idx = 2,
out = false,
size = 64,
attr = 'USBD_EP_TYPE_BULK',
},
{
idx = 2,
out = true,
size = 64,
attr = 'USBD_EP_TYPE_BULK',
}
}
}
}
}
}
}
defines {
'USE_USB_COM',
}
files {
descr_file,
'platform/usb.*',
'platform/usb/core/**',
'platform/usb/cdc/**'
}
end
|
--====================================================================--
-- dmc_lua/lua_objects.lua
--
-- Documentation: http://docs.davidmccuskey.com/
--====================================================================--
--[[
The MIT License (MIT)
Copyright (c) 2011-2015 David McCuskey
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.
--]]
--====================================================================--
--== DMC Lua Library : Lua Objects
--====================================================================--
-- Semantic Versioning Specification: http://semver.org/
local VERSION = "1.3.0"
--====================================================================--
--== Lua Objects
--====================================================================--
--====================================================================--
--== Imports
local Class = test
local Objects = require 'lua_class'
local EventsMixModule = require 'lua_events_mix'
--====================================================================--
--== Setup, Constants
local Class = Objects.Class
local registerCtorName = Objects.registerCtorName
local registerDtorName = Objects.registerDtorName
local EventsMix = EventsMixModule.EventsMix
-- Add new Dtor name (function references)
registerDtorName( 'removeSelf', Class )
--====================================================================--
--== Object Base Class
--====================================================================--
local ObjectBase = newClass( { Class, EventsMix }, { name="Object Base" } )
--======================================================--
--== Constructor / Destructor
-- __new__()
-- this method drives the construction flow for DMC-style objects
-- typically, you won't override this
--
function ObjectBase:__new__( ... )
--== Do setup sequence ==--
self:__init__( ... )
-- skip these if a Class object (ie, NOT an instance)
if rawget( self, '__is_class' ) == false then
self:__initComplete__()
end
return self
end
-- __destroy__()
-- this method drives the destruction flow for DMC-style objects
-- typically, you won't override this
--
function ObjectBase:__destroy__()
--== Do teardown sequence ==--
-- skip these if a Class object (ie, NOT an instance)
if rawget( self, '__is_class' ) == false then
self:__undoInitComplete__()
end
self:__undoInit__()
end
--======================================================--
-- Start: Setup Lua Objects
-- __init__
-- initialize the object
--
function ObjectBase:__init__( ... )
--[[
there is no __init__ on Class
-- self:superCall( Class, '__init__', ... )
--]]
self:superCall( EventsMix, '__init__', ... )
--==--
end
-- __undoInit__
-- remove items added during __init__
--
function ObjectBase:__undoInit__()
self:superCall( EventsMix, '__undoInit__' )
--[[
there is no __undoInit__ on Class
-- self:superCall( Class, '__undoInit__' )
--]]
end
-- __initComplete__
-- any setup after object is done with __init__
--
function ObjectBase:__initComplete__()
end
-- __undoInitComplete__()
-- remove any items added during __initComplete__
--
function ObjectBase:__undoInitComplete__()
end
-- END: Setup Lua Objects
--======================================================--
--====================================================================--
--== Public Methods
-- none
--====================================================================--
--== Private Methods
-- none
--====================================================================--
--== Event Handlers
-- none
--====================================================================--
--== Lua Objects Exports
--====================================================================--
-- simply add to current exports
Objects.ObjectBase = ObjectBase
return Objects
|
files
{
"physx/source/scenequery/include/SqPruner.h",
"physx/source/scenequery/include/SqPrunerMergeData.h",
"physx/source/scenequery/include/SqPruningStructure.h",
"physx/source/scenequery/include/SqSceneQueryManager.h",
"physx/source/scenequery/src/SqAABBPruner.cpp",
"physx/source/scenequery/src/SqAABBPruner.h",
"physx/source/scenequery/src/SqAABBTree.cpp",
"physx/source/scenequery/src/SqAABBTree.h",
"physx/source/scenequery/src/SqIncrementalAABBPruner.cpp",
"physx/source/scenequery/src/SqIncrementalAABBPruner.h",
"physx/source/scenequery/src/SqIncrementalAABBPrunerCore.cpp",
"physx/source/scenequery/src/SqIncrementalAABBPrunerCore.h",
"physx/source/scenequery/src/SqIncrementalAABBTree.cpp",
"physx/source/scenequery/src/SqIncrementalAABBTree.h",
"physx/source/scenequery/src/SqAABBTreeUpdateMap.cpp",
"physx/source/scenequery/src/SqAABBTreeUpdateMap.h",
"physx/source/scenequery/src/SqBounds.cpp",
"physx/source/scenequery/src/SqBounds.h",
"physx/source/scenequery/src/SqCompoundPruner.cpp",
"physx/source/scenequery/src/SqCompoundPruner.h",
"physx/source/scenequery/src/SqCompoundPruningPool.cpp",
"physx/source/scenequery/src/SqCompoundPruningPool.h",
"physx/source/scenequery/src/SqBucketPruner.cpp",
"physx/source/scenequery/src/SqBucketPruner.h",
"physx/source/scenequery/src/SqExtendedBucketPruner.cpp",
"physx/source/scenequery/src/SqExtendedBucketPruner.h",
"physx/source/scenequery/src/SqMetaData.cpp",
"physx/source/scenequery/src/SqPruningPool.cpp",
"physx/source/scenequery/src/SqPruningPool.h",
"physx/source/scenequery/src/SqPruningStructure.cpp",
"physx/source/scenequery/src/SqSceneQueryManager.cpp",
"physx/source/scenequery/src/SqTypedef.h"
}
|
ENT.Type = "anim"
ENT.Base = "base_rd3_entity"
ENT.PrintName = "Atmospheric Probe"
list.Set("LSEntOverlayText", "other_probe", {
HasOOO = false,
resnames = {"energy"}
})
|
--[[
frame.lua
A specialized version of the bagnon frame for guild banks
--]]
local MODULE = ...
local ADDON, Addon = MODULE:match('[^_]+'), _G[MODULE:match('[^_]+')]
local Frame = Addon:NewClass('GuildFrame', 'Frame', Addon.Frame)
Frame.Title = LibStub('AceLocale-3.0'):GetLocale(ADDON).TitleBank
Frame.MoneyFrame = Addon.GuildMoneyFrame
Frame.ItemFrame = Addon.GuildItemFrame
Frame.BagFrame = Addon.GuildTabFrame
Frame.CloseSound = SOUNDKIT.GUILD_VAULT_CLOSE
Frame.OpenSound = SOUNDKIT.GUILD_VAULT_OPEN
Frame.Bags = {}
for i = 1, MAX_GUILDBANK_TABS do
Frame.Bags[i] = i
end
--[[ Constructor ]]--
function Frame:New(id)
local f = Addon.Frame.New(self, id)
local log = Addon.LogFrame:New(f)
log:SetPoint('BOTTOMRIGHT', -10, 35)
log:SetPoint('TOPLEFT', 10, -70)
log:Hide()
local edit = Addon.EditFrame:New(f)
edit:SetPoint('BOTTOMRIGHT', -32, 35)
edit:SetPoint('TOPLEFT', 10, -75)
edit:Hide()
f.logToggles = Addon.LogToggle:NewSet(f)
f.log, f.editFrame = log, edit
return f
end
function Frame:RegisterSignals()
Addon.Frame.RegisterSignals(self)
self:RegisterFrameSignal('LOG_SELECTED', 'OnLogSelected')
end
--[[ Events ]]--
function Frame:OnHide()
Addon.Frame.OnHide(self)
StaticPopup_Hide('GUILDBANK_WITHDRAW')
StaticPopup_Hide('GUILDBANK_DEPOSIT')
StaticPopup_Hide('CONFIRM_BUY_GUILDBANK_TAB')
CloseGuildBankFrame()
end
function Frame:OnLogSelected(_, logID)
self.itemFrame:SetShown(not logID)
self.editFrame:SetShown(logID == 3)
self.log:SetShown(logID and logID < 3)
end
--[[ Proprieties ]]--
function Frame:ListMenuButtons()
for i, toggle in ipairs(self.logToggles) do
tinsert(self.menuButtons, toggle)
end
Addon.Frame.ListMenuButtons(self)
end
function Frame:HasOwnerSelector() end
function Frame:HasSortButton() end
function Frame:HasBagToggle() end
function Frame:IsBagFrameShown()
return true
end
function Frame:GetOwner()
return self.owner or LibStub('LibItemCache-2.0'):GetOwnerInfo().guild
end
|
inpt = input.get()
old = {}
local screen = 0
local subscr = 0
local writes = true
while true do
old = inpt
inpt = input.get()
if not inpt['control'] then
if inpt.down and not old.down then
screen = screen - 1
elseif inpt.up and not old.up then
screen = screen + 1
elseif inpt.left and not old.left then
subscr = subscr - 1
elseif inpt.right and not old.right then
subscr = subscr + 1
elseif inpt.Z and not old.Z then
writes = not writes
end
end
if writes then
gui.text(1, 0, string.format("%02X %02X", screen, subscr))
memory.writebyte(0xD634, screen) -- se
memory.writebyte(0xD635, subscr) -- unknown
else
gui.text(1, 0, string.format("%02X %02X", screen, subscr), 0xFFFFFFB0, 0x00000030)
gui.text(1, 7, string.format("%02X %02X", memory.readbyte(0xD634), memory.readbyte(0xD635)))
end
emu.frameadvance()
end
|
game:DefineFastFlag("FixDialogServerWait", false)
return function()
return game:GetFastFlag("FixDialogServerWait")
end
|
local lsp = require "interrato.lsp"
require("lspconfig").texlab.setup {
on_attach = lsp.on_attach,
capabilities = lsp.capabilities,
flags = {
debounce_text_changes = 150,
},
settings = {
texlab = {
auxDirectory = ".",
bibtexFormatter = "texlab",
build = {
args = { "%f" },
executable = "tectonic",
forwardSearchAfter = false,
onSave = false,
},
}
}
}
|
includeFile("tangible/wearables/cape/cape_s01.lua")
|
-- --------------------
-- TellMeWhen
-- Originally by Nephthys of Hyjal <lieandswell@yahoo.com>
-- Other contributions by:
-- Sweetmms of Blackrock, Oozebull of Twisting Nether, Oodyboo of Mug'thol,
-- Banjankri of Blackrock, Predeter of Proudmoore, Xenyr of Aszune
-- Currently maintained by
-- Cybeloras of Aerie Peak
-- --------------------
if not TMW then return end
local TMW = TMW
local L = TMW.L
local print = TMW.print
local SUG = TMW.SUG
local strlowerCache = TMW.strlowerCache
local GetSpellTexture = TMW.GetSpellTexture
local Type = rawget(TMW.Types, "guardian")
if not Type then return end
local Module = SUG:NewModule("guardian", SUG:GetModule("default"))
Module.noMin = true
Module.showColorHelp = false
Module.helpText = L["SUG_TOOLTIPTITLE_GENERIC"]
function Module:OnInitialize()
self.Table = {}
end
function Module:OnSuggest()
wipe(self.Table)
Type:RefreshNames()
for npcID, data in pairs(Type.GuardianInfo) do
self.Table[npcID] = strlowerCache[data.name]
end
end
function Module:Table_Get()
return self.Table
end
function Module:Entry_AddToList_1(f, id)
local data = Type.GuardianInfo[id]
local name = data.name
local triggerSpellName = GetSpellInfo(data.triggerSpell)
if data.nameKnown then
f.insert = SUG.inputType == "number" and id or name
f.insert2 = SUG.inputType ~= "number" and id or name
else
f.insert = id
end
f.tooltiptitle = name
f.tooltiptext = L["ICONMENU_GUARDIAN_TRIGGER"]:format(triggerSpellName or "<Invalid spell " .. data.triggerSpell .. ">")
f.Name:SetText(name)
f.ID:SetText(id)
f.Icon:SetTexture(data.texture)
end
|
include('shared.lua')
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("vestbox.lua")
AddCSLuaFile("shared.lua")
function ENT:SpawnFunction(ply, tr)
if (not tr.HitWorld) then return end
local ent = ents.Create("sent_vurt_supplybox")
ent:SetPos(tr.HitPos + Vector(0, 0, 15))
ent:Spawn()
return ent
end
ENT.ThermiteAmmoTimer=0
function ENT:Initialize()
if (self.Entity:GetModel()=="models/error.mdl") then
self.Entity:SetModel( "models/items/item_item_crate.mdl")
self:SetNWBool("GiveAmmo",true)
self:SetNWBool("GiveSuppressors",true)
self:SetNWBool("GiveOptics",true)
self:SetNWBool("GiveLights",true)
self:SetNWBool("GunRack",true)
self:SetNWBool("GiveArmor",true)
self:SetNWBool("Equipment",true)
self:SetNWBool("Suitcase",false)
end
self.Entity:PhysicsInit( SOLID_VPHYSICS)
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
self.Entity:SetUseType(SIMPLE_USE)
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self.GunList={}
end
function ENT:Thermite()
if (self.ThermiteAmmoTimer>0) then return end
if (self:GetNWBool("GiveAmmo")) then
self:Ignite(100)
self.ThermiteAmmoTimer=CurTime()+80
else
self:Ignite(10)
self.ThermiteAmmoTimer=1
end
self:SetNWBool("GiveAmmo",false)
self:SetNWBool("GiveSuppressors",false)
self:SetNWBool("GiveOptics",false)
self:SetNWBool("GiveLights",false)
self:SetNWBool("GunRack",false)
self:SetNWBool("GiveArmor",false)
self:SetNWBool("Suitcase",false)
self:SetNWBool("Equipment",false)
end
function ENT:Use(activator,caller)
self:UseBox(activator,caller)
end
function ENT:UseBox( activator, caller )
if (IsValid(activator) and activator:IsPlayer() ) then
net.Start("kswep_setequipment_cl")
net.WriteString(activator.KswepLBEType)
net.WriteString(activator.KswepLBEAddonType)
net.Send(activator)
local wep=activator:GetActiveWeapon()
if (wep:IsValid() and string.find(wep:GetClass(),"weapon_kswep")) then
local canmag=false
if (wep.MagType or wep.SingleReload) then
canmag=true
end
local canoptic=false
if ((wep.DefaultSight or wep.NoDefaultSightModel) and not wep.NoOpticMounting) then
canoptic=true
end
local can2doptic=false
if (wep.Has2DOptics) then
can2doptic=true
end
if (canmag or canoptic) then
net.Start("kswep_supplybox")
net.WriteEntity(self)
net.WriteEntity(wep)
--net.WriteTable(vurtual_ammodata)
net.WriteBool(canmag)
net.WriteBool(canoptic)
net.WriteBool(can2doptic)
net.WriteTable(self.GunList)
net.Send(activator)
end
elseif (self:GetNWBool("GunRack")) then
net.Start("kswep_gunrack")
net.WriteEntity(self)
net.WriteTable(self.GunList)
net.Send(activator)
end
end
end
function ENT:UseMagBox( activator, caller )
if ( activator:IsPlayer() ) then
local wep=activator:GetActiveWeapon()
if (wep:IsValid() and string.find(wep:GetClass(),"weapon_kswep")) then
if (wep.MagType or wep.SingleReload) then
net.Start("kswep_rearm")
net.WriteEntity(self)
net.WriteEntity(wep)
net.WriteTable(vurtual_ammodata)
net.Send(activator)
end
end
end
end
function ENT:UseOpticBox(activator,caller)
if ( activator:IsPlayer() ) then
local wep=activator:GetActiveWeapon()
if (wep:IsValid() and string.find(wep:GetClass(),"weapon_kswep")) then
if (wep.DefaultSight or wep.NoDefaultSightModel) then
net.Start("kswep_opticbox")
net.WriteEntity(self)
net.WriteEntity(wep)
net.Send(activator)
end
end
end
end
function ENT:Think()
if (self.ThermiteAmmoTimer>CurTime() and math.random()>0.8) then
self:EmitSound("npc_floorturret.shoot")
end
end
function ENT:HasGun(wep)
return table.HasValue(self.GunList,wep)
end
function ENT:RackGun(wep)
table.insert(self.GunList,wep)
end
function ENT:RemoveGun(wep)
table.RemoveByValue(self.GunList,wep)
end
|
local playsession = {
{"Kruv", {107962}},
{"Food_lp", {52840}}
}
return playsession
|
--- @class GIVideoWriter
--- This is returned from video.Record.
local GIVideoWriter = {}
--- Adds the current framebuffer to the video stream.
--- @param frameTime number @Usually set to what Global.FrameTime is, or simply 1/fps.
--- @param downsample boolean @If true it will downsample the whole screenspace to the videos width and height, otherwise it will just record from the top left corner to t
function GIVideoWriter:AddFrame(frameTime, downsample)
end
--- Ends the video recording and dumps it to disk.
function GIVideoWriter:Finish()
end
--- Returns the height of the video stream.
--- @return number @height
function GIVideoWriter:Height()
end
--- Sets whether to record sound or not.
--- @param record boolean @Record.
function GIVideoWriter:SetRecordSound(record)
end
--- Returns the width of the video stream.
--- @return number @width
function GIVideoWriter:Width()
end
|
-- Copyright 2021 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
local test = require "integration_test"
local capabilities = require "st.capabilities"
local constants = require "st.zwave.constants"
local zw = require "st.zwave"
local zw_test_utils = require "integration_test.zwave_test_utils"
local SwitchMultilevel = (require "st.zwave.CommandClass.SwitchMultilevel")({ version = 4 })
local t_utils = require "integration_test.utils"
local inovelli_dimmer_endpoints = {
{
command_classes = {
{ value = zw.BASIC },
{ value = zw.SWITCH_MULTILEVEL }
}
}
}
local mock_inovelli_dimmer = test.mock_device.build_test_zwave_device({
profile = t_utils.get_profile_definition("inovelli-dimmer.yml"),
zwave_endpoints = inovelli_dimmer_endpoints
})
local function test_init()
test.mock_device.add_test_device(mock_inovelli_dimmer)
end
test.set_test_init_function(test_init)
test.register_message_test(
"Added lifecycle event should be handled",
{
{
channel = "device_lifecycle",
direction = "receive",
message = { mock_inovelli_dimmer.id, "added" }
},
{
channel = "zwave",
direction = "send",
message = zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Get({})
)
},
},
{
inner_block_ordering = "relaxed"
}
)
test.register_message_test(
"Refresh Capability Command should refresh device",
{
{
channel = "capability",
direction = "receive",
message = {
mock_inovelli_dimmer.id,
{ capability = "refresh", command = "refresh", args = {} }
}
},
{
channel = "zwave",
direction = "send",
message = zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Get({})
)
},
},
{
inner_block_ordering = "relaxed"
}
)
test.register_message_test(
"Z-Wave SwitchMultilevel reports with value-off should evoke Switch capability off events",
{
{
channel = "zwave",
direction = "receive",
message = {
mock_inovelli_dimmer.id,
zw_test_utils.zwave_test_build_receive_command(
SwitchMultilevel:Report({
current_value = 0,
target_value = SwitchMultilevel.value.OFF_DISABLE,
duration = 0
})
)
}
},
{
channel = "capability",
direction = "send",
message = mock_inovelli_dimmer:generate_test_message("main", capabilities.switch.switch.off())
}
},
{
}
)
do
local level = 60
test.register_message_test(
"Z-Wave SwitchMultilevel reports with non-zero values should evoke Switch and Switch Level capability events",
{
{
channel = "zwave",
direction = "receive",
message = {
mock_inovelli_dimmer.id,
zw_test_utils.zwave_test_build_receive_command(
SwitchMultilevel:Report({
current_value = 0,
target_value = level,
duration = 0
})
)
}
},
{
channel = "capability",
direction = "send",
message = mock_inovelli_dimmer:generate_test_message("main", capabilities.switch.switch.on())
},
{
channel = "capability",
direction = "send",
message = mock_inovelli_dimmer:generate_test_message("main", capabilities.switchLevel.level(level))
}
}
)
end
test.register_coroutine_test(
"Switch capability off commands should evoke the correct Z-Wave SETs and GETs",
function()
test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot")
test.socket.capability:__queue_receive({
mock_inovelli_dimmer.id,
{ capability = "switch", command = "off", args = {} }
})
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Set({
value = SwitchMultilevel.value.OFF_DISABLE,
duration = constants.DEFAULT_DIMMING_DURATION
})
)
)
test.wait_for_events()
test.mock_time.advance_time(1)
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Get({})
)
)
end
)
test.register_coroutine_test(
"Switch capability on commands should evoke the correct Z-Wave SETs and GETs",
function()
test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot")
test.socket.capability:__queue_receive({
mock_inovelli_dimmer.id,
{ capability = "switch", command = "on", args = {} }
})
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Set({
value = SwitchMultilevel.value.ON_ENABLE,
duration = constants.DEFAULT_DIMMING_DURATION
})
)
)
test.wait_for_events()
test.mock_time.advance_time(1)
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Get({})
)
)
end
)
do
local level = 49
test.register_coroutine_test(
"SwitchLevel capability setLevel commands should evoke the correct Z-Wave SETs and GETs",
function()
test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot")
test.socket.capability:__queue_receive({
mock_inovelli_dimmer.id,
{ capability = "switchLevel", command = "setLevel", args = { level } }
})
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Set({
value = level,
duration = constants.DEFAULT_DIMMING_DURATION
})
)
)
test.wait_for_events()
test.mock_time.advance_time(1)
test.socket.zwave:__expect_send(
zw_test_utils.zwave_test_build_send_command(
mock_inovelli_dimmer,
SwitchMultilevel:Get({})
)
)
end
)
end
test.run_registered_tests()
|
require("RequireUnity")
require("framework/utility/Event")
require("framework/utility/Timer")
require("framework/utility/Coroutine")
require("framework/utility/Class")
require("framework/utility/Global")
require("framework/utility/TableExtend")
require("framework/utility/PlayerPrefsUtils")
require("AutoRequireConfig")
require("RequireConfig")
addRequire("RequireUI")
--框架
addRequire("framework/MonoComponent")
addRequire("framework/ui/BaseComponent")
addRequire("framework/ui/BaseComponent")
addRequire("framework/ui/BaseWindow")
addRequire("framework/ui/BaseWindowExtend")
addRequire("framework/ui/UIConfig")
addRequire("framework/ui/UIManager")
addRequire("framework/ui/UIGlobal")
addRequire("framework/ui/UIRequire")
addRequire("framework/ui/UIUtil")
addRequire("framework/messager/Msg")
addRequire("framework/messager/MsgCenter")
addRequire("framework/messager/Messager")
|
slot0 = class("StoryAnimtion")
slot0.Ctor = function (slot0, slot1)
slot0.tweens = {}
slot0.timers = {}
slot0.timeScale = 1
end
slot0.SetTimeScale = function (slot0, slot1)
slot0.timeScale = slot1
end
slot0.TweenMove = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.move(rtf(slot0), , slot2 * slot3.timeScale)
if slot3.timeScale > 1 then
slot0:setLoopPingPong(slot4)
end
if slot5 then
slot0:setOnComplete(System.Action(slot5))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.TweenScale = function (slot0, slot1, slot2, slot3, slot4, slot5)
slot0.DelayCall(slot0, slot4, function ()
slot0 = LeanTween.scale(rtf(slot0), , slot2 * slot3.timeScale)
if slot3.timeScale then
slot0:setOnComplete(System.Action(slot4))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.TweenRotate = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.rotate(rtf(slot0), , slot2 * slot3.timeScale):setLoopPingPong(slot3.timeScale)
if slot5 then
slot0:setOnComplete(System.Action(slot5))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.TweenValueForcanvasGroup = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.value(go(slot0), , , slot3 * slot4.timeScale):setOnUpdate(System.Action_float(function (slot0)
slot0.alpha = slot0
end))
if slot4.timeScale then
slot0.setOnComplete(slot0, System.Action(slot5))
end
table.insert(slot4.tweens, slot0.gameObject.transform)
end)
end
slot0.TweenValue = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.value(go(slot0), , , slot3 * slot4.timeScale):setOnUpdate(System.Action_float(slot4.timeScale))
if slot6 then
slot0:setOnComplete(System.Action(function ()
if slot0 then
slot0()
end
end))
end
table.insert(slot4.tweens, slot0)
end)
end
slot0.TweenValueLoop = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.value(go(slot0), , , slot3 * slot4.timeScale):setOnUpdate(System.Action_float(slot4.timeScale)):setLoopClamp()
if slot6 then
slot0:setOnComplete(System.Action(function ()
if slot0 then
slot0()
end
end))
end
table.insert(slot4.tweens, slot0)
end)
end
slot0.TweenTextAlpha = function (slot0, slot1, slot2, slot3, slot4, slot5)
slot0.DelayCall(slot0, slot4, function ()
slot0 = slot0(slot1, slot2, (LeanTween.textAlpha or 1) * LeanTween.textAlpha or 1.timeScale)
if LeanTween.textAlpha or 1.timeScale then
slot0:setOnComplete(System.Action(slot4))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.TweenAlpha = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.alpha(LeanTween.alpha, , slot2 * slot3.timeScale):setFrom(slot3.timeScale)
if slot5 then
slot0:setOnComplete(System.Action(slot5))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.TweenMovex = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.moveX(LeanTween.moveX, , slot2 * slot3.timeScale):setFrom(slot3.timeScale)
if slot5 then
slot0:setLoopPingPong(slot5)
end
if slot6 then
slot0:setOnComplete(System.Action(slot6))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.TweenMovey = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7)
slot0.DelayCall(slot0, slot5, function ()
slot0 = LeanTween.moveY(LeanTween.moveY, , slot2 * slot3.timeScale):setFrom(slot3.timeScale)
if slot5 then
slot0:setLoopPingPong(slot5)
end
if slot6 then
slot0:setOnComplete(System.Action(slot6))
end
table.insert(slot3.tweens, slot0)
end)
end
slot0.IsTweening = function (slot0, slot1)
return LeanTween.isTweening(slot1)
end
slot0.CancelTween = function (slot0, slot1)
if slot0:IsTweening(slot1) then
LeanTween.cancel(slot1)
end
end
slot0.DelayCall = function (slot0, slot1, slot2)
if not slot1 or slot1 <= 0 then
slot2()
return
end
slot0.timers[slot2] = StoryTimer.New(function ()
slot0.timers[slot1]:Stop()
slot0.timers[slot1].Stop.timers[slot0.timers[slot1]] = nil
slot0.timers[slot1]()
end, slot1 * slot0.timeScale, 1)
slot0.timers[slot2].Start(slot3)
end
slot0.UnscaleDelayCall = function (slot0, slot1, slot2)
if slot1 <= 0 then
slot2()
return
end
slot0.timers[slot2] = StoryTimer.New(function ()
slot0.timers[slot1]:Stop()
slot0.timers[slot1].Stop.timers[slot0.timers[slot1]] = nil
slot0.timers[slot1]()
end, slot1, 1)
slot0.timers[slot2]:Start()
end
slot0.CreateDelayTimer = function (slot0, slot1, slot2)
if slot1 == 0 then
slot2()
return nil
end
slot3 = StoryTimer.New(slot2, slot1 * slot0.timeScale, 1)
slot3:Start()
return slot3
end
slot0.PauseAllTween = function (slot0)
for slot4, slot5 in ipairs(slot0.tweens) do
if not IsNil(slot5) and slot0:IsTweening(slot5.gameObject) then
LeanTween.pause(slot5.gameObject)
end
end
end
slot0.ResumeAllTween = function (slot0)
for slot4, slot5 in ipairs(slot0.tweens) do
if not IsNil(slot5) then
LeanTween.resume(slot5.gameObject)
end
end
end
slot0.PauseAllTimer = function (slot0)
for slot4, slot5 in pairs(slot0.timers) do
slot5:Pause()
end
end
slot0.ResumeAllTimer = function (slot0)
for slot4, slot5 in pairs(slot0.timers) do
slot5:Resume()
end
end
slot0.ResumeAllAnimation = function (slot0)
slot0:ResumeAllTween()
slot0:ResumeAllTimer()
end
slot0.PauseAllAnimation = function (slot0)
slot0:PauseAllTween()
slot0:PauseAllTimer()
end
slot0.ClearAllTween = function (slot0)
for slot4, slot5 in ipairs(slot0.tweens) do
if not IsNil(slot5) and slot0:IsTweening(slot5.gameObject) then
LeanTween.cancel(slot5.gameObject)
end
end
slot0.tweens = {}
end
slot0.ClearAllTimers = function (slot0)
for slot4, slot5 in pairs(slot0.timers) do
slot5:Stop()
end
slot0.timers = {}
end
slot0.ClearAnimation = function (slot0)
slot0:ClearAllTween()
slot0:ClearAllTimers()
end
return slot0
|
util.AddNetworkString("replay_setManipulating")
util.AddNetworkString("replay_setVelocity")
net.Receive("replay_setManipulating",function(len,ply)
local status = net.ReadBool()
if ply.recorderObject then
if status then
ply:Lock()
ply.recorderObject:startManipulating()-- and stop recording
else
local targetFrame,frameID = ply.recorderObject:getFrameFromCommandNumber(net.ReadInt(24))
ply:UnLock()
if targetFrame then
ply.recorderObject:jumpToAbsoluteFrame(frameID)
ply.recorderObject:stopManipulating()
local frame = ply.recorderObject:getCurrentFrame()
ply:SetPos(frame.position)
ply:SetEyeAngles(frame.eyeAngles)
ply:SetVelocity(frame.velocity)
--ply:SetHealth(frame.health)
--ply:SetArmor(frame.armor)
else
Replay:logError("Unreasonable replay request from "..ply:Nick())-- should never happen
end
end
end
end)
net.Receive("replay_setVelocity",function(len,ply)
ply.replay_velocity = net.ReadInt(8)
end)
|
-- Copyright (c) 2020 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
describe("moonpie.tables.sum", function()
local tables = require "moonpie.tables"
it("adds all the elements of an array together", function()
local s = tables.sum{ 1, 2, 3, 4, 5}
assert.equals(15, s)
end)
it("can be provided a function to return an integer that performs the sum", function()
local s = tables.sum({ 1, 2, 3, 4, 5}, function(v) return v / 2 end)
assert.equals(7.5, s)
end)
end)
|
script.Parent = nil
it = Instance.new
v3=Vector3.new
bc=BrickColor.new
c3=Color3.new
cn=CFrame.new
ca=CFrame.Angles
ti=table.insert
tr=table.remove
rn=math.random
rd=math.rad
mf=math.floor
ud = UDim2.new
enter = ""
--22436106
asset = "http://www.roblox.com/asset/?id="
ds = {}
ds.Ribs = "63216320"
ds.Flag = "1038492"
ds.BrickWall = "73398218"
ds.Bag="16657069"
ds.Explode1 = "2101148"
ds.Flame = "31760113"
ds.Tile = "71176306"
ds.Shuriken = "11112101"
ds.ShurikenT = "21343902"
ds.EnergySlash1 = "10209303"
ds.EnergySlash2 = "10209280"
ds.EnergyClawT= "11996882"
ds.EnergyClaw = "11996935"
ds.Imbue = "2785493"
ds.Abscond = "2767090"
ds.SplinteredSkyT="50798688"
ds.SplinteredSky="50798664"
ds.Tornado = "1051557"
ds.SpikeBall = "9982590"
ds.Fist = "65322375"
ds.RedCliffT = "49754754"
ds.RedCliff = "49754655"
ds.Chakram = "18430887"
ds.Chakram2 = "47260990"
ds.Chakram3 = "19251107"
ds.Diamond = "9756362"
ds.Sword1 = "rbxasset://fonts/s" .. "word.mesh"
ds.Claw = "10681506"
ds.Ring = "3270017"
ds.Crack = "49173398"
ds.Cloud = "1095708"
ds.Spike = "1033714"
ds.Rock = "1290033"
ds.Crown2 = "1323306"
ds.Crown = "20329976"
ds.Hood = "16952952"
ds.Slash = "10209645"
ds.Slash2 = "46760716"
ds.MadFace = "2235131"
ds.BanditMask = "20637493"
ds.Hood2 = "25211365"
ds.HoodT2 = "64240784"
ds.NoobMesh = "20929341"
ds.NoobMeshT = "20929335"
ds.Axe = "12768042"
ds.AxeT = "12768034"
ds.RoadLine = "72777152"
ds.LineTile = "72777172"
ds.Tile1 = "72773094"
ds.Fist = "65322375"
ds.Tree1 = "1090398"
ds.Vine = "13108500"
ds.VineT = "17585271"
ds.TreeTexture = "2861779"
ds.Tug = "31173820" -- sound
ds.Fire = "2693346" --"2760979"
ds.Hit = "2801263"
ds.BulletHole = "64291961"
ds.Camo = "4268107"
ds.Gradient1 = "70060415"
ds.Gradient2 = "48965808"
ds.clicksound = "14863866"
ds.DWrench = "70628302"
ds.DHealth = "70635804"
ds.DOrbTray = "70642795"
ds.DLog = "70650545"
ds.DCompass = "70652520"
ds.DRadar = "70652524"
ds.DGlassButton = "64605912"
ds.DDebug = "70654424"
ds.DRefresh = "70655469"
ds.DClock = "70657533"
ds.DClose = "70657543"
ds.DDebugClean = "70657552"
ds.DDebugMessage = "70657560"
ds.DBrick = "70657656"
ds.DBolt = "70660034"
ds.DHeartbreak = "70660720"
ds.SpawnTexture = "rbxasset://Textures/SpawnLocation.png"
ds.DFolder = "70670539"
ds.DPerson = "70670507"
ds.DUpButton = "70728132"
ds.DDownButton = "70728084"
ds.DOrb = "64596050"
ds.DWidget = "70747254"
ds.DCmd = "70749687"
ds.DAntiVirus = "70749678"
ds.DCheck = "70749683"
ds.DCross = "70749685"
ds.DPin = "70810690"
ds.DDanger = "70810890"
ds.DNoTools = "70813888"
ds.DNoBackpack = "70813897"
ds.DPlay = "70859585"
ds.DRadarSignal = "70868136"
ds.DRadarFace = "70869351"
ds.DFolderAdd = "70907152"
ds.DAdd = "70920549"
ds.DClockFrame = "70927569"
ds.DShutdown = "70927576"
ds.DBlackDot = ds.Gradient1
ds.DBack = "70929878"
ds.DCalculator = "71659259"
ds.DExplorer = "71659307"
limbweld = {}
limbweld["Right Shoulder"] = {}
limbweld["Right Shoulder"].C0 = cn(1,0.5,0,0,0,1,0,1,0,-1,-0,-0)
limbweld["Right Shoulder"].C1 = cn(-0.5,0.5,0,0,0,1,0,1,0,-1,0,0)
limbweld["Right Shoulder"].ps = {"Torso","Right Arm"}
limbweld["Left Shoulder"] = {}
limbweld["Left Shoulder"].C0 = cn(-1,0.5,0,0,0,-1,0,1,0,1,0,0)
limbweld["Left Shoulder"].C1 = cn(0.5,0.5,0,0,0,1,0,1,0,1,0,0)
limbweld["Left Shoulder"].ps = {"Torso","Left Arm"}
limbweld["Right Hip"] = {}
limbweld["Right Hip"].C0 = cn(1,-1,0,0,0,1,0,1,0,-1,0,0)
limbweld["Right Hip"].C1 = cn(0.5,1,0,0,0,1,0,1,0,-1,0,0)
limbweld["Right Hip"].ps = {"Torso","Right Leg"}
limbweld["Left Hip"] = {}
limbweld["Left Hip"].C0 = cn(-1,-1,0,0,0,-1,0,1,0,1,0,0)
limbweld["Left Hip"].C1 = cn(-0.5,1,0,0,0,-1,0,1,0,1,0,0)
limbweld["Left Hip"].ps = {"Torso","Left Leg"}
limbweld["Neck"] = {}
limbweld["Neck"].C0 = cn(0,1,0,-1,0,0,0,0,1,0,1,0)
limbweld["Neck"].C1 = cn(0,-0.5,0,-1,0,0,0,0,1,0,1,0)
limbweld["Neck"].ps = {"Torso","Head"}
qi = function(ttz) -- instance v2
local qii = it(ttz[1]) table.foreach(ttz,function(oi,oi2)
if oi ~= 1 and oi ~= 2 then qii[oi] = oi2 end end) qii.Parent=ttz[2] return qii end
table.foreach(ds,function(a,b) -- asset loader
if tonumber(b:sub(1,3)) then ds[a] = asset .. b game:service'ContentProvider':Preload(ds[a]) end end)
q = function(f) -- quick coroutine function
coroutine.resume(coroutine.create(function() f() end)) end
ft = function(tablez,item) -- table finder
for i=1,#tablez do if tablez[i] == item then return i end end return nil end
ft2 = function(tablez,item) -- table finder 2
for i=1,#tablez do if tablez[i][1] == item then return i end end return nil end
pa = function(pa,pn,sh,x,y,z,c,a,tr,re,bc2) -- part maker
local fp=nil
if sh ~= "Wedge" and sh ~= "CornerWedge" and sh ~= "VehicleSeat" and sh ~= "Seat" then
fp=it("Part",pa)
fp.Material = "SmoothPlastic"
fp.Shape=sh or "Block"
fp.formFactor="Custom"
elseif sh == "Wedge" then
fp=it("WedgePart",pa)
fp.formFactor="Custom"
elseif sh == "CornerWedge" then
fp=it("CornerWedgePart",pa)
elseif sh == "VehicleSeat" then
fp=it("VehicleSeat",pa)
elseif sh == "Seat" then
fp=it("Seat",pa)
for _, Surf in pairs(Surfaces) do
fp[Surf] = "SmoothNoOutlines"
end
end
fp.Size=v3(x or 4,y or 2,z or 2)
fp.CanCollide=c
fp.Anchored=a or false
fp.BrickColor=bc(bc2 or "")
fp.Transparency=tr or 0
fp.Reflectance=re or 0
fp.BottomSurface=0
fp.Name=pn or "UnNamed"
fp.Locked = true
fp.TopSurface=0
fp.CFrame = cn(-9000,9000,-9000)
fp:BreakJoints()
fp.Anchored = a
return fp
end
fadeid=-100000
fade = function(prt,incr,wai)
fadeid=fadeid+1
FFade[fadeid] = {prt,incr or 0.1,wai or 0,tick()}
end
stick = function(hit2,hit) -- stick function
return qi({"Weld",hit2,Part0=hit2,Part1=hit,C0=hit2.CFrame:inverse()*cn(hit2.Position),C1=hit.CFrame:inverse()*cn(hit2.Position)}) end
ray = function(Pos, Dir,tab) -- ray cast
return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit *999),tab) end
Trail = function(ob,times,waitz,col,thickz,ofz) -- Brick Trail
q(function()
local oldpos=(ob.CFrame *ofz).p
for i=1,times do
local obp=(ob.CFrame *ofz).p
local mag=(oldpos - obp).magnitude
local tr=pa(ob,"trail","Block",0,0,0,false,false,0.5,0.15,col)
tr.Anchored=true
tr.CFrame=cn(oldpos,obp)
tr.CFrame=tr.CFrame + tr.CFrame.lookVector* (mag/2)
local trm=it("CylinderMesh",tr)
trm.Scale=v3(5*thickz,mag*5,5*thickz)
q(function()
for i=5*thickz,0,-5*thickz/10 do
trm.Scale=v3(i,mag*5,i)
wait()
end
tr:Remove''
end)
tr.CFrame=tr.CFrame *ca(rd(90),0,0)
oldpos=obp wait(waitz)
end
end)
end
de = function(it,ti) game:service'Debris':AddItem(it,ti) end -- Debris
gmid = -100000
GlowMesh = function(anch,meshid2,rootz,mv3,colzz,adjus,l1,l2,l3) -- Glowmesh
local spi=pa(rootz,"","Block",1,1,1,false,false,l1,0,colzz) local spim=it("SpecialMesh",spi) if meshid2:lower()=="sphere" then spim.MeshType="Sphere" elseif meshid2:lower()=="block" then spim:Remove() spim=qi({"BlockMesh",spi}) else spim.MeshType="FileMesh" spim.MeshId=meshid2 end
if anch then local spiw=qi({"Weld",spi,Part0=rootz,Part1=spi}) spiw.C0 =spiw.C0 *adjus else spi.Anchored=true spi.CFrame=adjus end
gmid=gmid+1 GMesh[tostring(gmid)] = {spi,spim,l1,l2,l1,mv3}
end
DetectSurface = function(pos, part) -- Surface Detector
local surface = nil local pospos = part.CFrame
local pos2 = pospos:pointToObjectSpace(pos) local siz = part.Size local shaep = part.Shape
if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then
surface = {"Anything", cn(pospos.p, pos)*cn(0, 0, -(pospos.p - pos).magnitude+0.12)*ca(rd(-90), 0, 0)}
else if pos2.Y > ((siz.Y/2)-0.01) then surface = {"Top", ca(0, 0, 0)}
elseif pos2.Y < -((siz.Y/2)-0.01) then surface = {"Bottom", ca(-math.pi, 0, 0)} elseif pos2.X > ((siz.X/2)-0.01) then surface = {"Right", ca(0, 0, rd(-90))}
elseif pos2.X < -((siz.X/2)-0.01) then surface = {"Left", ca(0, 0, rd(90))} elseif pos2.Z > ((siz.Z/2)-0.01) then surface = {"Back", ca(rd(90), 0, 0)} elseif pos2.Z < -((siz.Z/2)-0.01) then surface = {"Front", ca(rd(-90), 0, 0)} end end return surface end
BulletHole = function(HitPos,HitObj,sc,img,par) -- Bullethole function
local Surface = DetectSurface(HitPos, HitObj)
local C = cn(HitPos) * ca(HitObj.CFrame:toEulerAnglesXYZ()) * Surface[2]
if Surface[1] == "Anything" then C = Surface[2] end local theimg = img or ds.BulletHole
local bl = pa(workspace or par,"bullethole","Block",sc,0,sc,false,true,1,0,"") qi({"Decal",bl,Face="Top",Texture=theimg})
bl.CFrame = C*cn(0,-0.1,0) if not HitObj.Anchored then bl.Anchored = false stick(bl,HitObj) bl.ChildRemoved:connect(function() bl:Remove() end) end de(bl,5)
end
Dmg = function(hum,dmg)
hum.Health=hum.Health-dmg
end
so = function(id,par,vol,pit) q(function() -- Sound maker
local sou = qi({"Sound",par or workspace,Volume=vol/1.5 or 0.75,Pitch=pit or 1,SoundId=id})
wait() sou:play() wait(6) sou:Remove() end) end
GetRegion = function(p0,p1,f,f2) -- range get
q(function()
for i,v in pairs(workspace:FindPartsInRegion3(Region3.new(p0,p1),nil,100)) do
if v.Parent:findFirstChild("H") == nil and v.Name == "Torso" and fc(v.Parent,"Humanoid") and fc(v.Parent,"Humanoid").Health > 0 then
q(function() f(v.Parent) end)
elseif f2 and fc(v.Parent,"Humanoid") == nil then f2(v) end end end) end
ForceBrick = function(ob,roo,fo) if ob.Anchored then return end ob:BreakJoints() ob.Velocity=cn(roo,ob.Position).lookVector*fo end
SplashDmg = function(cf,ran,damg,forc,fa)
pcall(function() cf = cf.p end) local rr = ran
GetRegion(cf-v3(rr,rr,rr),cf+v3(rr,rr,rr),function(v) if v~=fa and (v.Torso.Position-cf).magnitude<(rr*2) then
Dmg(fc(v,"Humanoid"),damg) if forc and forc>0 then
local bpp = qi({"BodyVelocity",v.Torso,maxForce=v3(1/0,1/0,1/0),velocity=cn(cf,v.Torso.Position+v3(0,0.5,0)).lookVector*forc}) wait(0.2) bpp:Remove()
end end end)
end
DetectRange = function(cf,ran,fa)
pcall(function() cf = cf.p end) local rr = ran theboom = false
GetRegion(cf-v3(rr,rr,rr),cf+v3(rr,rr,rr),function(v) if v~=fa and (v.Torso.Position-cf).magnitude<(rr*2) then theboom=true end end)
return theboom end
FindGround = function(pos) -- ground finder
local ax,ay,az = pos:toEulerAnglesXYZ()
local bhit,bpos=ray(pos.p,pos.p - (pos.p + v3(0,200,0)))
if bhit and bpos then
return cn(bpos)*ca(ax,ay,az)
end
return nil
end
MakeCrater = function(pos,sc,tyms,debz,par) -- crater maker
q(function()
if not debz then
debz = 5
end
local bhit,bpos=ray(pos,pos - (pos + v3(0,200,0)))
if bhit and bpos then
for i=1,tyms do
q(function()
local gr = pa(par or workspace,"","Block",rn(5,13)/10*sc,0.25*sc,rn(4,10)/10*sc,true,true,bhit.Transparency,bhit.Reflectance,bhit.BrickColor.Name)
gr.Material = bhit.Material
gr.TopSurface = bhit.TopSurface
gr.CFrame = cn(bpos+v3(rn(-12,12)/10*sc,0,rn(-12,12)/10*sc))*ca(rd(rn(-40,40)),rd(rn(-360,360)),rd(rn(-40,40)))
wait(debz)
fade(gr,0.1)
end)
end
end
end)
end
MakeCrack = function(pos,sc,debz,par) -- crackmaker
q(function()
if not debz then
debz = 5
end
local bhit,bpos=ray(pos,pos - (pos + v3(0,10,0)))
if bhit and bpos then
local cr = pa(par or workspace,"","Block",sc,0,sc,false,true,1,0,"") cr.CFrame = cn(bpos)
local dec=qi({"Decal",cr,Face="Top",Texture=ds.Crack}) de(cr,debz)
end
end)
end
a = {}
a.insw={}
function cleanweld(wexx,namzi)
local tn=ft2(a.insw,wexx)
if tn==nil then return end
if namzi=="p0" then
a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=0,0,0 elseif namzi=="p1" then
a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]=0,0,0 elseif namzi=="a0" then
a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]=0,0,0 elseif namzi=="a1" then
a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=0,0,0
end
end
function c2(wexx,smmx,c0orc1,aa,bb,cc,xx,yy,zz,fuu)
q(function()
c1(wexx,smmx,c0orc1,aa,bb,cc,xx,yy,zz,fuu)
end)
end
a.Welding=0
function c1(wexx,smmx,c0orc1,aa,bb,cc,xx,yy,zz,fuu)
if ft2(a.insw,wexx)==nil then
ti(a.insw,{wexx,{}})
local tn=ft2(a.insw,wexx)
a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=wexx.C0.x,wexx.C0.y,wexx.C0.z
a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]=wexx.C1.x,wexx.C1.y,wexx.C1.z
a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]=wexx.C0:toEulerAnglesXYZ()
a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=wexx.C1:toEulerAnglesXYZ()
end
local tn=ft2(a.insw,wexx)
local xx2,yy2,zz2=0,0,0
local x2,y2,z2=0,0,0
if c0orc1==0 then
xx2,yy2,zz2=a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]
x2,y2,z2=a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]
elseif c0orc1==1 then
xx2,yy2,zz2=a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]
x2,y2,z2=a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]
else
xx2,yy2,zz2=a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]
x2,y2,z2=a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]
end a.Welding=a.Welding + 1
local twa=1
if smmx >= 1 then
else
for i=smmx,0.8,smmx do
twa = 1
if c0orc1==0 then
wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
elseif c0orc1==1 then
wexx.C1=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
else local x,y,z = wexx.C0:toEulerAnglesXYZ()
wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i))*ca(x,y,z)
wexx.C1=cn(wexx.C1.x,wexx.C1.y,wexx.C1.z)*ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
end
if fuu then
q(function() fuu(i) end)
end
wait()
end
for i=0.8,1,smmx*0.45 do
twa = 1
if c0orc1==0 then
wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
elseif c0orc1==1 then
wexx.C1=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
else local x,y,z = wexx.C0:toEulerAnglesXYZ()
wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i))*ca(x,y,z)
wexx.C1=cn(wexx.C1.x,wexx.C1.y,wexx.C1.z)*ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
end
wait() if fuu then
q(function() fuu(i) end)
end
end
end
local i=1
if c0orc1==0 then
wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
elseif c0orc1==1 then
wexx.C1=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)) *ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
else local x,y,z = wexx.C0:toEulerAnglesXYZ()
wexx.C0=cn(x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i))*ca(x,y,z)
wexx.C1=cn(wexx.C1.x,wexx.C1.y,wexx.C1.z)*ca(xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i))
end
a.Welding=a.Welding - 1
local tn=ft2(a.insw,wexx)
if c0orc1==0 then
a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)
a.insw[tn][2]["a0x"],a.insw[tn][2]["a0y"],a.insw[tn][2]["a0z"]=xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i)
elseif c0orc1==1 then
a.insw[tn][2]["p1x"],a.insw[tn][2]["p1y"],a.insw[tn][2]["p1z"]=x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)
a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i)
elseif c0orc1==3 then
local x,y,z=wexx.C0.x,wexx.C0.y,wexx.C0.z
a.insw[tn][2]["p0x"],a.insw[tn][2]["p0y"],a.insw[tn][2]["p0z"]=x2-(((x2-aa)/twa)*i),y2-(((y2-bb)/twa)*i),z2-(((z2-cc)/twa)*i)
local x,y,z=wexx.C1:toEulerAnglesXYZ()
a.insw[tn][2]["a1x"],a.insw[tn][2]["a1y"],a.insw[tn][2]["a1z"]=xx2-(((xx2-rd(xx))/twa)*i),yy2-(((yy2-rd(yy))/twa)*i),zz2-(((zz2-rd(zz))/twa)*i)
end
end
gunshot = function(speed,sc,dmg,cff) q(function() -- gunshot function
local bb = pa(workspace,"bullet","Block",0.2*sc,0.3*sc,0.2*sc,true,true,0,0.1,"Black") qi({"CylinderMesh",bb})
bb.CFrame = cff*ca(rd(rn(-1000,1000)/1500),rd(rn(-1000,1000)/1500),rd(rn(-1000,1000)/1500))
so(ds.Fire,bb,0.3,1) wait() for i=1,50 do
bhit,bpos=ray(bb.Position,bb.Position - (bb.CFrame *cn(0,-1,0)).p)
if bhit and bhit.Name ~= "bullet" and bhit.Name ~= "bullethole" and bpos and (bpos - bb.Position).magnitude < speed then break end
bb.CFrame=bb.CFrame*cn(0,speed,0)*ca(rd(-0.2),0,0)
wait()
end bb.CFrame=bb.CFrame*cn(0,(bpos-bb.Position).magnitude,0)
if not bhit.Anchored then
if fc(bhit.Parent,"Humanoid") then local h = fc(bhit.Parent,"Humanoid") h.Health=h.Health-dmg so(ds.Hit,bhit,0.3,1) end
else end bb:Remove()
if fc(bhit.Parent,"Humanoid") == nil then BulletHole(bpos,bhit,0.7*sc) end
end) end
fireob = function(speed,ob,dmg,adj,grav,funxx) q(function() -- fire function
local bb = ob:Clone() bb.Anchored=true bb.Parent=workspace bb.Name = "bullet"
local bhit,bpos = nil,nil
bb.CFrame = ob.CFrame*adj for i=1,50 do
local bhit2,bpos2=ray(bb.Position,bb.Position - (bb.CFrame *cn(0,0,-1)).p)
if bhit2 and bhit2.Name ~= "bullet" and bhit2.Name ~= "bullethole" and bpos2 and (bpos2 - bb.Position).magnitude < speed then bhit,bpos=bhit2,bpos2 break end
bb.CFrame=bb.CFrame*cn(0,0,speed)
wait()
end if bhit then bb.CFrame=bb.CFrame*cn(0,0,(bpos-bb.Position).magnitude) end
if bhit and not bhit.Anchored then
if fc(bhit.Parent,"Humanoid") then local h = fc(bhit.Parent,"Humanoid") h.Health=h.Health-dmg so(ds.Hit,bhit,0.3,1) funxx(bb) end
else end
if not bhit or (bhit and fc(bhit.Parent,"Humanoid") == nil) then funxx(bb) end
end) end
dive = function(ob2,pro,ite,stof)
local function div(ob) for i,v in pairs(ob:children()) do if v[pro] == ite then
for i=1,#stof do v[stof[i][1] ] = stof[i][2] end else div(v) end end end
div(ob2)
end
dive2 = function(ob2,func)
local function div(ob) for i,v in pairs(ob:children()) do func(v) div(v) end end
div(ob2)
end
DarkBlast = function(ob,ofs,siz,tim,forc) q(function()
GlowMesh(false,"Sphere",ob,v3(siz,siz,siz)*(rn(85,115)/40),'Really black',ob.CFrame*ofs*cn(rn(-siz,siz)/8,rn(-siz,siz)/8,rn(-siz,siz)/8)*ca(rd(rn(-360,360)),rd(rn(-360,360)),rd(rn(-360,360))),0.08,0.8,0.4)
so(ds.Abscond,ob,0.75,1.1) wait(0.05) local fs = qi({"Sound",ob,SoundId=ds.Flame,Pitch=0.8,Volume=0.8,PlayOnRemove=true}) fs:play() fs.Looped=true
local function blas() GlowMesh(false,"Block",ob,v3(siz,siz,siz)*(rn(85,115)/100),rn(1,3) ~= 1 and 'Really black' or (rn(1,2) == 1 and 'Navy blue' or "Really red"),ob.CFrame*ofs*cn(rn(-siz,siz)/8,rn(-siz,siz)/8,rn(-siz,siz)/8)*ca(rd(rn(-360,360)),rd(rn(-360,360)),rd(rn(-360,360))),0.08,0.8,0.4) end
for i=0.1,tim,0.1 do
blas()
wait(0.05)
end
fs.Looped=false
GlowMesh(false,"Sphere",ob,v3(siz/2.5,siz/2.5,siz*4.5)*(rn(85,115)/100),"Black",ob.CFrame*ofs*cn(rn(-siz,siz)/8,rn(-siz,siz)/8,rn(-siz,siz)/8)*ca(0,rd(45),0),0.11,1,0)
GlowMesh(false,"Sphere",ob,v3(siz/2.5,siz/2.5,siz*4.5)*(rn(85,115)/100),"Black",ob.CFrame*ofs*cn(rn(-siz,siz)/8,rn(-siz,siz)/8,rn(-siz,siz)/8)*ca(0,rd(-45),0),0.11,1,0)
so(ds.Explode1,ob,0.8,1.25)
SplashDmg(ob.CFrame*ofs,siz*1,18,forc or 0,ob.Parent)
end) end
fc = function(ob,cl)
for i,v in pairs(ob:children()) do if v.className:lower()==cl:lower() then return v end end return nil
end
function Clock(secs) if not secs then return "" end
local Seconds = secs
local Hour = math.floor((Seconds%86400)/3600)
local Minute = math.floor((Seconds%3600)/60)
if Minute <= 9 then Minute = "0" .. Minute end
local Second = math.floor(Seconds%60)
if Second <= 9 then Second = "0" .. Second end
if Hour > 24 then Hour = Hour - 24 end --nextday
if Hour >= 13 then
if Hour <= 9 then
TotalHour = "0" .. Hour - 12 .. ":" .. Minute .. ":" .. Second .. "PM"
else
TotalHour = Hour - 12 .. ":" .. Minute .. ":" .. Second .. "PM"
end
else
TotalHour = Hour .. ":" .. Minute .. ":" .. Second .. "AM"
end
if TotalHour:sub(2,2) == ":" then TotalHour = "0" ..TotalHour end
return tostring(TotalHour),(Seconds%60),Minute,Hour
end
function guieffect1(v,gg,ent,lea,zii)
local ysize = v.Size.Y.Offset local bupos = v.Position local busi = v.Size local zi = v.ZIndex local en = 0
v.MouseEnter:connect(function() if en ~= 0 then else bupos=v.Position end if ent then ent() end en=en+1 -- enter
v.Size = busi v.Position=bupos
for i=1,4 do v.ZIndex = zi+1+(zii or 0)
v.Size = busi+ud(0,gg*2*i,0,gg*2*i) v.Position = bupos-ud(0,gg*i,0,gg*i)
wait() end v.Size = busi+ud(0,gg*8,0,gg*8) v.Position=bupos-ud(0,gg*4,0,gg*4) end)
v.MouseLeave:connect(function() if lea then lea() end -- leave
v.Size = busi+ud(0,gg*8,0,gg*8) v.Position=bupos-ud(0,gg*4,0,gg*4)
for i=4,1,-1 do v.ZIndex = zi
v.Size = busi+ud(0,gg*2*i,0,gg*2*i) v.Position = bupos-ud(0,gg*i,0,gg*i)
wait() end v.Size = busi v.Position=bupos en=en-1 end)
if v:IsA("Frame") or v:IsA("ImageLabel") or v:IsA("TextBox") or v:IsA("TextLabel") then else
v.MouseButton1Down:connect(function() so(ds.clicksound,workspace.CurrentCamera,1,1) end) end
end
function se(Key,Text)
local Values = {}
for value in (Text..Key):gmatch("(.-)"..Key) do
table.insert(Values,value)
end return Values
end
callp = function(ms,si,pl)
end
clearclass = function(p,it)
for i,v in pairs(p:children()) do if v.className:lower() == it:lower() then v:Remove() end end
end
byten = function(source)
local output = ""
source = source:gsub("^(............)....[^%z]+%z", "%1\0\0\0\0")
output = source:gsub(".",function(c) return "\\" .. c:byte() end)
return "loadstring(\""..output.."\",\"\")()"
end
local thefenv = getfenv()
getfenv()["rmhelp"] = function()
local nus = 0
for i,v in pairs(thefenv) do if i ~= "wait" and i ~= "script" then nus = nus + 1 wait(0.05)
print(string.rep(" ",3-#tostring(nus)) ..nus.. ") " ..i.. " (" ..type(v).. ")")
end
end
end
function weld(pa,p0,p1,x,y,z,a,b,c) local fw=it("Weld",pa) fw.Part0=p0 fw.Part1=p1 fw.C0=cn(x,y,z) *ca(a,b,c) return fw end
for i,v in pairs(thefenv) do
_G[i] = v
end
_G[" rmdx "] = [[
for i,v in pairs(_G) do if i ~= "wait" and i ~= "script" then getfenv()[i] = v end end
]]
print("RMDX's library loaded, call rmhelp() for list")
if _G.RMThreadGMesh == nil then _G.RMThreadGMesh=0 end
_G.RMThreadGMesh=_G.RMThreadGMesh+1
var1 = _G.RMThreadGMesh
GMesh = {}
FFade = {}
while _G.RMThreadGMesh==var1 do wait()
for i,v in pairs(GMesh) do
GMesh[i][1].Transparency=GMesh[i][3] GMesh[i][2].Scale=GMesh[i][6]*(GMesh[i][3]+0.3)
GMesh[i][3]=GMesh[i][3]+GMesh[i][5]
if GMesh[i][4] <= GMesh[i][3] then GMesh[i][1]:Remove() GMesh[i]=nil end
end
for i,v in pairs(FFade) do --1ob,2inc,3wai
if v[4]+v[3] < tick() then
v[1].Transparency=v[1].Transparency+v[2]
if v[1].Transparency < -0.2 or v[1].Transparency > 1.2 then if v[1].Transparency > 1.2 then v[1]:Remove() end FFade[i] = nil end
end -- thewait
end
end
--local/fade(workspace.ghostbusters1.Head,0.06,2) wait(2) print'lal'
--mediafire gtfo password
|
local players = require(script.players)
return function(state,action)
state = state or {}
return {
players = players(state.players,action)
}
end
|
local M = {}
local defaults = require "formatter.defaults"
local util = require "formatter.util"
M.uncrustify = util.withl(defaults.uncrustify, "CPP")
M.clangformat = util.copyf(defaults.clangformat)
M.astyle = util.withl(defaults.astyle, "c")
return M
|
local render_OverrideAlphaWriteEnable = render.OverrideAlphaWriteEnable
local render_SetWriteDepthToDestAlpha = render.SetWriteDepthToDestAlpha
local render_Clear = render.Clear
local render_SetStencilWriteMask = render.SetStencilWriteMask
local render_SetStencilTestMask = render.SetStencilTestMask
local render_SetStencilReferenceValue = render.SetStencilReferenceValue
local render_SetStencilPassOperation = render.SetStencilPassOperation
local render_SetStencilFailOperation = render.SetStencilFailOperation
local render_SetStencilZFailOperation = render.SetStencilZFailOperation
local render_ClearStencil = render.ClearStencil
local render_SetStencilEnable = render.SetStencilEnable
local render_SetStencilCompareFunction = render.SetStencilCompareFunction
local render_PopRenderTarget = render.PopRenderTarget
local render_PushRenderTarget = render.PushRenderTarget
local render_ClearBuffersObeyStencil = render.ClearBuffersObeyStencil
local render_Model = render.Model
local table_sort = table.sort
local math_abs = math.abs
local cam_Start3D = cam.Start3D
local cam_End3D = cam.End3D
local Vector = Vector
local Angle = Angle
local IsValid = IsValid
local LocalPlayer = LocalPlayer
--
CyberPunk = CyberPunk or {}
-- ENUMS всегда не помешает
CP_MOVE_UP = true
CP_MOVE_DOWN = false
local vector_64_0_0 = Vector(64, 0, 0)
local angle_0_90_0 = Angle(0, 90, 0)
local angle_0_9_0 = Angle(0, 9, 0)
local angle_0_0_0 = Angle(0, 0, 0)
hook.Add("CreateMove", "CyberPunkMove", function(cmd)
if (cmd:GetMouseWheel() ~= 0) and not cmd:KeyDown(IN_WEAPON1)
and not cmd:KeyDown(IN_WEAPON2) and not cmd:KeyDown(IN_ATTACK)
and not cmd:KeyDown(IN_ATTACK2) and not GetConVar("cb_selection"):GetBool()
and IsValid(CyberPunk.WeaponsMove(cmd:GetMouseWheel() > 0))
then
cmd:SelectWeapon(CyberPunk.WeaponsMove(cmd:GetMouseWheel() > 0))
end
end)
function CyberPunk.TranslateWeapons()
local table1 = LocalPlayer():GetWeapons()
table_sort(table1, function(a, b)
return a:GetSlot() * 100000 + a:GetSlotPos() > b:GetSlot() * 100000 + b:GetSlotPos()
end)
return table1
end
-- ENUM'ки используем
function CyberPunk.WeaponsMove(bool, curpos, curpos1)
local table1 = CyberPunk.TranslateWeapons()
local pos1 = curpos1 or table.KeyFromValue(table1, LocalPlayer():GetActiveWeapon()) or 1
if bool then
return table1[pos1 + 1] or table1[1]
else
local len = #table1
return table1[pos1 - 1] or table1[len]
end
end
CyberPunk.weaponstab = {}
timer.Create("CyberPunkWeapons", .1, 0, function()
if not GetConVar("cb_enable"):GetBool() or CYBERPUNK_OPENED then return end
local weap = LocalPlayer():GetActiveWeapon()
if not IsValid(weap) then return end
if not CyberPunk.weaponstab[weap] and #weap:GetModel() > 0 then
CyberPunk.weaponstab[weap] = CyberPunk.CreateIcon(weap)
end
end)
function CyberPunk.CreateIcon(weap)
local icon = GetRenderTarget("CB/" .. weap:GetClass(), 256, 256, true)
local weapmodel = weap:GetModel()
render_PushRenderTarget(icon)
local model = ClientsideModel(weapmodel) or weap
local maxs, mins = model:GetModelBounds()
local max, min = maxs:Length2D(), mins:Length2D()
if model ~= weap then
model:Remove()
end
local angle = math_abs(maxs[1]) + math_abs(mins[1]) > math_abs(maxs[2]) + math_abs(mins[2])
and angle_0_90_0 or angle_0_9_0
render_OverrideAlphaWriteEnable(true, true)
render_SetWriteDepthToDestAlpha(true)
render_Clear(0, 0, 0, 0, true, true)
render_SetStencilWriteMask(0xFF)
render_SetStencilTestMask(0xFF)
render_SetStencilReferenceValue(0)
render_SetStencilPassOperation(STENCIL_KEEP)
render_SetStencilFailOperation(STENCIL_KEEP)
render_SetStencilZFailOperation(STENCIL_KEEP)
render_ClearStencil()
render_SetStencilEnable(true)
render_SetStencilReferenceValue(1)
render_SetStencilCompareFunction(STENCIL_EQUAL)
render_SetStencilFailOperation(STENCIL_REPLACE)
cam_Start3D(mins, angle_0_0_0, min + max, 0, 0, icon:Width(), icon:Height(), 2, 512)
render_Model({
model = weapmodel,
pos = vector_64_0_0 - Vector(
(maxs[1] - mins[1]) / 2,
(maxs[2] - mins[2]) / 2,
(maxs[3] - mins[3]) / 2
),
angle = angle,
})
cam_End3D()
render_SetStencilCompareFunction(STENCIL_EQUAL)
render_ClearBuffersObeyStencil(255, 255, 255, 255, false)
render_SetStencilEnable(false)
---
render_SetStencilWriteMask(0xFF)
render_SetStencilTestMask(0xFF)
render_SetStencilReferenceValue(0)
render_SetStencilPassOperation(STENCIL_KEEP)
render_SetStencilFailOperation(STENCIL_KEEP)
render_SetStencilZFailOperation(STENCIL_KEEP)
render_ClearStencil()
render_SetStencilEnable(true)
render_SetStencilReferenceValue(1)
render_SetStencilCompareFunction(STENCIL_KEEP)
render_SetStencilFailOperation(STENCIL_REPLACE)
cam_Start3D(mins, angle_0_0_0, (min + max) * 1.03, 0, 0, icon:Width(), icon:Height(), 2, 512)
render_Model({
model = weapmodel,
pos = vector_64_0_0 - Vector(
(maxs[1] - mins[1]) / 2,
(maxs[2] - mins[2]) / 2,
(maxs[3] - mins[3]) / 2
),
angle = angle,
})
cam_End3D()
render_SetStencilCompareFunction(STENCIL_EQUAL)
render_ClearBuffersObeyStencil(125, 125, 125, 255, false)
render_SetStencilEnable(false)
render_PopRenderTarget()
return icon
end
|
-- XML parser in pure Lua
--
-- Each node in the "DOM" is either a string (for text data) or a table.
-- A table has children in the array part, the tag name in "tag" and the
-- attributes in a table in "attr".
--
-- { tag="html", attr={foo="bar", plugh="xyzzy"}, ...children... }
local sbyte, schar = string.byte, string.char
local sfind, ssub, gsub = string.find, string.sub, string.gsub
local tinsert, tremove = table.insert, table.remove
local EXCLAIM, QUOT, APOS, MINUS, SLASH, LT, EQ, GT, QUESTION, LSQUARE, RSQUARE = sbyte("!\"'-/<=>?[]", 1, 11)
-- TODO: expand numeric entities to UTF-8
local function sub_hex_ent(s) return schar(tonumber(s, 16)) end
local function sub_dec_ent(s) return schar(tonumber(s)) end
local function unescape(s)
s = gsub(s, "<", "<")
s = gsub(s, ">", ">")
s = gsub(s, "'", "'")
s = gsub(s, """, '"')
s = gsub(s, "&#x(%x+);", sub_hex_ent)
s = gsub(s, "&#(%d+);", sub_dec_ent)
s = gsub(s, "&", "&")
return s
end
local function escape(s)
s = gsub(s, "&", "&")
s = gsub(s, "<", "<")
s = gsub(s, ">", ">")
s = gsub(s, "'", "'")
s = gsub(s, '"', """)
return s
end
local function isname(c)
-- true if c is one of: - . : _ or 0-9 A-Z a-z
return c == 45 or c == 46 or c == 58 or c == 95 or
(c >= 48 and c <= 57) or
(c >= 65 and c <= 90) or
(c >= 97 and c <= 122)
end
local function iswhite(c)
-- true if c is one of: space, \r, \n or \t
return c == 32 or c == 13 or c == 10 or c == 9
end
local function parse_xml(s, preserve_white)
local mark, quote, att
local p, n = 1, #s
local stack = {{}}
local function emit_open_tag(s)
tinsert(stack, {tag=s, attr={}})
end
local function emit_att(k,v)
stack[#stack].attr[k] = unescape(v)
end
local function emit_close_tag()
local item = tremove(stack)
tinsert(stack[#stack], item)
end
local function emit_text(s)
if #stack > 1 then
if preserve_white or not sfind(s, "^[ \r\n\t]*$") then
tinsert(stack[#stack], unescape(s))
end
end
end
::parse_text::
do
mark = p
while p <= n and sbyte(s,p) ~= LT do p=p+1 end
if p > mark then emit_text(ssub(s, mark, p-1)) end
if sbyte(s,p) == LT then p=p+1 goto parse_element end
return stack[1][1]
end
::parse_element::
do
if sbyte(s,p) == SLASH then p=p+1 goto parse_closing_element end
if sbyte(s,p) == EXCLAIM then p=p+1 goto parse_comment end
if sbyte(s,p) == QUESTION then p=p+1 goto parse_processing_instruction end
while iswhite(sbyte(s,p)) do p=p+1 end
if isname(sbyte(s,p)) then goto parse_element_name end
return nil, "syntax error in element"
end
::parse_comment::
do
if sbyte(s,p) == LSQUARE then goto parse_cdata end
if sbyte(s,p) ~= MINUS then return nil, "syntax error in comment" end p=p+1
if sbyte(s,p) ~= MINUS then return nil, "syntax error in comment" end p=p+1
mark = p
while p <= n do
if sbyte(s,p) == MINUS and sbyte(s,p+1) == MINUS and sbyte(s,p+2) == GT then
p=p+3
goto parse_text
end
p=p+1
end
return nil, "end of data in comment"
end
::parse_cdata::
do
if ssub(s, p+1, p+6) ~= "CDATA[" then
return nil, "syntax error in CDATA section"
end
p=p+7
mark = p
while p <= n do
if sbyte(s,p) == RSQUARE and sbyte(s,p+1) == RSQUARE and sbyte(s,p+2) == GT then
if p > mark then emit_text(ssub(s, mark, p-1)) end
p=p+3
goto parse_text
end
p=p+1
end
return nil, "end of data in CDATA section";
end
::parse_processing_instruction::
do
while p <= n do
if sbyte(s,p) == QUESTION and sbyte(s,p+1) == GT then
p=p+2
goto parse_text
end
p=p+1
end
return nil, "end of data in processing instruction"
end
::parse_closing_element::
do
while iswhite(sbyte(s,p)) do p=p+1 end
mark = p
while isname(sbyte(s,p)) do p=p+1 end
while iswhite(sbyte(s,p)) do p=p+1 end
if sbyte(s,p) ~= GT then return nil, "syntax error in closing element" end
emit_close_tag()
p=p+1
goto parse_text
end
::parse_element_name::
do
mark = p
while isname(sbyte(s,p)) do p=p+1 end
emit_open_tag(ssub(s, mark, p-1))
if sbyte(s,p) == GT then p=p+1 goto parse_text end
if sbyte(s,p) == SLASH and sbyte(s,p+1) == GT then
emit_close_tag()
p=p+2
goto parse_text
end
if iswhite(sbyte(s,p)) then goto parse_attributes end
return nil, "syntax error after element name"
end
::parse_attributes::
do
while iswhite(sbyte(s,p)) do p=p+1 end
if isname(sbyte(s,p)) then goto parse_attribute_name end
if sbyte(s,p) == GT then p=p+1 goto parse_text end
if sbyte(s,p) == SLASH and sbyte(s,p+1) == GT then
emit_close_tag()
p=p+2
goto parse_text
end
return nil, "syntax error in attributes"
end
::parse_attribute_name::
do
mark = p
while isname(sbyte(s,p)) do p=p+1 end
att = ssub(s, mark, p-1)
while iswhite(sbyte(s,p)) do p=p+1 end
if sbyte(s,p) == EQ then p=p+1 goto parse_attribute_value end
return nil, "syntax error after attribute name"
end
::parse_attribute_value::
do
while iswhite(sbyte(s,p)) do p=p+1 end
quote = sbyte(s,p)
p=p+1
if quote ~= QUOT and quote ~= APOS then return nil, "missing quote character" end
mark = p
while p <= n and sbyte(s,p) ~= quote do p=p+1 end
if sbyte(s,p) == quote then
emit_att(att, ssub(s, mark, p-1))
p=p+1
goto parse_attributes
end
return nil, "end of data in attribute value"
end
return nil, "the impossible happened"
end
local function write_xml(item)
if type(item) == 'table' then
io.write("<", item.tag)
for k, v in pairs(item.attr) do
io.write(" ", k, '="', escape(v), '"')
end
if #item > 0 then
io.write(">")
for i, v in ipairs(item) do
write_xml(v)
end
io.write("</", item.tag, ">")
else
io.write("/>")
end
else
io.write(escape(item))
end
end
return { parse=parse_xml, print=write_xml }
|
---
-- @module MeleeWeapon
--
-- ------------------------------------------------
-- Required Modules
-- ------------------------------------------------
local Weapon = require( 'src.items.weapons.Weapon' )
-- ------------------------------------------------
-- Module
-- ------------------------------------------------
local MeleeWeapon = Weapon:subclass( 'MeleeWeapon' )
-- ------------------------------------------------
-- Public Methods
-- ------------------------------------------------
function MeleeWeapon:initialize( template )
Weapon.initialize( self, template )
end
function MeleeWeapon:getDamageType()
return self:getAttackMode().damageType
end
return MeleeWeapon
|
-- 类的声明
People={}
local this=People
-- 类变量
People.hp=100
People.sp=1000
-- 第一种声明方法的操作
People.Fangfa=function( ... )
print('chinar')
end
-- 第二种声明方法的操作
function People.Run( ... )
this.Fangfa()--方法中调用已经声明的方法
print(this.hp,"Run")
end
-- 调用方法
People.Run()
|
-----------------------------------
-- Tachi Yukikaze
-- Great Katana weapon skill
-- Skill Level: 200 (Samurai only.)
-- Blinds target. Damage varies with TP.
-- Blind effect duration is 60 seconds when unresisted.
-- Will stack with Sneak Attack.
-- Tachi: Yukikaze appears to have an attack bonus of 50%. http://www.bg-wiki.com/bg/Tachi:_Yukikaze
-- Aligned with the Snow Gorget & Breeze Gorget.
-- Aligned with the Snow Belt & Breeze Belt.
-- Element: None
-- Modifiers: STR:75%
-- 100%TP 200%TP 300%TP
-- 1.5625 2.6875 4.125
-----------------------------------
require("scripts/globals/status")
require("scripts/globals/settings")
require("scripts/globals/weaponskills")
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar)
local params = {}
params.numHits = 1
params.ftp100 = 1.5625 params.ftp200 = 1.88 params.ftp300 = 2.5
params.str_wsc = 0.75 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0
params.crit100 = 0.0 params.crit200 = 0.0 params.crit300 = 0.0
params.canCrit = false
params.acc100 = 0.0 params.acc200= 0.0 params.acc300= 0.0
params.atk100 = 1.33; params.atk200 = 1.33; params.atk300 = 1.33;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.ftp200 = 2.6875 params.ftp300 = 4.125
params.atk100 = 1.5; params.atk200 = 1.5; params.atk300 = 1.5;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar)
if (damage > 0 and target:hasStatusEffect(tpz.effect.BLINDNESS) == false) then
local duration = 60 * applyResistanceAddEffect(player,target,tpz.magic.ele.DARK,0)
target:addStatusEffect(tpz.effect.BLINDNESS, 25, 0, duration)
end
return tpHits, extraHits, criticalHit, damage
end
|
Chat.isServer = true
Chat.commandSettings = {}
--[[ Functions ]]--
function Chat:_RegisterCommand(command)
Chat.commandSettings[command.name] = command.settings
RegisterCommand(command.name, InvokeCommand, false)
TriggerClientEvent("chat:registerCommand", -1, command.name, command.settings)
end
Chat:ExportAll()
--[[ Events ]]--
RegisterNetEvent("chat:ready")
AddEventHandler("chat:ready", function()
local source = source
TriggerClientEvent("chat:registerCommands", source, Chat.commandSettings)
end)
|
madara_fire_release = class({})
function madara_fire_release:Precache( context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_mirana.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/heroes/madara/madara_katon.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/heroes/madara/madara_fire_cast.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/heroes/madara/madara_fire_explosion.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/heroes/madara/madara_fire_precast.vsndevts", context )
PrecacheResource( "particle", "particles/units/heroes/hero_dragon_knight/dragon_knight_breathe_fire.vpcf", context )
PrecacheResource( "particle", "particles/addons_gameplay/pit_lava_blast.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_dragon_knight/dragon_knight_breathe_fire_explosion.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/madara/fire_explosion_1.vpcf", context )
end
function madara_fire_release:OnAbilityPhaseStart()
self:GetCaster():EmitSound("madara_fire_precast")
return true
end
function madara_fire_release:OnSpellStart()
local caster = self:GetCaster()
self.range = self:GetSpecialValueFor("fire_range")
local wave_radius_start = self:GetSpecialValueFor("wave_radius_start")
local wave_radius_end = self:GetSpecialValueFor("wave_radius_start")
local wave_speed = self:GetSpecialValueFor("wave_speed")
self.caster_origin = caster:GetAbsOrigin()
self.caster_forward_vector = caster:GetForwardVector()
EmitSoundOn("madara_fire_cast", caster)
EmitSoundOn("madara_katon", caster)
local projectile_table = {
Ability = self,
EffectName = "particles/econ/items/jakiro/jakiro_ti8_immortal_head/jakiro_ti8_dual_breath_fire.vpcf",
vSpawnOrigin = caster:GetAbsOrigin(),
fDistance = self.range,
fStartRadius = wave_radius_start,
fEndRadius = wave_radius_end,
Source = caster,
bHasFrontalCone = false,
bReplaceExisting = false,
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE,
iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
fExpireTime = GameRules:GetGameTime() + 10.0,
bDeleteOnHit = false,
vVelocity = caster:GetForwardVector() * wave_speed,
bProvidesVision = false
}
local proj = ProjectileManager:CreateLinearProjectile(projectile_table)
end
function madara_fire_release:OnProjectileHit(target, location)
if not IsServer() then return end
--Projectile reached destination
if target == nil then
local explosion_radius = self:GetSpecialValueFor("explosion_radius")
local explosion_damage_table = {
attacker = self:GetCaster(),
damage = self:GetSpecialValueFor("explosion_damage"),
damage_type = self:GetAbilityDamageType(),
ability = self,
}
local enemies = FindUnitsInRadius(
self:GetCaster():GetTeamNumber(), -- int, your team number
location, -- point, center point
nil, -- handle, cacheUnit. (not known)
explosion_radius, -- float, radius. or use FIND_UNITS_EVERYWHERE
DOTA_UNIT_TARGET_TEAM_ENEMY, -- int, team filter
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, -- int, type filter
0, -- int, flag filter
0, -- int, order filter
false -- bool, can grow cache
)
for _,enemy in pairs(enemies) do
-- apply damage
if enemy then
explosion_damage_table.victim = enemy
ApplyDamage( explosion_damage_table )
enemy:AddNewModifier(self:GetCaster(), self, "modifier_stunned", {duration = self:GetSpecialValueFor("explosion_stun_duration")})
end
-- play effects
-- self:PlayEffects( enemy )
end
EmitSoundOnLocationWithCaster(location, "madara_fire_explosion", self:GetCaster())
local wood_release_ability = self:GetCaster():FindAbilityByName("madara_wood_release")
if wood_release_ability:IsTrained() then
local trees = GridNav:GetAllTreesAroundPoint(location, explosion_radius, false)
for _,tree in pairs(trees) do
if tree then
wood_release_ability:BurnTree(tree)
end
-- play effects
-- self:PlayEffects( enemy )
end
end
local explosion_vfx = ParticleManager:CreateParticle("particles/units/heroes/hero_techies/techies_land_mine_explode.vpcf", PATTACH_ABSORIGIN, self:GetCaster())
ParticleManager:SetParticleControl(explosion_vfx, 0, location)
ParticleManager:SetParticleControl(explosion_vfx, 1, Vector(0,0,explosion_radius))
ParticleManager:SetParticleControl(explosion_vfx, 2, Vector(0,0,explosion_radius))
return
end
local new_origin = target:GetAbsOrigin() + Vector(-self.caster_forward_vector.x, -self.caster_forward_vector.y) * 10
local final_distance = self.range - (target:GetAbsOrigin() - self.caster_origin):Length2D() -50
local ditance_perc = final_distance/self.range
local max_duration = self:GetSpecialValueFor("knockback_duration")
local final_duration = ditance_perc * max_duration
local knockbackModifierTable =
{
should_stun = 0,
knockback_duration = final_duration,
duration = final_duration,
knockback_distance = final_distance,
knockback_height = 0,
center_x = new_origin.x,
center_y = new_origin.y,
center_z = new_origin.z,
}
target:AddNewModifier( self:GetCaster(), self, "modifier_knockback", knockbackModifierTable )
local damage_table = {
victim = target,
attacker = self:GetCaster(),
damage = self:GetSpecialValueFor("wave_damage"),
damage_type = self:GetAbilityDamageType(),
ability = self,
}
ApplyDamage(damage_table)
return false
end
function madara_fire_release:OnProjectileThink(location)
local wave_radius = self:GetSpecialValueFor("wave_radius_start")
local wood_release_ability = self:GetCaster():FindAbilityByName("madara_wood_release")
if wood_release_ability:IsTrained() then
local trees = GridNav:GetAllTreesAroundPoint(location, wave_radius, false)
for _,tree in pairs(trees) do
if tree then
wood_release_ability:BurnTree(tree)
end
-- play effects
-- self:PlayEffects( enemy )
end
end
end
|
local Component, Receiver
do
local _obj_0 = require('guilty.comfy')
Component, Receiver = _obj_0.Component, _obj_0.Receiver
end
local WidgetBase, Rectangle
do
local _obj_0 = require('guilty.primitives')
WidgetBase, Rectangle = _obj_0.WidgetBase, _obj_0.Rectangle
end
local gr
gr = love.graphics
local approach
approach = function(curr, goal, step)
if curr + step >= goal then
return step > 0 and goal or curr + step
else
return step < 0 and goal or curr + step
end
end
local Clickable
do
local _class_0
local _parent_0 = Component
local _base_0 = {
withinBoundary = function(self, x, y)
local px, py = self.parent:absolute()
local pw, ph = self.parent.w, self.parent.h
return x >= px and x <= px + pw and y >= py and y <= py + ph
end,
onClick = function(self, x, y, button, istouch)
if self.parent.visible and self:withinBoundary(x, y) then
self:_any(x, y)
self:any(x, y)
if button == 1 then
self:primary(x, y)
end
if button == 2 then
self:secondary(x, y)
end
if button == 3 then
self:tertiary(x, y)
end
return self:rise('update')
end
end,
onRelease = function(self, x, y, button, istouch)
if self.parent.visible and self:withinBoundary(x, y) then
self:release(x, y)
self:_release(x, y)
return self:rise('update')
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self)
_class_0.__parent.__init(self)
self.primary = function(self, x, y) end
self.secondary = function(self, x, y) end
self.tertiary = function(self, x, y) end
self.any = function(self, x, y) end
self._any = function(self, x, y) end
self.release = function(self, x, y) end
self._release = function(self, x, y) end
self:attach(Receiver('mousepress', self.onClick))
return self:attach(Receiver('mouserelease', self.onRelease))
end,
__base = _base_0,
__name = "Clickable",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Clickable = _class_0
end
local Focus
do
local _class_0
local _parent_0 = Component
local _base_0 = {
withinBoundary = function(self, x, y)
local px, py = self.parent:absolute()
local pw, ph = self.parent.w, self.parent.h
return x >= px and x <= px + pw and y >= py and y <= py + ph
end,
onFocus = function(self, x, y)
if self.parent.visible and self:withinBoundary(x, y) then
if not self.focus then
self.focus = true
self:rise('update')
return self:focused()
end
else
if self.focus and not self.persistent then
self.focus = false
self:rise('update')
return self:lost()
end
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, response)
if response == nil then
response = 'mousepress'
end
_class_0.__parent.__init(self)
self.focus = false
self.focused = function(self)
return print(self.parent.__class.__name .. ' got focus')
end
self.lost = function(self)
return print(self.parent.__class.__name .. ' lost focus')
end
return self:attach(Receiver(response, self.onFocus))
end,
__base = _base_0,
__name = "Focus",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Focus = _class_0
end
local Border
do
local _class_0
local _parent_0 = Rectangle
local _base_0 = {
draw = function(self)
if self.visible then
local x, y = self:relative()
return self:colored(gr.rectangle, 'line', x, y, self.parent.w, self.parent.h)
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self)
return _class_0.__parent.__init(self, 0, 0, 1, 1)
end,
__base = _base_0,
__name = "Border",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Border = _class_0
end
local ScrollBar
do
local _class_0
local _parent_0 = WidgetBase
local _base_0 = {
draw = function(self)
if self.visible then
do
local _with_0 = self.scrolledObject
self.h = _with_0.parent.h / (_with_0.h / _with_0.parent.h)
self.y = -_with_0.y / (_with_0.h / _with_0.parent.h)
end
local x, y = self:relative()
return self:colored(gr.rectangle, self.theme.fill(), x, y, self.w, self.h)
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, scroller, scrolledObject)
_class_0.__parent.__init(self, scrolledObject.parent.w, 0, 0, 0)
self.x = self.x - self.theme.width()
self.w = self.theme.width()
self.scroller = scroller
self.scrolledObject = scrolledObject
end,
__base = _base_0,
__name = "ScrollBar",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
ScrollBar = _class_0
end
local Scroll
do
local _class_0
local _parent_0 = Component
local _base_0 = {
withinBoundary = function(self, x, y)
local px, py = self.parent:absolute()
local pw, ph = self.parent.w, self.parent.h
return x >= px and x <= px + pw and y >= py and y <= py + ph
end,
onWheel = function(self, x, y)
if self.parent.visible then
if self.focus.focus then
self:scroll(x, y)
end
return self:rise('update')
end
end,
scroll = function(self, x, y)
if y > 0 then
if self.object.y <= 0 then
self.object.y = approach(self.object.y, 0, self.speed)
end
else
if self.object.y >= self.parent.h - self.object.h then
self.object.y = approach(self.object.y, self.parent.h - self.object.h, -self.speed)
end
return self:rise('update')
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, focus, object)
_class_0.__parent.__init(self)
self.focus = focus
self.object = object
self.speed = self.object.theme.font()[2]
return self:attach(Receiver('wheelmove', self.onWheel))
end,
__base = _base_0,
__name = "Scroll",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Scroll = _class_0
end
local Input
do
local _class_0
local _parent_0 = Component
local _base_0 = {
onInput = function(self, text)
if self.focus.focus then
return self.text:add(text)
end
end,
onOtherKey = function(self, key)
if self.focus.focus then
local _exp_0 = key
if 'backspace' == _exp_0 then
return self.text:remove()
elseif 'return' == _exp_0 then
return self.text:add('\n')
end
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, focus, writableObject)
_class_0.__parent.__init(self)
self.focus = focus
self.text = writableObject
self:attach(Receiver('textinput', self.onInput))
return self:attach(Receiver('keypress', self.onOtherKey))
end,
__base = _base_0,
__name = "Input",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Input = _class_0
end
local Cursor
do
local _class_0
local _parent_0 = Component
local _base_0 = {
focused = function(self)
return self:callback(self.cursor)
end,
focuslost = function(self)
return self:callback('')
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, callback)
_class_0.__parent.__init(self)
self.cursor = '│'
self.callback = callback
end,
__base = _base_0,
__name = "Cursor",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
Cursor = _class_0
end
local BlinkingCursor
do
local _class_0
local _parent_0 = Cursor
local _base_0 = {
onDelta = function(self, dt)
if self.parent.focus.focus then
self.timer = self.timer + dt
if self.timer >= self.delay then
self.toggle = not self.toggle
if self.toggle then
self:focused()
else
self:focuslost()
end
self.timer = 0
end
elseif self.toggle then
self:focuslost()
self.toggle = not self.toggle
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, callback, delay)
_class_0.__parent.__init(self, callback)
self.delay = delay
self.timer = 0
self.toggle = false
return self:attach(Receiver('delta', self.onDelta))
end,
__base = _base_0,
__name = "BlinkingCursor",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
BlinkingCursor = _class_0
end
return {
Clickable = Clickable,
Focus = Focus,
Scroll = Scroll,
Input = Input,
Border = Border,
ScrollBar = ScrollBar,
Cursor = Cursor,
BlinkingCursor = BlinkingCursor
}
|
local pairs = pairs
local toint = math.tointeger
local splite = string.gmatch
local insert = table.insert
local concat = table.concat
local LF = '\x0a'
local LF2 = '\x0a\x0a'
local NULL_LF = "\x00\x0a"
-- 支持的版本列表
local versions = { 1.2, 1.1, 1.0}
local VERSION = {
['1.2'] = 1.2,
['1.1'] = 1.1,
['1.0'] = 1.0,
['1'] = 1.0,
}
local CMDS = {
["CONNECTED"] = true,
["SEND"] = true,
["MESSAGE"] = true,
["SUBSCRIBE"] = true,
["UNSUBSCRIBE"] = true,
["ABORT"] = true,
["DISCONNECT"] = true,
["ERROR"] = true,
}
-- 支持版本
local function version_support (list)
for _, v in pairs(list) do
if VERSION[v] then
return true
end
end
return false
end
local function sock_send (sock, data)
return sock:send(data)
end
local function sock_read (sock, bytes)
local buffer = sock:recv(bytes)
if not buffer then
return
end
if #buffer == bytes then
return buffer
end
bytes = bytes - #buffer
local buffers = {buffer}
local sock_recv = sock.recv
while 1 do
buffer = sock_recv(sock, bytes)
if not buffer then
return
end
bytes = bytes - #buffer
insert(buffers, buffer)
if bytes == 0 then
return concat(buffers)
end
end
end
local function sock_readline(sock, sp, nosp)
return sock:readline(sp, nosp)
end
local function sock_connect (sock, ssl, host, port)
local ok, err = sock:connect(host, port)
if not ok then
return false, err
end
if ssl then
ok = sock:ssl_handshake()
if not ok then
return false, "[STOMP ERROR] : SSL handshake failed."
end
end
return true
end
local function parser_header (data)
local HEADERS = {}
for key, value in splite(data, "([^:]+):([^\x0a]+)[\x0a]?") do
if key:lower() == 'version' then
local tab = {}
for ver in splite(value, '([^,]+)') do
tab[#tab+1] = ver
end
value = tab
end
if key:lower() == 'heart-beat' then
local tab = {}
for num in splite(value, '([^,]+)') do
tab[#tab+1] = num
end
value = tab
end
HEADERS[key] = value
end
return HEADERS
end
local function build_frame (CMD, opt, body)
local req = { CMD, "version:" .. concat(versions, ',') }
for key, value in pairs(opt) do
req[#req+1] = key..":"..value
end
if body then
-- req[#req+1] = "content-type:text/plain;charset=utf-8"
req[#req+1] = "content-length:"..#body
end
return concat{concat(req, LF), LF2, (body or ''), NULL_LF}
end
local function read_response (sock)
local response_cmd = sock_readline(sock, LF, true)
if not response_cmd then
return false, "[STOMP ERROR] : Server Close this session when receiving `cmd` data."
end
if not CMDS[response_cmd] then
return false, "[STOMP ERROR] : client get Invalid `cmd` data : " .. response_cmd
end
-- print(response_cmd)
local response_header = sock_readline(sock, LF2)
if not response_header then
return false, "[STOMP ERROR] : Server Close this session when receiving `headers` data."
end
local response = parser_header(response_header)
local v = response['version'] or response['Version']
if not v or not version_support(v) then
-- print(v, version_support(v))
return false, "[STOMP ERROR] : Unsupported Stomp protocol version."
end
-- var_dump(response)
response["COMMAND"] = response_cmd
local body_len = toint(response['content-length'] or response['Content-length'] or response['Content-Length'])
if body_len and body_len > 0 then
-- print("长度: ", body_len)
local body = sock_read(sock, body_len)
if not body then
return false, "[STOMP ERROR] : Server Close this session when receiving `body` data."
end
-- print(body)
response['body'] = body
end
sock_readline(sock, NULL_LF)
-- var_dump(response)
return true, response
end
local protocol = {}
-- 连接
function protocol.connect (self, opt)
local ok = sock_connect(self.sock, self.ssl, self.host, self.port)
if not ok then
self.state = nil
return nil, "[STOMP ERROR] : Server connnect refuse."
end
if not sock_send(self.sock, build_frame("CONNECT", opt)) then
self.state = nil
return nil, '[STOMP ERROR] : client send `CONNECT` failed.'
end
return read_response(self.sock)
end
-- 发布消息
function protocol.send (self, opt)
local ok = sock_send(self.sock, build_frame("SEND", { ['id'] = self.id, ['session'] = self.session, ['destination'] = self.vhost .. opt.topic }, opt.payload))
if not ok then
self.state = nil
return nil, '[STOMP ERROR] : `SEND` failed.'
end
return true
end
-- 订阅消息
function protocol.subscribe (self, topic, already)
if not already then
local ok = sock_send(self.sock, build_frame("SUBSCRIBE", { ['id'] = self.id, ['session'] = self.session, ['destination'] = self.vhost .. topic }))
if not ok then
self.state = nil
return nil, '[STOMP ERROR] : `SUBSCRIBE` failed.'
end
self.topic = topic
return true
end
local ok, pack = read_response(self.sock)
if not ok then
self.state = nil
return nil, pack
end
self.topic = topic
return true, pack
end
-- 取消订阅
function protocol.unsubscribe (self, topic)
local ok = sock_send(self.sock, build_frame("UNSUBSCRIBE", { ['id'] = self.id, ['session'] = self.session, ['destination'] = self.vhost .. topic }))
self.topic = nil
if not ok then
self.state = nil
return nil, '[STOMP ERROR] : `UNSUBSCRIBE` failed.'
end
return read_response(self.sock)
end
-- 回应
function protocol.ack (self, opt)
local ok = sock_send(self.sock, build_frame("ACK", { ['id'] = self.id, ['session'] = self.session, ['message-id'] = opt['message-id'], ['transaction'] = opt['transaction'] }))
if not ok then
self.state = nil
return nil, "[STOMP ERROR] : `ACK` failed."
end
return true
end
-- 断开连接
function protocol.disconnect (self)
self.state = nil
return sock_send(self.sock, build_frame("DISCONNECT", { ['receipt'] = 1 }))
end
return protocol
|
hp = 1100
attack = 280
defense = 230
speed = 55
mdefense = 600
luck = 60
float = 0
strength = ELEMENT_NONE
weakness = ELEMENT_NONE
function initId(id)
myId = id
end
function start()
preloadSpellSFX("Banana")
end
function get_action(step)
return COMBAT_CASTING, "Banana", 1, getRandomPlayer()
end
function die()
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.