/// <summary> /// This is mainly used to update new Clients on connect. /// So we do not spam too many net messages at once for a direct /// client update, control the rate of update slowly: /// </summary> IEnumerator ControlledClientUpdate(GameObject requestor) { SendOverallUpdate(requestor); yield return(YieldHelper.DeciSecond); SendBloodUpdate(requestor); yield return(YieldHelper.DeciSecond); SendRespiratoryUpdate(requestor); yield return(YieldHelper.DeciSecond); if (livingHealthBehaviour.brainSystem != null) { SendBrainUpdate(requestor); yield return(YieldHelper.DeciSecond); } for (int i = 0; i < livingHealthBehaviour.BodyParts.Count; i++) { HealthBodyPartMessage.Send(requestor, gameObject, livingHealthBehaviour.BodyParts[i].Type, livingHealthBehaviour.BodyParts[i].BruteDamage, livingHealthBehaviour.BodyParts[i].BurnDamage); yield return(YieldHelper.DeciSecond); } }
public static void RunDamageSelf(string bodyPartString, int burnDamage, int bruteDamage) { if (CustomNetworkManager.Instance._isServer == false) { Logger.Log("Can only execute command from server."); return; } bool success = BodyPartType.TryParse(bodyPartString, true, out BodyPartType bodyPart); if (success == false) { Logger.Log("Invalid body part '" + bodyPartString + "'"); return; } bool playerSpawned = (PlayerManager.LocalPlayer != null); if (playerSpawned == false) { Logger.Log("Cannot damage player. Player has not spawned."); return; } Logger.Log("Debugger inflicting " + burnDamage + " burn damage and " + bruteDamage + " brute damage on " + bodyPart + " of " + PlayerManager.LocalPlayer.name); HealthBodyPartMessage.Send(PlayerManager.LocalPlayer, PlayerManager.LocalPlayer, bodyPart, burnDamage, bruteDamage); }
private void ServerApplyHeal(BodyPartBehaviour targetBodyPart) { targetBodyPart.HealDamage(40, healType); stackable.ServerConsume(1); HealthBodyPartMessage.Send(targetBodyPart.livingHealthBehaviour.gameObject, targetBodyPart.livingHealthBehaviour.gameObject, targetBodyPart.Type, targetBodyPart.livingHealthBehaviour.GetTotalBruteDamage(), targetBodyPart.livingHealthBehaviour.GetTotalBurnDamage()); }
/// <summary> /// This is mainly used to update new Clients on connect. /// So we do not spam too many net messages at once for a direct /// client update, control the rate of update slowly: /// </summary> IEnumerator ControlledClientUpdate(GameObject requestor) { SendConsciousUpdate(requestor); yield return(WaitFor.Seconds(.1f)); SendOverallUpdate(requestor); yield return(WaitFor.Seconds(.1f)); SendBloodUpdate(requestor); yield return(WaitFor.Seconds(.1f)); SendRespiratoryUpdate(); yield return(WaitFor.Seconds(.1f)); SendTemperatureUpdate(); yield return(WaitFor.Seconds(.1f)); SendPressureUpdate(); yield return(WaitFor.Seconds(.1f)); if (livingHealthBehaviour.brainSystem != null) { SendBrainUpdate(requestor); yield return(WaitFor.Seconds(.1f)); } for (int i = 0; i < livingHealthBehaviour.BodyParts.Count; i++) { HealthBodyPartMessage.Send(requestor, gameObject, livingHealthBehaviour.BodyParts[i].Type, livingHealthBehaviour.BodyParts[i].BruteDamage, livingHealthBehaviour.BodyParts[i].BurnDamage); yield return(WaitFor.Seconds(.1f)); } }