1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Configure all death, spawn, and garage bay skins for #3

This commit is contained in:
NG (Graham)
2025-05-26 21:30:28 -04:00
parent 956bb2149d
commit ab19c723cd
14 changed files with 584 additions and 143 deletions

View File

@@ -1,17 +1,42 @@
use polariton_server::operations::SimpleFunc;
use polariton::operation::{ParameterTable, Typed};
use polariton::operation::{ParameterTable, Typed, OperationResponse};
//const BAY_ID_KEY: u8 = 54; // in
const CODE: u8 = 218;
const UUID_KEY: u8 = 54; // str; in
const BAY_SKIN_KEY: u8 = 234;
const SPAWN_EFFECT_KEY: u8 = 235;
const DEATH_EFFECT_KEY: u8 = 236;
pub(super) fn bay_customisations_provider() -> SimpleFunc<218, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
SimpleFunc::new(|params, _| {
let mut params = params.to_dict();
params.insert(BAY_SKIN_KEY, Typed::Str("RC_MothershipSkin_Neptune_01".into()));
params.insert(SPAWN_EFFECT_KEY, Typed::Str("Spawn_Warp".into()));
params.insert(DEATH_EFFECT_KEY, Typed::Str("Explosion_Warp".into()));
Ok(params.into())
})
pub(super) fn bay_customisations_provider() -> GarageSlotCustomisationProvider {
GarageSlotCustomisationProvider
}
async fn do_handling(params: ParameterTable<()>, user: &crate::UserTy) -> Result<ParameterTable, i16> {
let mut params = params.to_dict();
if let Some(Typed::Str(uuid)) = params.remove(&UUID_KEY) {
let user_info = user.user()?;
let customs = user_info.get_slot_customisations(&uuid.string).await?;
params.insert(BAY_SKIN_KEY, customs.bay);
params.insert(SPAWN_EFFECT_KEY, customs.spawn);
params.insert(DEATH_EFFECT_KEY, customs.death);
}
Ok(params.into())
}
pub(super) struct GarageSlotCustomisationProvider;
#[async_trait::async_trait]
impl polariton_server::operations::Operation<()> for GarageSlotCustomisationProvider {
type User = crate::UserTy;
async fn handle_async(&self, params: ParameterTable<()>, user: &Self::User) -> OperationResponse<()> {
polariton_server::operations::result_to_op_resp::<CODE, ()>(do_handling(params, user).await)
}
}
impl polariton_server::operations::OperationCode for GarageSlotCustomisationProvider {
fn op_code() -> u8 {
CODE
}
}