Skip to content

Commit

Permalink
add team test functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrison Ford committed Jan 4, 2024
1 parent 9771a7e commit a2a8196
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct RunOptions {
script: String,

#[arg(long)]
place_file: String,
place_file: Option<String>,

#[arg(long)]
universe_id: Option<u64>,
Expand All @@ -44,6 +44,9 @@ struct RunOptions {

#[arg(short, long)]
no_launch: bool,

#[arg(short, long)]
team_test: bool,
}

async fn run(options: RunOptions) -> Result<i32> {
Expand All @@ -54,6 +57,7 @@ async fn run(options: RunOptions) -> Result<i32> {
place_file,
oneshot,
no_launch,
team_test
} = options;
let mut script = File::open(script)?;
let mut str = String::default();
Expand All @@ -67,6 +71,7 @@ async fn run(options: RunOptions) -> Result<i32> {
place_id,
oneshot,
no_launch,
team_test
};

let (exit_sender, exit_receiver) = async_channel::unbounded::<()>();
Expand Down
57 changes: 35 additions & 22 deletions src/place_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ impl Drop for KillOnDrop {
pub struct PlaceRunner {
pub port: u16,
pub script: String,
pub place_file: String,
pub place_file: Option<String>,
pub universe_id: Option<u64>,
pub place_id: Option<u64>,
pub no_launch: bool,
pub oneshot: bool,
pub team_test: bool,
}

impl PlaceRunner {
Expand Down Expand Up @@ -74,27 +75,39 @@ impl PlaceRunner {

Self::install_plugin()?;

let studio_args = vec![
"-task".to_string(),
"StartServer".to_string(),
"-placeId".to_string(),
"0".to_string(),
"-universeId".to_string(),
"0".to_string(),
"-creatorId".to_string(),
"0".to_string(),
"-creatorType".to_string(),
"0".to_string(),
"-numtestserverplayersuponstartup".to_string(),
"0".to_string()
];

std::fs::copy(
&self.place_file,
dbg!(studio_install
.plugins_path()
.join("../server.rbxl"))
)?;
let studio_args = match &self.team_test {
true => {
vec![
"-task".to_string(),
"StartTeamTest".to_string(),
"-placeId".to_string(),
format!("{:}", self.place_id.unwrap()),
"-universeId".to_string(),
format!("{:}", self.universe_id.unwrap()),
]
}
false => {
let place_file = self.place_file.as_ref().unwrap();
std::fs::copy(
place_file,
dbg!(studio_install.plugins_path().join("../server.rbxl")),
)?;
vec![
"-task".to_string(),
"StartServer".to_string(),
"-placeId".to_string(),
"0".to_string(),
"-universeId".to_string(),
"0".to_string(),
"-creatorId".to_string(),
"0".to_string(),
"-creatorType".to_string(),
"0".to_string(),
"-numtestserverplayersuponstartup".to_string(),
"0".to_string(),
]
}
};

let api_svc = message_receiver::Svc::start()
.await
Expand Down

0 comments on commit a2a8196

Please sign in to comment.