1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-23 10:38:05 +11:00

even more minification improvements, haruhi help me

This commit is contained in:
Izaya 2018-03-18 12:58:16 +11:00
parent 53d362afbe
commit 396028d686
3 changed files with 25 additions and 23 deletions

View File

@ -1,7 +1,7 @@
_G.net={} _G.net={}
do do
local M,pQ,pC,rC,C={},{},{},{},computer local M,pQ,pC,rC,C={},{},{},{},computer
net.port,net.hostname,net.route=4096,C.address():sub(1,8),true net.port,net.hostname,net.route,U=4096,C.address():sub(1,8),true,C.uptime
for a in component.list("modem") do for a in component.list("modem") do
M[a]=component.proxy(a) M[a]=component.proxy(a)
M[a].open(net.port) M[a].open(net.port)
@ -14,7 +14,7 @@ end
return pID return pID
end end
local function sP(pID,pT,T,vP,D) local function sP(pID,pT,T,vP,D)
pC[pID]=C.uptime() pC[pID]=U()
if rC[T] then if rC[T] then
M[rC[T][1]].send(rC[T][2],net.port,pID,pT,T,net.hostname,vP,D) M[rC[T][1]].send(rC[T][2],net.port,pID,pT,T,net.hostname,vP,D)
else else
@ -38,39 +38,39 @@ return true
end end
local rCPE=C.pullSignal local rCPE=C.pullSignal
function C.pullSignal(t) function C.pullSignal(t)
local eT={rCPE(t)} local Z={rCPE(t)}
for k,v in pairs(pC) do for k,v in pairs(pC) do
if C.uptime()>v+30 then if U()>v+30 then
pC[k]=nil pC[k]=nil
end end
end end
for k,v in pairs(rC) do for k,v in pairs(rC) do
if C.uptime()>v[3]+30 then if U()>v[3]+30 then
rC[k]=nil rC[k]=nil
end end
end end
if eT[1]=="modem_message" and (eT[4]==net.port or eT[4]==0) and cC(eT[6]) then if Z[1]=="modem_message" and (Z[4]==net.port or Z[4]==0) and cC(Z[6]) then
rC[eT[9]]={eT[2],eT[3],C.uptime()} rC[Z[9]]={Z[2],Z[3],U()}
if eT[8]==net.hostname then if Z[8]==net.hostname then
if eT[7]~=2 then if Z[7]~=2 then
C.pushSignal("net_msg",eT[9],eT[10],eT[11]) C.pushSignal("net_msg",Z[9],Z[10],Z[11])
if eT[7]==1 then if Z[7]==1 then
sP(gP(),2,eT[9],eT[10],eT[6]) sP(gP(),2,Z[9],Z[10],Z[6])
end end
else else
pQ[eT[11]]=nil pQ[Z[11]]=nil
end end
elseif net.route and cC(eT[6]) then elseif net.route and cC(Z[6]) then
sP(eT[6],eT[7],eT[8],eT[9],eT[10],eT[11]) sP(Z[6],Z[7],Z[8],Z[9],Z[10],Z[11])
end end
pC[eT[6]]=C.uptime() pC[Z[6]]=U()
end end
for k,v in pairs(pQ) do for k,v in pairs(pQ) do
if C.uptime()>v[5] then if U()>v[5] then
sP(k,table.unpack(v)) sP(k,table.unpack(v))
v[5]=C.uptime()+30 v[5]=U()+30
end end
end end
return table.unpack(eT) return table.unpack(Z)
end end
end end

View File

@ -1,8 +1,8 @@
_G.net={} _G.net={}
do do
local modems,packetQueue,packetCache,routeCache,C = {},{},{},{},NOTCOMPUTER local modems,packetQueue,packetCache,routeCache,C = {},{},{},{},COMPUTER
net.port,net.hostname,net.route=4096,computer.address():sub(1,8),true net.port,net.hostname,net.route,U=4096,computer.address():sub(1,8),true,UPTIME
for a in component.list("modem") do for a in component.list("modem") do
modems[a] = component.proxy(a) modems[a] = component.proxy(a)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#microtel-3.lua #microtel-3.lua
cp microtel-3.lua microtel-3-mini.lua cp microtel-3.lua microtel-3-mini.lua
sed -i -e 's/eventTab/eT/g' microtel-3-mini.lua sed -i -e 's/eventTab/Z/g' microtel-3-mini.lua
sed -i -e 's/modems/M/g' microtel-3-mini.lua sed -i -e 's/modems/M/g' microtel-3-mini.lua
sed -i -e 's/qPacket/qP/g' microtel-3-mini.lua sed -i -e 's/qPacket/qP/g' microtel-3-mini.lua
sed -i -e 's/packetID/pID/g' microtel-3-mini.lua sed -i -e 's/packetID/pID/g' microtel-3-mini.lua
@ -17,7 +17,9 @@ sed -i -e 's/routeCache/rC/g' microtel-3-mini.lua
sed -i -e 's/realComputerPullSignal/rCPE/g' microtel-3-mini.lua sed -i -e 's/realComputerPullSignal/rCPE/g' microtel-3-mini.lua
sed -i -e 's/packetQueue/pQ/g' microtel-3-mini.lua sed -i -e 's/packetQueue/pQ/g' microtel-3-mini.lua
sed -i -e 's/computer/C/g' microtel-3-mini.lua sed -i -e 's/computer/C/g' microtel-3-mini.lua
sed -i -e 's/NOTCOMPUTER/computer/g' microtel-3-mini.lua sed -i -e 's/C.uptime/U/g' microtel-3-mini.lua
sed -i -e 's/COMPUTER/computer/g' microtel-3-mini.lua
sed -i -e 's/UPTIME/C.uptime/g' microtel-3-mini.lua
lua strip.lua microtel-3-mini.lua microtel-3-mini.lua lua strip.lua microtel-3-mini.lua microtel-3-mini.lua
#microtel-4.lua #microtel-4.lua