Skip to content

Commit

Permalink
switch to StartServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrison Ford committed Jan 4, 2024
1 parent a63d994 commit 9771a7e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
**/*.rs.bk
/demo/Place.rbxlx
*.rbxm
*.rbxl
.DS_Store
2 changes: 1 addition & 1 deletion aftman.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# To add a new tool, add an entry to this table.
[tools]
lune = "filiptibell/[email protected]"
# rojo = "rojo-rbx/rojo@6.2.0"
rojo = "rojo-rbx/rojo@7.3.0"
2 changes: 1 addition & 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: Option<String>,
place_file: String,

#[arg(long)]
universe_id: Option<u64>,
Expand Down
53 changes: 22 additions & 31 deletions src/place_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ impl Drop for KillOnDrop {
pub struct PlaceRunner {
pub port: u16,
pub script: String,
pub place_file: String,
pub universe_id: Option<u64>,
pub place_id: Option<u64>,
pub place_file: Option<String>,
pub no_launch: bool,
pub oneshot: bool,
}
Expand Down Expand Up @@ -74,36 +74,27 @@ impl PlaceRunner {

Self::install_plugin()?;

let studio_args = match (&self.place_file, self.universe_id, self.place_id) {
(None, Some(universe_id), Some(place_id)) => {
vec![
"-task".to_string(),
"EditPlace".to_string(),
"-placeId".to_string(),
format!("{place_id:}"),
"-universeId".to_string(),
format!("{universe_id:}"),
]
}
(None, None, Some(place_id)) => {
vec![
"-task".to_string(),
"EditPlace".to_string(),
"-placeId".to_string(),
format!("{place_id:}"),
]
}
(Some(place_file), None, None) => {
vec![place_file.clone()]
}
_ => {
if self.no_launch {
vec![]
} else {
bail!("invalid arguments passed - you may only specify a place_id (and optionally a universe_id), or a place_file, but not both")
}
}
};
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 api_svc = message_receiver::Svc::start()
.await
Expand Down

0 comments on commit 9771a7e

Please sign in to comment.