public BaseEntityClient CreateEntity(String className) { BaseEntityClient ent = null; try { ent = MefServer.GetExportedValue <BaseEntityClient>(className); ent.ClassName = className; } catch (Exception e) { _ConsoleManager.WriteLine(Color.Red, String.Format("Failed to create entity {0}: {1}", className, e.Message)); return(null); } _EntityList.Add(ent); return(ent); }
private BaseEntityServer CreateEntity(String className, IEdict edict, int index = -1) { BaseEntityServer ent = null; try { ent = MefServer.GetExportedValue <BaseEntityServer>(className); ent.ClassName = className; } catch (Exception e) { _ConsoleManager.WriteLine(Color.Red, String.Format("Failed to create entity {0}: {1}", className, e.Message)); return(null); } if (edict == null) { _EngineServer.CreateEdict(ent, index); } else { ent.Edict = edict; } _EntityList.Add(ent); ent.PostCreate(); if (ent.IsServerOnly) { Debug.Assert(false); //todo fix to work ent.Edict.SetSlotAndSerial(1, -1); } else { int slot = _EngineServer.IndexOfEdict(ent.Edict); ent.Edict.SetSlotAndSerial(slot, _EntSerials[slot]); } return(ent); }
public override void Execute(string[] args) { if (_GameInfo.IsClient) { _Manager.WriteLine(Color.Blue, "cmdlist - client"); } else { _Manager.WriteLine(Color.Blue, "cmdlist - server"); } var list = _Manager.GetConCommands(); list.Sort((a, b) => a.Name.CompareTo(b.Name)); foreach (var c in list) { var h = c.HelpString; h = h.Replace('\n', ' '); if (h.Length > 64) { h = h.Substring(0, 64) + "..."; } _Manager.Write("\t" + c.Name); if (String.IsNullOrEmpty(h)) { _Manager.WriteLine(""); } else { _Manager.WriteLine(Color.DarkRed, String.Format(" - {0}", h)); } } }