Skip to content

Commit

Permalink
Merge branch 'master' into timer2
Browse files Browse the repository at this point in the history
  • Loading branch information
Vurv78 committed Jan 2, 2024
2 parents 1a78d0d + ac1fb76 commit 064fbaf
Show file tree
Hide file tree
Showing 1,129 changed files with 1,712 additions and 1,103 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:

steps:
- uses: actions/checkout@master

- name: Embed version
run: |
echo -e "\ncachedversion = \"Canary ${GITHUB_SHA:0:7}\"" >> lua/wire/server/wirelib.lua
- uses: wiremod/gmod-upload@master
with:
id: 3066780663
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ jobs:

steps:
- uses: actions/checkout@master

- name: Embed version
run: |
echo -e "\ncachedversion = \"Workshop ${GITHUB_SHA:0:7}\"" >> lua/wire/server/wirelib.lua
- uses: wiremod/gmod-upload@master
with:
id: 160250458
changelog: "Deployment via Github to latest changes"
changelog: "Deployment via Github to commit ${GITHUB_SHA:0:7}"
env:
STEAM_USERNAME: ${{ secrets.WIRETEAM_WORKSHOP_USERNAME }}
STEAM_PASSWORD: ${{ secrets.WIRETEAM_WORKSHOP_PASSWORD }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

| Addon | Workshop | GitHub |
| --- | --- | --- |
|**Wiremod**| [![Wiremod](https://img.shields.io/steam/subscriptions/160250458?logo=steam)](https://steamcommunity.com/sharedfiles/filedetails/?id=160250458) | https://github.com/wiremod/wire |
|**Wiremod** (Stable) | [![Wiremod](https://img.shields.io/steam/subscriptions/160250458?logo=steam)](https://steamcommunity.com/sharedfiles/filedetails/?id=160250458) | https://github.com/wiremod/wire |
|**Wiremod** (Canary) | [![Wiremod Canary](https://img.shields.io/steam/subscriptions/3066780663?logo=steam&color=orange)](https://steamcommunity.com/sharedfiles/filedetails/?id=3066780663) | https://github.com/wiremod/wire |
|**AdvDupe2**| [![AdvDupe2](https://img.shields.io/steam/subscriptions/773402917?logo=steam)](https://steamcommunity.com/sharedfiles/filedetails/?id=773402917)| https://github.com/wiremod/advdupe2 |
|**Wire Extras**| [None yet](https://github.com/wiremod/wire-extras/issues/113) | https://github.com/wiremod/wire-extras |

Expand Down
24 changes: 24 additions & 0 deletions data/expression2/tests/compiler/bench.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local t = {}
for i = 1, 600 do
t[i] = i
end

local script = "array(" .. table.concat(t, ",") .. ")"

local o1, o2, o3 = debug.gethook()

debug.sethook(error, "", 1e6)

local _, code_ok, compiled = pcall(E2Lib.compileScript, script)

debug.sethook(o1, o2, o3)

assert(code_ok, "Took too long to compile!")

debug.sethook(error, "", 1e6)

local ok = pcall(compiled)

debug.sethook(o1, o2, o3)

assert(ok, "Took too long to run!")
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## SHOULD_FAIL:COMPILE

function function() {}
5 changes: 5 additions & 0 deletions data/expression2/tests/regressions/2864.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## SHOULD_PASS:COMPILE

function function retfn() {
return function() {}
}
3 changes: 3 additions & 0 deletions data/expression2/tests/regressions/2876.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## SHOULD_PASS:EXECUTE

changed(ang())
14 changes: 14 additions & 0 deletions data/expression2/tests/regressions/2883.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## SHOULD_PASS:EXECUTE

Ran = 0

for(I = 1, 1) {
switch (0xDEADBEEF) {
default,
break # Shouldn't break out of loop
}

Ran = 1
}

assert(Ran)
28 changes: 28 additions & 0 deletions data/expression2/tests/regressions/2958.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## SHOULD_PASS:EXECUTE

@strict

# == 1 x 2
# opcounter 1 x 2
# assert 2 x 2
# string:upper 1
# max(nn) 1
# <literal> 0.125 x 7
# soundDuration 5000

"":upper()
max(1, 2)

assert( opcounter() == 5021 )

function number:usermethod() {}

1:usermethod() # + 5

assert( opcounter() == 5021 )

function userfunction() {}

userfunction() # + 5

soundDuration("")
16 changes: 15 additions & 1 deletion data/expression2/tests/runtime/base/userfunctions/functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,18 @@ try {
error("unreachable")
} catch(Err) {
assert(Err == "No such function defined at runtime: undefined()")
}
}

function implicit() {
return 55
}

assert( implicit() == 55 )

function implicit_lambda() {
return function() {
return 5
}
}

assert( implicit_lambda()()[number] == 5 )
34 changes: 34 additions & 0 deletions data/expression2/tests/runtime/libraries/number.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## SHOULD_PASS:EXECUTE

assert( isinf(_INF) )
assert( !isfinite(_INF) )

assert( isnan(0/0) )

assert( _E == e() )
assert( _INF == inf() )
assert( _PI == pi() )

assert( _INF:toString(2) == "inf" )
assert( (2^2000):toString(2) == "inf" )
assert( 0b11110101:toString(2) == "11110101" )

assert( mod(1, 2) == 1 % 2 )
assert( mod(-5, 2) != -5 % 2 )

assert( round(1.235, 2) == 1.24 )

assert( round(frac(5.3), 1) == 0.3 )
assert( round(frac(-5.3), 1) == -0.3 )

assert( abs(-5) == 5 )

assert( floor(0.6) == 0 )
assert( ceil(0.1) == 1 )

assert( round(0.1) == 0 )
assert( round(0.6) == 1 )

assert( log2(2) == 1 )
assert( log2(5) == (ln(5) / ln(2)) )
assert( log(5, 2) == (ln(5) / ln(2)) )
17 changes: 17 additions & 0 deletions data/expression2/tests/runtime/types/quaternion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## SHOULD_PASS:EXECUTE

local Quat = quat()

Quat[1] = 77

assert(Quat[1] == 77)
assert(Quat:real() == 77)

assert(Quat[2] == 0)
assert(Quat:i() == 0)

assert(Quat[3] == 0)
assert(Quat:j() == 0)

assert(Quat[4] == 0)
assert(Quat:k() == 0)
21 changes: 14 additions & 7 deletions data/expression2/tests/runtime/types/vector2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ assert(Vec != vec2(2, 2))

assert(Vec[1] == 1)
assert(Vec[2] == 2)
assert(vec2()[1] == 0)

assert(vec2() == vec2(0, 0))
assert(vec2(1, 2) != vec2(1, 2.3))
assert(vec2(1, 2) == vec2(1, 2))

assert(Vec:x() == Vec[1])
assert(Vec:y() == Vec[2])

assert(vec2(1, 2) + vec2(1, 2) == vec2(2, 4))
assert(Vec:toString() == "[1,2]", Vec:toString())

Vec[1] = 7
Vec[2] = 8

assert(Vec[1] == 7)
assert(Vec[2] == 8)

assert(vec2()[1] == 0)
assert(vec2() == vec2(0, 0))

assert(vec2(1, 2) != vec2(1, 2.3))
assert(vec2(1, 2) == vec2(1, 2))

assert(Vec:toString() == "[1,2]", Vec:toString())
assert(vec2(1, 2) + vec2(1, 2) == vec2(2, 4))
27 changes: 18 additions & 9 deletions data/expression2/tests/runtime/types/vector4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,24 @@ assert(Vec != vec4(2, 2, 1, 0))

assert(Vec[1] == 1)
assert(Vec[2] == 2)
assert(vec4()[1] == 0)

assert(Vec:x() == Vec[1])
assert(Vec:y() == Vec[2])
assert(Vec:z() == Vec[3])
assert(Vec:w() == Vec[4])

assert(Vec:toString() == "[1,2,3,4]", Vec:toString())

Vec[1] = 78
Vec[2] = 33
Vec[3] = 21

assert(Vec[1] == 78)
assert(Vec[2] == 33)
assert(Vec[3] == 21)
assert(Vec[4] == 4)

assert(vec4()[1] == 0)
assert(vec4() == vec4(0, 0, 0, 0))

assert(vec4(1, 2, 2, 1) != vec4(1, 2.3, 2, 1))
Expand All @@ -24,11 +40,6 @@ assert(vec4(1, 2, 3, 4) - vec4(1, 1, 1, 1) == vec4(0, 1, 2, 3))
assert(vec4(1, 2, 3, 4) * vec4(2, 2, 2, 2) == vec4(2, 4, 6, 8))
assert(vec4(1, 2, 3, 4) / vec4(2, 2, 2, 2) == vec4(0.5, 1, 1.5, 2))

assert(Vec:x() == Vec[1])
assert(Vec:y() == Vec[2])
assert(Vec:z() == Vec[3])
assert(Vec:w() == Vec[4])

assert(vec4(1, 2, 3, 4) + vec4(1, 2, 3, 4) == vec4(2, 4, 6, 8))

# Ensure syntax sugar works with old operators
Expand All @@ -40,6 +51,4 @@ W -= 1
W /= 1
W *= 1
W++
W--

assert(Vec:toString() == "[1,2,3,4]", Vec:toString())
W--
13 changes: 9 additions & 4 deletions lua/entities/gmod_wire_addressbus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,30 @@ function ENT:Initialize()
self.Memory = {}
self.MemStart = {}
self.MemEnd = {}
self.MemOffsets = {}
for i = 1,4 do
self.Memory[i] = nil
self.MemStart[i] = 0
self.MemEnd[i] = 0
self.MemOffsets[i] = 0
end
self:SetOverlayText("Data rate: 0 bps")
end

function ENT:Setup(Mem1st, Mem2st, Mem3st, Mem4st, Mem1sz, Mem2sz, Mem3sz, Mem4sz)
function ENT:Setup(Mem1st, Mem2st, Mem3st, Mem4st, Mem1sz, Mem2sz, Mem3sz, Mem4sz, Mem1rw, Mem2rw, Mem3rw, Mem4rw)
local starts = {Mem1st,Mem2st,Mem3st,Mem4st}
local sizes = {Mem1sz,Mem2sz,Mem3sz,Mem4sz}
local offsets = {Mem1rw,Mem2rw,Mem3rw,Mem4rw}
for i = 1,4 do
starts[i] = tonumber(starts[i]) or 0
sizes[i] = tonumber(sizes[i]) or 0

self.MemStart[i] = starts[i]
self.MemEnd[i] = starts[i] + sizes[i] - 1
self.MemOffsets[i] = offsets[i] or 0
self["Mem"..i.."st"] = starts[i]
self["Mem"..i.."sz"] = sizes[i]
self["Mem"..i.."rw"] = offsets[i]
end
end

Expand All @@ -59,7 +64,7 @@ function ENT:ReadCell(Address)
if self.Memory[i] then
if self.Memory[i].ReadCell then
self.DataBytes = self.DataBytes + 1
local val = self.Memory[i]:ReadCell(Address - self.MemStart[i])
local val = self.Memory[i]:ReadCell(Address + self.MemOffsets[i] - self.MemStart[i])
return val or 0
end
else
Expand All @@ -77,7 +82,7 @@ function ENT:WriteCell(Address, value)
if (Address >= self.MemStart[i]) and (Address <= self.MemEnd[i]) then
if self.Memory[i] then
if self.Memory[i].WriteCell then
self.Memory[i]:WriteCell(Address - self.MemStart[i], value)
self.Memory[i]:WriteCell(Address + self.MemOffsets[i] - self.MemStart[i], value)
end
end
self.DataBytes = self.DataBytes + 1
Expand All @@ -95,4 +100,4 @@ function ENT:TriggerInput(iname, value)
end
end

duplicator.RegisterEntityClass("gmod_wire_addressbus", WireLib.MakeWireEnt, "Data", "Mem1st", "Mem2st", "Mem3st", "Mem4st", "Mem1sz", "Mem2sz", "Mem3sz", "Mem4sz")
duplicator.RegisterEntityClass("gmod_wire_addressbus", WireLib.MakeWireEnt, "Data", "Mem1st", "Mem2st", "Mem3st", "Mem4st", "Mem1sz", "Mem2sz", "Mem3sz", "Mem4sz", "Mem1rw", "Mem2rw", "Mem3rw", "Mem4rw")
5 changes: 3 additions & 2 deletions lua/entities/gmod_wire_egp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ function ENT:Initialize()

self.RenderTable = {}

WireLib.CreateOutputs( self, { "User (Outputs the player who used the screen for a single tick) [ENTITY]" } )
WireLib.CreateWirelinkOutput( nil, self, {true} )
WireLib.CreateOutputs(self, { "User (Outputs the player who used the screen for a single tick) [ENTITY]", "wirelink [WIRELINK]" })

WireLib.TriggerOutput(self, "wirelink", self)

self.xScale = { 0, 512 }
self.yScale = { 0, 512 }
Expand Down
5 changes: 5 additions & 0 deletions lua/entities/gmod_wire_egp/lib/egplib/objectcontrol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ function baseObj:SetPos(x, y, angle)
angle = angle % 360
if self.angle ~= angle then self.angle, ret = angle, true end
end
if SERVER and self._x then
if x then self._x = x end
if y then self._y = y end
if angle then self._angle = angle end
end
return ret
end
function baseObj:Set(member, value)
Expand Down
Loading

0 comments on commit 064fbaf

Please sign in to comment.