Add 'pass', make roomData global+add item/player
Add a start of 'pass' mechanic (does nothing yet, just emits) Make roomData global Add itemData and playerData to roomData so it's all easy to accessdevelop^2
parent
16e307c32c
commit
ea7c9b8596
@ -0,0 +1,25 @@
|
|||||||
|
// For anything related to the actual game itself (kinda)
|
||||||
|
// this will be split into different bits, but should be what manages a rooms
|
||||||
|
// game states, and alladat
|
||||||
|
// Basically here to prevent circular dependencies (where I can)
|
||||||
|
|
||||||
|
|
||||||
|
// PlayerId is using array 0,1,2 for now, not the actual id
|
||||||
|
// actual Id would be better, but the player should be passed correctly
|
||||||
|
// from the client. They can edit data, but server-side validation SHOULD prevent
|
||||||
|
// in the future
|
||||||
|
function passTurn(roomId, playerId){
|
||||||
|
|
||||||
|
// Check playerId (not correct atm) before doing the stuff, to verify the user
|
||||||
|
// IS the user, and in the room
|
||||||
|
|
||||||
|
// Test alert so that different data/emits can be sent per-player
|
||||||
|
global.socketAlert(roomData[roomId].playerData[0].socketId, 'Pass', 'alert');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
passTurn
|
||||||
|
};
|
||||||
|
|
||||||
Loading…
Reference in New Issue