test
This commit is contained in:
parent
9b5845a163
commit
9796ec9a47
10
main.go
10
main.go
@ -163,6 +163,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
sp.Read(b[:p.PLength])
|
sp.Read(b[:p.PLength])
|
||||||
logInfoDebug("AdminPacketServerClientJoin :\n- ClientID: %d", sp.ClientID)
|
logInfoDebug("AdminPacketServerClientJoin :\n- ClientID: %d", sp.ClientID)
|
||||||
|
sendChat(-436055948, fmt.Sprintf("%s joining.", clients[sp.ClientID].Name))
|
||||||
case AdminPacketServerClientInfo:
|
case AdminPacketServerClientInfo:
|
||||||
sp := PacketServerClientInfo{
|
sp := PacketServerClientInfo{
|
||||||
Packet: p,
|
Packet: p,
|
||||||
@ -189,6 +190,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
sp.Read(b[:p.PLength])
|
sp.Read(b[:p.PLength])
|
||||||
logInfoDebug("AdminPacketServerClientQuit :\n- ClientID: %d", sp.ClientID)
|
logInfoDebug("AdminPacketServerClientQuit :\n- ClientID: %d", sp.ClientID)
|
||||||
|
if len(clients) == 2 && !paused {
|
||||||
|
sendChat(-436055948, fmt.Sprintf("%s leaving. Game paused.", clients[sp.ClientID].Name))
|
||||||
|
}
|
||||||
delete(clients, sp.ClientID)
|
delete(clients, sp.ClientID)
|
||||||
case AdminPacketServerChat:
|
case AdminPacketServerChat:
|
||||||
sp := PacketServerChat{
|
sp := PacketServerChat{
|
||||||
@ -278,8 +282,6 @@ func main() {
|
|||||||
Command: "pause",
|
Command: "pause",
|
||||||
}
|
}
|
||||||
_, err = conn.Write(px.Bytes())
|
_, err = conn.Write(px.Bytes())
|
||||||
logInfoDebug("Pause forced")
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
}
|
}
|
||||||
if paused && !forcePaused && len(clients) > 1 { // server is client #1
|
if paused && !forcePaused && len(clients) > 1 { // server is client #1
|
||||||
paused = false
|
paused = false
|
||||||
@ -288,8 +290,7 @@ func main() {
|
|||||||
Command: "unpause",
|
Command: "unpause",
|
||||||
}
|
}
|
||||||
_, err = conn.Write(px.Bytes())
|
_, err = conn.Write(px.Bytes())
|
||||||
logInfoDebug("Unpause forced")
|
sendChat(-436055948, "Game unpaused.")
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
}
|
}
|
||||||
if !paused && len(clients) == 1 { // server is client #1
|
if !paused && len(clients) == 1 { // server is client #1
|
||||||
paused = true
|
paused = true
|
||||||
@ -299,7 +300,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
_, err = conn.Write(px.Bytes())
|
_, err = conn.Write(px.Bytes())
|
||||||
logInfoDebug("Pausing")
|
logInfoDebug("Pausing")
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user