no need for scriptstate any more
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use crate::keys::Keyring;
|
||||
|
||||
/// The game-global player state: stats that follow the player across boards.
|
||||
@@ -26,7 +28,14 @@ pub struct Player {
|
||||
pub gems: i64,
|
||||
}
|
||||
|
||||
pub type PlayerRef = Rc<RefCell<Player>>;
|
||||
|
||||
impl Player {
|
||||
/// Create a new PlayerRef from a default player
|
||||
pub fn new_ref() -> PlayerRef {
|
||||
Rc::new(RefCell::from(Player::default()))
|
||||
}
|
||||
|
||||
/// Attempt to modify the gem total by the given amount, but maintain a minimum of zero.
|
||||
/// If the modification would take up below zero, leave it alone and return false.
|
||||
pub fn alter_gems(&mut self, delta: i64) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user