parent
123bc8af47
commit
4227f18992
@ -43,6 +43,8 @@ pub enum ValidateError{
|
||||
ApiGetScriptFromHash(submissions_api::types::SingleItemError),
|
||||
ApiUpdateSubmissionModel(submissions_api::Error),
|
||||
ApiActionSubmissionValidate(submissions_api::Error),
|
||||
ModelFileRootMustHaveOneChild,
|
||||
ModelFileChildRefIsNil,
|
||||
ModelFileEncode(rbx_binary::EncodeError),
|
||||
AssetUpload(rbx_asset::cookie::UploadError),
|
||||
AssetCreate(rbx_asset::cookie::CreateError),
|
||||
@ -213,7 +215,10 @@ impl Validator{
|
||||
if modified{
|
||||
// serialize model (slow!)
|
||||
let mut data=Vec::new();
|
||||
rbx_binary::to_writer(&mut data,&dom,dom.root().children()).map_err(ValidateError::ModelFileEncode)?;
|
||||
let &[map_ref]=dom.root().children()else{
|
||||
return Err(ValidateError::ModelFileRootMustHaveOneChild);
|
||||
};
|
||||
rbx_binary::to_writer(&mut data,&dom,&[map_ref]).map_err(ValidateError::ModelFileEncode)?;
|
||||
|
||||
// upload a model lol
|
||||
let model_id=if let Some(model_id)=validate_info.ValidatedModelID{
|
||||
@ -229,9 +234,13 @@ impl Validator{
|
||||
|
||||
response.AssetId
|
||||
}else{
|
||||
// grab the map instance from the map re
|
||||
let Some(map_instance)=dom.get_by_ref(map_ref)else{
|
||||
return Err(ValidateError::ModelFileChildRefIsNil);
|
||||
};
|
||||
// create new model
|
||||
let response=self.roblox_cookie.create(rbx_asset::cookie::CreateRequest{
|
||||
name:dom.root().name.clone(),
|
||||
name:map_instance.name.clone(),
|
||||
description:"".to_owned(),
|
||||
ispublic:true,
|
||||
allowComments:true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user