RUST CODE
This commit is contained in:
parent
909cae2362
commit
6ffb613a08
1
validation/.gitignore
vendored
Normal file
1
validation/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
16
validation/Cargo.lock
generated
Normal file
16
validation/Cargo.lock
generated
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maps-valication"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
7
validation/Cargo.toml
Normal file
7
validation/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "maps-valication"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bitflags = "2.6.0"
|
6
validation/src/main.rs
Normal file
6
validation/src/main.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
mod types;
|
||||||
|
mod maptest;
|
||||||
|
mod staging;
|
||||||
|
|
||||||
|
fn main(){
|
||||||
|
}
|
35
validation/src/maptest.rs
Normal file
35
validation/src/maptest.rs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
use crate::types::Games;
|
||||||
|
|
||||||
|
enum Status{
|
||||||
|
Accepted,
|
||||||
|
Rejected,//map council will not request changes, submit a new map
|
||||||
|
ChangesRequested,//map council requests changes
|
||||||
|
Submitted,//Submitted by owner for review by map council
|
||||||
|
UnderConstruction,//default state upon map creation
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MaptestType{
|
||||||
|
// mapfixes change an existing map on staging game, so they know what map_id they upload to.
|
||||||
|
Mapfix{
|
||||||
|
//maps database entry id
|
||||||
|
map_id:u64,
|
||||||
|
},
|
||||||
|
// map submissions create a new map entry in the staging map database when they are accepted.
|
||||||
|
Submission{
|
||||||
|
games:Games,
|
||||||
|
creator:String,
|
||||||
|
display_name:String,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Map{
|
||||||
|
//maptest database entry id
|
||||||
|
id:u64,
|
||||||
|
date:u64,
|
||||||
|
// int64 UserID who created the submission
|
||||||
|
// this user is allowed to change any data at any time, except for mapfix target map id
|
||||||
|
owner:u64,
|
||||||
|
model_id:u64,// asset id of the most recently submitted model
|
||||||
|
maptest_type:MaptestType,
|
||||||
|
status:Status,
|
||||||
|
}
|
25
validation/src/staging.rs
Normal file
25
validation/src/staging.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
use crate::types::Games;
|
||||||
|
|
||||||
|
// This data structure just exists to remember the hash of the model file as it's uploaded
|
||||||
|
// so that the hash can be checked later to see if the file is changed
|
||||||
|
struct AssetVersion{
|
||||||
|
//roblox asset id
|
||||||
|
asset_id:u64,
|
||||||
|
//hash of map file before upload
|
||||||
|
hash:u128,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Git;
|
||||||
|
|
||||||
|
struct Map{
|
||||||
|
id:u64,//database entry
|
||||||
|
date:u64,
|
||||||
|
games:Games,
|
||||||
|
creator:String,
|
||||||
|
display_name:String,
|
||||||
|
//the staging model is created at the same time as the maps database entry
|
||||||
|
staging:AssetVersion,
|
||||||
|
//the main model does not exist before the submission is published for the first time
|
||||||
|
main:Option<AssetVersion>,
|
||||||
|
changelog:Git,//An entire git repo, ideally the xml of the roblox map
|
||||||
|
}
|
8
validation/src/types.rs
Normal file
8
validation/src/types.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
bitflags::bitflags!{
|
||||||
|
#[derive(Clone,Copy,Debug,Default)]
|
||||||
|
pub struct Games:u32{
|
||||||
|
const Bhop=1<<0;
|
||||||
|
const Surf=2<<0;
|
||||||
|
const FlyTrials=5<<0;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user