fix instance start
This commit is contained in:
parent
328bdf533a
commit
9633e4f4c6
15
WORKLOG.md
15
WORKLOG.md
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
*$$$*
|
*$$$*
|
||||||
* rename costs 1cr
|
* rename costs 1cr
|
||||||
* invader set
|
|
||||||
|
|
||||||
* new construct costs 5cr
|
* new construct costs 5cr
|
||||||
|
|
||||||
@ -89,21 +88,11 @@ do not allow vbox actions for finished instances
|
|||||||
|
|
||||||
|
|
||||||
## LATER
|
## LATER
|
||||||
* redis for game events
|
|
||||||
|
|
||||||
* store instances / games in redis?
|
|
||||||
* not sure hwo to get sets of player games
|
|
||||||
* set joined_games_$account [game_id]
|
|
||||||
|
|
||||||
* move player -> player
|
|
||||||
|
|
||||||
* chat
|
* chat
|
||||||
* notifications
|
|
||||||
* elo + leaderboards
|
* elo + leaderboards
|
||||||
* constants
|
* constants
|
||||||
* change to ownership pattern
|
* change to ownership pattern
|
||||||
|
|
||||||
|
|
||||||
$$$
|
$$$
|
||||||
* Items
|
* Items
|
||||||
* Colour scheme
|
* Colour scheme
|
||||||
@ -116,9 +105,11 @@ $$$
|
|||||||
|
|
||||||
# Art Styles
|
# Art Styles
|
||||||
* illusions
|
* illusions
|
||||||
|
* vaporwave
|
||||||
|
* sacred geometry
|
||||||
|
* skulls / day of the dead
|
||||||
* Aztec
|
* Aztec
|
||||||
* youkai
|
* youkai
|
||||||
* Pixel
|
|
||||||
* Industrial
|
* Industrial
|
||||||
|
|
||||||
# notables
|
# notables
|
||||||
|
|||||||
@ -65,6 +65,7 @@ function Game(props) {
|
|||||||
|
|
||||||
if (!game) return <div>...</div>;
|
if (!game) return <div>...</div>;
|
||||||
|
|
||||||
|
console.log('running game');
|
||||||
const otherTeams = game.players.filter(t => t.id !== account.id);
|
const otherTeams = game.players.filter(t => t.id !== account.id);
|
||||||
const playerTeam = game.players.find(t => t.id === account.id);
|
const playerTeam = game.players.find(t => t.id === account.id);
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ function List(args) {
|
|||||||
.sort(idSort)
|
.sort(idSort)
|
||||||
.map(construct => {
|
.map(construct => {
|
||||||
const constructName = constructRename === construct.id
|
const constructName = constructRename === construct.id
|
||||||
? <input id='renameInput' type="text" style="text-align: center" placeholder={construct.name}></input>
|
? <input id='renameInput' type="text" style="text-align: center" placeholder="enter a new name"></input>
|
||||||
: <h2>{construct.name}</h2>;
|
: <h2>{construct.name}</h2>;
|
||||||
|
|
||||||
const confirm = constructRename === construct.id
|
const confirm = constructRename === construct.id
|
||||||
|
|||||||
@ -745,15 +745,17 @@ pub fn instance_join(tx: &mut Transaction, account: &Account, instance_id: Uuid,
|
|||||||
instance_update(tx, instance)
|
instance_update(tx, instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instance_ready(tx: &mut Transaction, account: &Account, instance_id: Uuid) -> Result<Instance, Error> {
|
pub fn instance_ready(tx: &mut Transaction, account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
||||||
let mut instance = instance_get(tx, instance_id)?;
|
let mut instance = instance_get(tx, instance_id)?;
|
||||||
let player_id = instance.account_player(account.id)?.id;
|
let player_id = instance.account_player(account.id)?.id;
|
||||||
|
|
||||||
if let Some(game) = instance.player_ready(player_id)? {
|
if let Some(game) = instance.player_ready(player_id)? {
|
||||||
game_write(tx, &game)?;
|
game_write(tx, &game)?;
|
||||||
|
instance_update(tx, instance)?;
|
||||||
|
return Ok(RpcMessage::GameState(game));
|
||||||
}
|
}
|
||||||
|
|
||||||
instance_update(tx, instance)
|
Ok(RpcMessage::InstanceState(instance_update(tx, instance)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instance_state(tx: &mut Transaction, _account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
pub fn instance_state(tx: &mut Transaction, _account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
||||||
|
|||||||
@ -122,8 +122,10 @@ pub fn receive(data: Vec<u8>, db: &Db, _client: &mut Ws, begin: Instant, account
|
|||||||
Ok(RpcMessage::InstanceState(instance_new(&mut tx, account, construct_ids, name, pve, password)?)),
|
Ok(RpcMessage::InstanceState(instance_new(&mut tx, account, construct_ids, name, pve, password)?)),
|
||||||
RpcRequest::InstanceJoin { instance_id, construct_ids } =>
|
RpcRequest::InstanceJoin { instance_id, construct_ids } =>
|
||||||
Ok(RpcMessage::InstanceState(instance_join(&mut tx, account, instance_id, construct_ids)?)),
|
Ok(RpcMessage::InstanceState(instance_join(&mut tx, account, instance_id, construct_ids)?)),
|
||||||
|
|
||||||
|
// these two can return GameState or InstanceState
|
||||||
RpcRequest::InstanceReady { instance_id } =>
|
RpcRequest::InstanceReady { instance_id } =>
|
||||||
Ok(RpcMessage::InstanceState(instance_ready(&mut tx, account, instance_id)?)),
|
Ok(instance_ready(&mut tx, account, instance_id)?),
|
||||||
RpcRequest::InstanceState { instance_id } =>
|
RpcRequest::InstanceState { instance_id } =>
|
||||||
Ok(instance_state(&mut tx, account, instance_id)?),
|
Ok(instance_state(&mut tx, account, instance_id)?),
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user