rust/hedgewars-engine-messages/src/messages.rs
changeset 14230 ab1ef7074e07
child 14231 1c55c54013c4
equal deleted inserted replaced
14229:87f1054c2333 14230:ab1ef7074e07
       
     1 #[derive(Debug, PartialEq)]
       
     2 pub enum KeystrokeAction {
       
     3     Press,
       
     4     Release,
       
     5 }
       
     6 
       
     7 #[derive(Debug, PartialEq)]
       
     8 pub enum SyncedEngineMessage {
       
     9     Left(KeystrokeAction),
       
    10     Right(KeystrokeAction),
       
    11     Up(KeystrokeAction),
       
    12     Down(KeystrokeAction),
       
    13     Precise(KeystrokeAction),
       
    14     Attack(KeystrokeAction),
       
    15     NextTurn,
       
    16     Switch,
       
    17     Timer(u8),
       
    18     Slot(u8),
       
    19     SetWeapon(u8),
       
    20     Put(i32, i32),
       
    21     HighJump,
       
    22     LowJump,
       
    23     Skip,
       
    24     TeamControlGained(String),
       
    25     TeamControlLost(String),
       
    26 }
       
    27 
       
    28 #[derive(Debug, PartialEq)]
       
    29 pub enum UnsyncedEngineMessage {
       
    30     Ping,
       
    31     Pong,
       
    32     Say(String),
       
    33     Taunt(u8),
       
    34     GameType(u8),
       
    35     Warning(String),
       
    36     StopSyncing,
       
    37     GameOver,
       
    38     GameInterrupted,
       
    39     GameSetupChecksum(String),
       
    40 }
       
    41 
       
    42 #[derive(Debug, PartialEq)]
       
    43 pub enum ConfigEngineMessage {
       
    44     ConfigRequest,
       
    45     SetAmmo(String),
       
    46     SetScript(String),
       
    47     SetScriptParam(String),
       
    48     Spectate,
       
    49     TeamLocality(bool),
       
    50     SetMap(String),
       
    51     SetTheme(String),
       
    52     SetSeed(String),
       
    53     SetTemplateFilter(String),
       
    54     SetMapGenerator(String),
       
    55     SetFeatureSize(u8),
       
    56     SetDelay(u32),
       
    57     SetReadyDelay(u32),
       
    58     SetCratesFrequency(u8),
       
    59     SetHealthCrateProbability(u8),
       
    60     SetHealthCratesNumber(u8),
       
    61     SetRoundsTilSuddenDeath(u8),
       
    62     SetSuddenDeathWaterRiseSpeed(u8),
       
    63     SetSuddenDeathHealthDecreaseRate(u8),
       
    64     SetDamageMultiplier(u32),
       
    65     SetRopeLength(u32),
       
    66     SetGetawayTime(u32),
       
    67     SetDudMinesPercent(u8),
       
    68     SetMinesNumber(u32),
       
    69     SetAirMinesNumber(u32),
       
    70     SetBarrelsNumber(u32),
       
    71     SetTurnTime(u32),
       
    72     SetMinesTime(u32),
       
    73     SetWorldEdge(u8),
       
    74     Draw,
       
    75     // TODO
       
    76     SetVoicePack(String),
       
    77     AddHedgehog(String, u8, u32),
       
    78     AddTeam(String, u8),
       
    79     SetHedgehogCoordinates(i32, i32),
       
    80     SetFort(String),
       
    81     SetGrave(String),
       
    82     SetHat(String),
       
    83     SetFlag(String),
       
    84     SetOwner(String),
       
    85     SetOneClanMode(bool),
       
    86     SetMultishootMode(bool),
       
    87     SetSolidLand(bool),
       
    88     SetBorders(bool),
       
    89     SetDivideTeams(bool),
       
    90     SetLowGravity(bool),
       
    91     SetLaserSight(bool),
       
    92     SetInvulnerability(bool),
       
    93     SetHealthReset(bool),
       
    94     SetVampiric(bool),
       
    95     SetKarma(bool),
       
    96     SetArtilleryMode(bool),
       
    97     SetHedgehogSwitch(bool),
       
    98     SetRandomOrder(bool),
       
    99     SetKingMode(bool),
       
   100     SetPlaceHedgehog(bool),
       
   101     SetSharedAmmo(bool),
       
   102     SetGirdersEnabled(bool),
       
   103     SetLandObjectsEnabled(bool),
       
   104     SetAISurvivalMode(bool),
       
   105     SetInfiniteAttack(bool),
       
   106     SetResetWeapons(bool),
       
   107     SetAmmoPerHedgehog(bool),
       
   108     SetWindMode(u8),
       
   109     SetTagTeam(bool),
       
   110     SetBottomBorder(bool),
       
   111     SetShoppaBorder(bool),
       
   112 }
       
   113 
       
   114 #[derive(Debug, PartialEq)]
       
   115 pub enum EngineMessage {
       
   116     Synced(SyncedEngineMessage, u32),
       
   117     Unsynced(UnsyncedEngineMessage),
       
   118     Config(ConfigEngineMessage),
       
   119     Unknown,
       
   120     Empty,
       
   121 }
       
   122 
       
   123 impl EngineMessage {
       
   124     fn from_bytes(buf: &[u8]) -> Self {
       
   125         unimplemented!()
       
   126     }
       
   127 
       
   128     fn to_bytes(&self) -> Vec<u8> {
       
   129         unimplemented!()
       
   130     }
       
   131 }