Struct Package

Source
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

Source

pub fn has_updates(&self) -> bool

Source

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.

Source

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.

Source

pub fn file_name(&self) -> String

Source

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

Source

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

Source

pub fn save(&mut self) -> String

Source

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
Source

pub fn compute_hash(&self) -> String

Source

pub fn verify(&self) -> Verify

Source

pub fn new_fighter_frame(&mut self, fighter: &str, action: usize, frame: usize)

Source

pub fn insert_fighter_frame( &mut self, fighter: &str, action: usize, frame: usize, action_frame: ActionFrame, )

Source

pub fn delete_fighter_frame( &mut self, fighter: &str, action: usize, frame: usize, ) -> bool

Source

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.

Source

pub fn delete_fighter_colboxes( &mut self, fighter: &str, action: usize, frame: usize, colboxes_to_delete: &HashSet<usize>, )

Source

pub fn move_fighter_colboxes( &mut self, fighter: &str, action: usize, frame: usize, moved_colboxes: &HashSet<usize>, distance: (f32, f32), )

Source

pub fn point_hitbox_angles_to( &mut self, fighter: &str, action: usize, frame: usize, set_hitboxes: &HashSet<usize>, x: f32, y: f32, )

Source

pub fn resize_fighter_colboxes( &mut self, fighter: &str, action: usize, frame: usize, resized_colboxes: &HashSet<usize>, size_diff: f32, )

Source

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

Source

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

Source

pub fn force_update_entire_package(&mut self)

Source

pub fn updates(&mut self) -> Vec<PackageUpdate>

Trait Implementations§

Source§

impl Clone for Package

Source§

fn clone(&self) -> Package

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Package

Source§

fn default() -> Package

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Package

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Node for Package

Source§

fn node_step(&mut self, runner: NodeRunner) -> String

Source§

impl Serialize for Package

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Err = <U as TryFrom<T>>::Err

Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Erased for T

Source§

impl<T> ErasedDestructor for T
where T: 'static,