spawning constructs (no mtx yet)
This commit is contained in:
+8
-1
@@ -8,7 +8,7 @@ use failure::Error;
|
||||
use failure::err_msg;
|
||||
|
||||
use pg::{Db};
|
||||
use construct::{Construct};
|
||||
use construct::{Construct, construct_spawn};
|
||||
use game::{Game, game_state, game_skill, game_ready};
|
||||
use account::{Account, account_constructs, account_instances};
|
||||
use skill::{Skill, dev_resolve, Resolutions};
|
||||
@@ -16,6 +16,9 @@ use instance::{Instance, instance_state, instance_list, instance_new, instance_r
|
||||
use vbox::{vbox_accept, vbox_apply, vbox_discard, vbox_combine, vbox_reclaim, vbox_unequip};
|
||||
use item::{Item, ItemInfoCtr, item_info};
|
||||
|
||||
use names::{name as generate_name};
|
||||
|
||||
|
||||
use mtx;
|
||||
|
||||
#[derive(Debug,Clone,Serialize,Deserialize)]
|
||||
@@ -27,6 +30,7 @@ pub enum RpcMessage {
|
||||
GameState(Game),
|
||||
ItemInfo(ItemInfoCtr),
|
||||
|
||||
ConstructSpawn(Construct),
|
||||
OpenInstances(Vec<Instance>),
|
||||
InstanceState(Instance),
|
||||
|
||||
@@ -44,6 +48,7 @@ enum RpcRequest {
|
||||
DevResolve { a: Uuid, b: Uuid, skill: Skill },
|
||||
|
||||
MtxConstructApply { mtx: mtx::MtxVariant, construct_id: Uuid, name: String },
|
||||
MtxConstructBuy { },
|
||||
MtxAccountApply { mtx: mtx::MtxVariant },
|
||||
MtxBuy { mtx: mtx::MtxVariant },
|
||||
|
||||
@@ -148,6 +153,8 @@ pub fn receive(data: Vec<u8>, db: &Db, begin: Instant, account: &Option<Account>
|
||||
RpcRequest::VboxUnequip { instance_id, construct_id, target } =>
|
||||
Ok(RpcMessage::InstanceState(vbox_unequip(&mut tx, account, instance_id, construct_id, target)?)),
|
||||
|
||||
RpcRequest::MtxConstructBuy { } =>
|
||||
Ok(RpcMessage::ConstructSpawn(construct_spawn(&mut tx, account.id, generate_name())?)),
|
||||
|
||||
RpcRequest::MtxConstructApply { mtx, construct_id, name } =>
|
||||
Ok(RpcMessage::AccountConstructs(mtx::apply(&mut tx, account, mtx, construct_id, name)?)),
|
||||
|
||||
Reference in New Issue
Block a user