rust/hedgewars-engine-messages/src/lib.rs
changeset 14205 a8fe9cd51154
child 14206 257b296169a8
equal deleted inserted replaced
14204:4b418709b1cf 14205:a8fe9cd51154
       
     1 use crate::command::Command;
       
     2 
       
     3 pub enum KeystrokeAction {
       
     4     Press,
       
     5     Release,
       
     6 }
       
     7 
       
     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     Empty,
       
    18     Timer(u8),
       
    19     Slot(u8),
       
    20     SetWeapon(u8),
       
    21     Put(i32, i32),
       
    22     HighJump,
       
    23     LowJump,
       
    24     Skip,
       
    25     TeamControlGained(String),
       
    26     TeamControlLost(String),
       
    27 }
       
    28 
       
    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 pub enum ConfigEngineMessage {
       
    43     ConfigRequest,
       
    44     SetAmmo(String),
       
    45     SetScript(String),
       
    46     SetScriptParam(String),
       
    47     Spectate,
       
    48     TeamLocality(bool),
       
    49     SetMap(String),
       
    50     SetTheme(String),
       
    51     SetSeed(String),
       
    52     SetTemplateFilter(String),
       
    53     SetMapGenerator(String),
       
    54     SetFeatureSize(u8),
       
    55     SetDelay(u32),
       
    56     SetReadyDelay(u32),
       
    57     SetCratesFrequency(u8),
       
    58     SetHealthCrateProbability(u8),
       
    59     SetHealthCratesNumber(u8),
       
    60     SetRoundsTilSuddenDeath(u8),
       
    61     SetSuddenDeathWaterRiseSpeed(u8),
       
    62     SetSuddenDeathHealthDecreaseRate(u8),
       
    63     SetDamageMultiplier(u32),
       
    64     SetRopeLength(u32),
       
    65     SetGetawayTime(u32),
       
    66     SetDudMinesPercent(u8),
       
    67     SetMinesNumber(u32),
       
    68     SetAirMinesNumber(u32),
       
    69     SetBarrelsNumber(u32),
       
    70     SetTurnTime(u32),
       
    71     SetMinesTime(u32),
       
    72     SetWorldEdge(u8),
       
    73     Draw, // TODO
       
    74     SetVoicePack(String),
       
    75     AddHedgehog(String, u8, u32),
       
    76     AddTeam(String, u8),
       
    77     SetHedgehogCoordinates(i32, i32),
       
    78     SetFort(String),
       
    79     SetGrave(String),
       
    80     SetHat(String),
       
    81     SetFlag(String),
       
    82     SetOwner(String),
       
    83     SetOneClanMode(bool),
       
    84     SetMultishootMode(bool),
       
    85     SetSolidLand(bool),
       
    86     SetBorders(bool),
       
    87     SetDivideTeams(bool),
       
    88     SetLowGravity(bool),
       
    89     SetLaserSight(bool),
       
    90     SetInvulnerability(bool),
       
    91     SetHealthReset(bool),
       
    92     SetVampiric(bool),
       
    93     SetKarma(bool),
       
    94     SetArtilleryMode(bool),
       
    95     SetHedgehogSwitch(bool),
       
    96     SetRandomOrder(bool),
       
    97     SetKingMode(bool),
       
    98     SetPlaceHedgehog(bool),
       
    99     SetSharedAmmo(bool),
       
   100     SetGirdersEnabled(bool),
       
   101     SetLandObjectsEnabled(bool),
       
   102     SetAISurvivalMode(bool),
       
   103     SetInfiniteAttack(bool),
       
   104     SetResetWeapons(bool),
       
   105     SetAmmoPerHedgehog(bool),
       
   106     SetWindMode(u8),
       
   107     SetTagTeam(bool),
       
   108     SetBottomBorder(bool),
       
   109     SetShoppaBorder(bool),
       
   110 }
       
   111 
       
   112 pub enum EngineMessage {
       
   113     Synced(SyncedEngineMessage, u32),
       
   114     Unsynced(UnsyncedEngineMessage),
       
   115     Config(ConfigEngineMessage),
       
   116 }
       
   117 
       
   118 impl EngineMessage {
       
   119     fn from_bytes(buf: &[u8]) -> Self {
       
   120         unimplemented!()
       
   121     }
       
   122 
       
   123     fn to_bytes(&self) -> Vec<u8> {
       
   124         unimplemented!()
       
   125     }
       
   126 }
       
   127 
       
   128 #[cfg(test)]
       
   129 mod tests {
       
   130     #[test]
       
   131     fn it_works() {
       
   132         assert_eq!(2 + 2, 4);
       
   133     }
       
   134 }