In a plugin I'm working on, I'm trying to save the current metabolic state...
I thought this would be pretty easy doing something like:
I thought this would be pretty easy doing something like:
private object OnRunPlayerMetabolism(PlayerMetabolism meta, BaseCombatEntity entity)
{
BasePlayer basePlayer = entity as BasePlayer;
// Check if we've already saved the previous state.
if (onlinePlayers[basePlayer].SavedMetabolism != null) return null;
onlinePlayers[basePlayer].SavedMetabolism = basePlayer.metabolism.Copy();
return null;
}But I get the following error:Looking in Rust.Data.dll with JustDecompile, I see:error CS1061: Type `PlayerMetabolism' does not contain a definition for `Copy' and no extension method `Copy' of type `PlayerMetabolism' could be found. Are you missing an assembly reference?
public PlayerMetabolism Copy()
{
PlayerMetabolism playerMetabolism = Pool.Get<PlayerMetabolism>();
this.CopyTo(playerMetabolism);
return playerMetabolism;
}
public void CopyTo(PlayerMetabolism instance)
{
instance.health = this.health;
instance.calories = this.calories;
instance.hydration = this.hydration;
instance.heartrate = this.heartrate;
instance.temperature = this.temperature;
instance.poison = this.poison;
instance.radiation_level = this.radiation_level;
instance.wetness = this.wetness;
instance.dirtyness = this.dirtyness;
instance.oxygen = this.oxygen;
instance.bleeding = this.bleeding;
instance.radiation_poisoning = this.radiation_poisoning;
instance.comfort = this.comfort;
instance.pending_health = this.pending_health;
}Is it not possible to make use of these functions from within a plugin?