diff --git a/src/rbx.rs b/src/rbx.rs index 7233475..3c0ce9e 100644 --- a/src/rbx.rs +++ b/src/rbx.rs @@ -203,7 +203,7 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana ); }, other=>{ - let regman=lazy_regex::regex!(r"^(BonusStart|Spawn|WormholeOut)(\d+)$"); + let regman=lazy_regex::regex!(r"^(BonusStart|WormholeOut)(\d+)$"); if let Some(captures)=regman.captures(other){ match &captures[1]{ "BonusStart"=>{ @@ -217,14 +217,6 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana ) ); }, - "Spawn"=>{ - force_intersecting=true; - modes_builder.insert_stage( - gameplay_modes::ModeId::MAIN, - gameplay_modes::StageId::new(captures[2].parse::().unwrap()), - gameplay_modes::Stage::new(model_id), - ); - }, "WormholeOut"=>{ //this object is not special in strafe client, but the roblox mapping needs to be converted to model id assert!(wormhole_id_to_out_model.insert(captures[2].parse::().unwrap(),model_id).is_none(),"Cannot have multiple WormholeOut with same id"); @@ -234,29 +226,38 @@ fn get_attributes(object:&rbx_dom_weak::Instance,can_collide:bool,velocity:Plana }else if let Some(captures)=lazy_regex::regex!(r"^(Force)?(Spawn|SpawnAt|Trigger|Teleport|Platform)(\d+)$") .captures(other){ force_intersecting=true; + let stage_element=gameplay_modes::StageElement::new( + //stage_id: + captures[3].parse::().unwrap(), + //force: + match captures.get(1){ + Some(m)=>m.as_str()=="Force", + None=>false, + }, + //behaviour: + match &captures[2]{ + "Spawn"=>{ + modes_builder.insert_stage( + gameplay_modes::ModeId::MAIN, + gameplay_modes::StageId::new(captures[2].parse::().unwrap()), + gameplay_modes::Stage::new(model_id), + ); + gameplay_modes::StageElementBehaviour::SpawnAt + }, + "SpawnAt"=>gameplay_modes::StageElementBehaviour::SpawnAt, + //cancollide false so you don't hit the side + //NOT a decoration + "Trigger"=>{force_can_collide=false;gameplay_modes::StageElementBehaviour::Trigger}, + "Teleport"=>{force_can_collide=false;gameplay_modes::StageElementBehaviour::Teleport}, + "Platform"=>gameplay_modes::StageElementBehaviour::Platform, + _=>panic!("regex1[2] messed up bad"), + }, + ); modes_builder.push_mode_update( gameplay_modes::ModeId::MAIN, gameplay_modes::ModeUpdate::element( model_id, - gameplay_modes::StageElement::new( - //stage_id: - captures[3].parse::().unwrap(), - //force: - match captures.get(1){ - Some(m)=>m.as_str()=="Force", - None=>false, - }, - //behaviour: - match &captures[2]{ - "Spawn"|"SpawnAt"=>gameplay_modes::StageElementBehaviour::SpawnAt, - //cancollide false so you don't hit the side - //NOT a decoration - "Trigger"=>{force_can_collide=false;gameplay_modes::StageElementBehaviour::Trigger}, - "Teleport"=>{force_can_collide=false;gameplay_modes::StageElementBehaviour::Teleport}, - "Platform"=>gameplay_modes::StageElementBehaviour::Platform, - _=>panic!("regex1[2] messed up bad"), - }, - ), + stage_element, ), ); }else if let Some(captures)=lazy_regex::regex!(r"^(Jump|WormholeIn)(\d+)$")