/******************************************
* Variables                               *
******************************************/



/******************************************
* Public Functions                        *
******************************************/
sub PowerManager_Initialize {
  let pow = GetCommonDataDefault("power", 0);
  if(pow == 0){
    SetCommonData("power", 0);
  }
}

// Set the power.
function SetPower(num){
  SetCommonData("power", num);
  capPower;
}

// Add to current power.
function AddPower(num){
  let newPower = GetCommonDataDefault("power", 0)+num;
  SetCommonData("power", newPower);
  capPower;
}

// Set power to 0.
sub EmptyPower {
  SetCommonData("power", 0);
}

// Get the current power
function GetPower(){
  return GetCommonDataDefault("power", 0);
}

// Draws the power bar every frame.
sub PowerManager_Run {
}
/******************************************
* Private Functions                       *
******************************************/

sub capPower {
  if(GetCommonDataDefault("power", 0)>120){
    SetCommonData("power", 120);
  }
}