Skip to content

Commit

Permalink
two player snooker
Browse files Browse the repository at this point in the history
  • Loading branch information
tailuge committed Oct 25, 2023
1 parent 78e5388 commit a55fe32
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
18 changes: 8 additions & 10 deletions dist/2p.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
src="index.html"
title="P1"
id="P1"
width="500"
height="396"
width="620"
height="450"
style="float: left"
></iframe>
</div>
Expand All @@ -27,8 +27,8 @@
src="index.html"
title="P2"
id="P2"
width="500"
height="396"
width="620"
height="450"
style="float: right"
></iframe>
</div>
Expand All @@ -38,11 +38,9 @@
const urlParams = new URLSearchParams(window.location.search)
const websocketserver = urlParams.get("websocketserver")
const ruletype = urlParams.get("ruletype")
document.getElementById(
"P1"
).src = `index.html?ruletype=${ruletype}&name=P1&clientId=p1id&websocketserver=${websocketserver}`
document.getElementById(
"P2"
).src = `index.html?ruletype=${ruletype}&name=P2&clientId=p2id&websocketserver=${websocketserver}`
const unique = Math.floor(Math.random() * 0xffff).toString(16)
const url = `index.html?ruletype=${ruletype}&websocketserver=${websocketserver}&tableId=${unique}`
document.getElementById("P1").src = `${url}&clientId=p1id&name=P1`
document.getElementById("P2").src = `${url}&clientId=p2id&name=P2`
</script>
</html>
2 changes: 1 addition & 1 deletion dist/diagram.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ <h1>tailuge/billiards multiplayer test page</h1>
for quick testing
</li>
<li>
<a class="addwss" href="./2p.html?ruletype=nineball"
<a class="addwss" href="./2p.html?ruletype=threecushion"
>two players three cushion in single window</a
>
</li>
<li>
<a class="addwss" href="./2p.html?ruletype=nineball"
<a class="addwss" href="./2p.html?ruletype=fourteenone"
>two players 14-1 in single window</a
>
</li>
<li>
<a class="addwss" href="./2p.html?ruletype=nineball"
<a class="addwss" href="./2p.html?ruletype=snooker"
>two players snooker in single window</a
>
</li>
Expand Down
4 changes: 1 addition & 3 deletions src/controller/placeball.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ export class PlaceBall extends ControllerBase {

override onFirst() {
const cueball = this.container.table.cueball
if (!cueball.onTable()) {
cueball.pos.copy(new Vector3((-R * 11) / 0.5, 0, 0))
}
cueball.pos.copy(new Vector3((-R * 11) / 0.5, 0, 0))
cueball.setStationary()
cueball.updateMesh(0)
this.container.table.cue.placeBallMode()
Expand Down
1 change: 1 addition & 0 deletions src/controller/watchshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class WatchShot extends ControllerBase {
override handleWatch(event) {
if ("rerack" in event.json) {
this.container.table.updateFromSerialised(event.json)
return this
}
return new WatchAim(this.container)
}
Expand Down

0 comments on commit a55fe32

Please sign in to comment.