pub struct Package {
pub meta: PackageMeta,
pub rules: Rules,
pub stages: KeyedContextVec<Stage>,
pub fighters: KeyedContextVec<Fighter>,
/* private fields */
}
Expand description
Stores data that makes up a single game Is also responsible for loading and saving itself
Fields§
§meta: PackageMeta
§rules: Rules
§stages: KeyedContextVec<Stage>
§fighters: KeyedContextVec<Fighter>
Implementations§
Source§impl Package
impl Package
pub fn has_updates(&self) -> bool
Sourcepub fn blank(name: &str) -> Package
pub fn blank(name: &str) -> Package
Creates a new blank package with the specified name. DANGER: If a package with the same name does exist, saving the returned package will overwrite the existing package.
Sourcepub fn open(name: &str) -> Option<Package>
pub fn open(name: &str) -> Option<Package>
Loads and returns the package with the specified name. Returns None if the package doesnt exist or is broken.
pub fn file_name(&self) -> String
Sourcepub fn open_or_generate(name: &str) -> Option<Package>
pub fn open_or_generate(name: &str) -> Option<Package>
Opens a package if it exists Creates and opens it if it doesn’t However if it does exist but is broken in some way it returns None
Sourcepub fn publish(&mut self) -> String
pub fn publish(&mut self) -> String
Produces a zip of the package in the PF_Sandbox/publish directory The actual package has its published_version incremented and is then saved The exported package has its published flag set to true
pub fn save(&mut self) -> String
Sourcepub fn load(&mut self) -> Result<(), String>
pub fn load(&mut self) -> Result<(), String>
Clears the current package data, then loads the package from disk The upgraded json is loaded into this package the user can then save the package to make the upgrade permanent Advantages over saving upgraded json immediately:
- the package cannot be saved if it wont load
- the user can choose to not save, if they find issues with the upgrade
pub fn compute_hash(&self) -> String
pub fn verify(&self) -> Verify
pub fn new_fighter_frame(&mut self, fighter: &str, action: usize, frame: usize)
pub fn insert_fighter_frame( &mut self, fighter: &str, action: usize, frame: usize, action_frame: ActionFrame, )
pub fn delete_fighter_frame( &mut self, fighter: &str, action: usize, frame: usize, ) -> bool
Sourcepub fn append_fighter_colbox(
&mut self,
fighter: &str,
action: usize,
frame: usize,
new_colbox: CollisionBox,
link_to: &HashSet<usize>,
link_type: LinkType,
) -> usize
pub fn append_fighter_colbox( &mut self, fighter: &str, action: usize, frame: usize, new_colbox: CollisionBox, link_to: &HashSet<usize>, link_type: LinkType, ) -> usize
add the passed collisionbox to the specified fighter frame the added collisionbox is linked to the specified collisionboxes returns the index the collisionbox was added to.
pub fn delete_fighter_colboxes( &mut self, fighter: &str, action: usize, frame: usize, colboxes_to_delete: &HashSet<usize>, )
pub fn move_fighter_colboxes( &mut self, fighter: &str, action: usize, frame: usize, moved_colboxes: &HashSet<usize>, distance: (f32, f32), )
pub fn point_hitbox_angles_to( &mut self, fighter: &str, action: usize, frame: usize, set_hitboxes: &HashSet<usize>, x: f32, y: f32, )
pub fn resize_fighter_colboxes( &mut self, fighter: &str, action: usize, frame: usize, resized_colboxes: &HashSet<usize>, size_diff: f32, )
Sourcepub fn fighter_colboxes_send_to_back(
&mut self,
fighter: &str,
action: usize,
frame: usize,
reordered_colboxes: &HashSet<usize>,
)
pub fn fighter_colboxes_send_to_back( &mut self, fighter: &str, action: usize, frame: usize, reordered_colboxes: &HashSet<usize>, )
All colboxes or links containing colboxes from reordered_colboxes are sent to the back
Sourcepub fn fighter_colboxes_send_to_front(
&mut self,
fighter: &str,
action: usize,
frame: usize,
reordered_colboxes: &HashSet<usize>,
)
pub fn fighter_colboxes_send_to_front( &mut self, fighter: &str, action: usize, frame: usize, reordered_colboxes: &HashSet<usize>, )
All colboxes or links containing colboxes from reordered_colboxes are sent to the front
pub fn force_update_entire_package(&mut self)
pub fn updates(&mut self) -> Vec<PackageUpdate>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Package
impl<'de> Deserialize<'de> for Package
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more