GameAPI standards listmod2

From Empyrion: Galactic Survival Wiki
Jump to: navigation, search

Index: GameAPI

Standard: Listing your mod[edit | edit source]

Basic[edit | edit source]

When a player writes in chat '!mods', your mod should list itself.

Proposed implementation[edit | edit source]

Under Game_Event, when receiving Event_ChatMessage, you should check if it is '!mods'

The check should ideally react to any casing. (!Mods, !MODS, !mods alike)

This should only respond to the user, rather than be server-wide.

Pre-req[edit | edit source]

Code sample[edit | edit source]

public void Game_Event(CmdId cmdId, ushort seqNr, object data)
{
try
{
 switch (cmdId)
 {
  case CmdId.Event_ChatMessage:
   ChatInfo ci = (ChatInfo)data;
   if (ci == null) { break; }
   if (ci.type != 8 && ci.type != 7 && ci.msg.ToLower().IndexOf("!mods") == 0)
   {
    ChatMessage(thismod,ci.playerId);
   }
  break;
 } 
}