void Awake() { RustAI = GetComponent <NPCAI>(); RustAI.ServerDestroy(); RustMetabolism = GetComponent <NPCMetabolism>(); Base = GetComponent <BaseNPC>(); lastTick = Time.time; targetpoint = Vector3.zero; action = Act.None; hungerLose = RustMetabolism.calories.max * 2 / 12000; thristyLose = RustMetabolism.hydration.max * 3 / 12000; sleepLose = RustMetabolism.sleep.max / 12000; inventory = new ItemContainer(); inventory.ServerInitialize(null, 6); Base.enableSaving = false; BaseEntity.saveList.Remove(Base); Base.InitializeHealth(Base.health * HealthModificator, Base.MaxHealth() * HealthModificator); Base.locomotion.gallopSpeed *= SpeedModificator; Base.locomotion.trotSpeed *= SpeedModificator; Base.locomotion.acceleration *= SpeedModificator; }
void Awake() { AI = GetComponent <NPCAI>(); NPC = GetComponent <BaseNPC>(); Metabolism = GetComponent <NPCMetabolism>(); isAttacking = false; Target = null; NPC.state = BaseNPC.State.Normal; NPC.enableSaving = false; BaseEntity.saveList.Remove(NPC); }
void pet(BasePlayer player, string command, string[] args) { if (!UsePermission || HasPermission(player, "cannpc")) { NpcControl comp = player.GetComponent <NpcControl>() ?? player.gameObject.AddComponent <NpcControl>(); if (args.Length > 0) { switch (args[0]) { case "free": if (comp.npc) { GameObject.Destroy(comp.npc); SendReply(player, NpcFree); } else { SendReply(player, NotNpc); } break; case "draw": if (GlobalDraw) { if (comp.DrawEnabled) { comp.DrawEnabled = false; SendReply(player, DrawDis); } else { comp.DrawEnabled = true; SendReply(player, DrawEn); } } else { SendReply(player, DrawSysDis); } break; case "sleep": if (comp.npc) { SendReply(player, SleepMsg); comp.npc.action = Act.Sleep; } else { SendReply(player, NotNpc); } break; case "info": if (comp.npc) { NPCMetabolism meta = comp.npc.RustMetabolism; SendReply(player, InfoMsg .Replace("{health}", Math.Round(comp.npc.Base.health * 100 / comp.npc.Base.MaxHealth()).ToString()) .Replace("{hunger}", Math.Round(meta.hydration.value * 100 / meta.hydration.max).ToString()) .Replace("{thirst}", Math.Round(meta.calories.value * 100 / meta.calories.max).ToString()) .Replace("{sleep}", Math.Round(meta.sleep.value * 100 / meta.sleep.max).ToString()) .Replace("{stamina}", Math.Round(meta.stamina.value * 100 / meta.stamina.max).ToString())); } else { SendReply(player, NotNpc); } break; } } else { if (comp.enabled) { comp.enabled = false; SendReply(player, DeactivatedMsg); } else { comp.enabled = true; SendReply(player, ActivatedMsg); } } } else { SendReply(player, NoPermMsg); } }