aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Server/Server.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalevalapokalypsi/Server/Server.scala')
-rw-r--r--src/scalevalapokalypsi/Server/Server.scala16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/scalevalapokalypsi/Server/Server.scala b/src/scalevalapokalypsi/Server/Server.scala
index db30283..609b581 100644
--- a/src/scalevalapokalypsi/Server/Server.scala
+++ b/src/scalevalapokalypsi/Server/Server.scala
@@ -102,7 +102,7 @@ class Server(
this.clients.foreach(c =>
if c.player != playerEntity then
- c.player.foreach(_.observe(
+ c.player.foreach(_.observeString(
s"${name.getOrElse("Unknown player")} joins the game.")
)
)
@@ -118,12 +118,16 @@ class Server(
private def makeClientsSing(): Unit =
this.clients.foreach(c =>
- if c.player.exists(_.isSinging) && !c.clientHasSong then
- this.writeToClient(
- s"${SING_INDICATOR}Esimerkkirivi laulettavaksi, lirulirulei\r\n",
- c
- )
+ val target = c.player.flatMap(_.getSingEffectTarget)
+ target.foreach(t =>
+ if c.player.exists(_.isSinging) && !c.clientHasSong then
+ this.writeToClient(
+ s"${SING_INDICATOR}${t.getVerseAgainst}\r\n",
+ // TODO: store the verse and check how close client input is when determining sing quality
+ c
+ )
c.startSong()
+ )
)
/** Helper function to determine if the next turn can be taken */