fix touching spawns

This commit is contained in:
Quaternions 2024-02-12 21:37:54 -08:00
parent 66269f326d
commit ea48c40938

View File

@ -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::<u32>().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::<u32>().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::<u32>().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::<u32>().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::<u32>().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+)$")