Support for Eat My Dust (#4)

* Support for Eat My Dust
Zombie Alert manager is stubbed.
Added helpers to allow for weapon MMO.
PlayerData for Eat My Dust

* Zombie Alert Added
* Fix Zombie Alert Timing
* Honestly should probably catch this exception [null room in PM handler]. I foresee it occurring very commonly. While it shouldn't halt the server (except in visual studio debug), it's annoying to see.
This commit is contained in:
Hipposgrumm 2024-12-29 09:05:32 -07:00 committed by GitHub
parent d2a11b04e2
commit c06cfb4d17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 5 deletions

View File

@ -0,0 +1,29 @@
using System.Globalization;
using sodoffmmo.Attributes;
using sodoffmmo.Core;
using sodoffmmo.Data;
namespace sodoffmmo.CommandHandlers;
// TODO: This is currently stubbed. Supposed to do something.
// Should probably be done by someone who actually played the game.
[ExtensionCommandHandler("SU")]
public class EMDZombiesUpdateHandler : CommandHandler {
public override Task Handle(Client client, NetworkObject receivedObject) {
return Task.CompletedTask;
}
}
[ExtensionCommandHandler("EN")]
public class EMDZombiesEnterHandler : CommandHandler {
public override Task Handle(Client client, NetworkObject receivedObject) {
return Task.CompletedTask;
}
}
[ExtensionCommandHandler("EX")]
public class EMDZombiesExitHandler : CommandHandler {
public override Task Handle(Client client, NetworkObject receivedObject) {
return Task.CompletedTask;
}
}

View File

@ -14,9 +14,13 @@ class RacingPMHandler : CommandHandler
NetworkObject p = new();
NetworkArray arr = new();
NetworkObject data = new();
data.Add("M", new string[] {
receivedObject.Get<NetworkObject>("p").Get<string>("M")
});
string M = receivedObject.Get<NetworkObject>("p").Get<string>("M");
if (M.StartsWith("WF:") || M.StartsWith("WFWD:")) {
// When firing weapon in EMD, recieving clients expect userid, but the sending client sends its token instead.
string token = M.Split(':')[1];
M = M.Replace(token, client.PlayerData.Uid);
}
data.Add("M", new string[] {M});
data.Add("MID", client.ClientID);
arr.Add(data);
p.Add("arr", arr);
@ -24,6 +28,7 @@ class RacingPMHandler : CommandHandler
cmd.Add("p", p);
NetworkPacket packet = NetworkObject.WrapObject(1, 13, cmd).Serialize();
if (client.Room != null) // Throws an exception in Eat my Dust when the player fires their weapon before fully in the room.
client.Room.Send(packet);
return Task.CompletedTask;
}

View File

@ -57,6 +57,9 @@ public class PlayerData {
"P", // position vector (older games)
"R", // rotation (older games - updated via SUV, not SPV)
"F", // flags (older games - updated via SUV, not SPV)
"UTI", // group/clan
"SPM", // drive mode (Eat My Dust)
"H", // health
};
// other variables (set and updated via SUV command)
@ -91,7 +94,8 @@ public class PlayerData {
public void InitFromNetworkData(NetworkObject suvData) {
// set initial state for SPV data
R = float.Parse(suvData.Get<string>("R"), CultureInfo.InvariantCulture);
string? r = suvData.Get<string>("R"); // in Eat My Dust, rotation is sent in R1, R2, R3
if (r != null) R = float.Parse(r, CultureInfo.InvariantCulture);
string? p1 = suvData.Get<string>("P1");
if (p1 != null) {
P1 = float.Parse(p1, CultureInfo.InvariantCulture);

View File

@ -23,11 +23,13 @@
"// RoomAlerts": "List of MMO rooms with alert function. Default empty (not used by SoD), bellow sample config for WoJS, MB and SS.",
"// alert parameters": "alert type, duration [s], minimum time to start [s], maximum time to start [s], redAlertDuration (used for type '1'), number of songs (used for type '3')",
"// alert types": "1 - Red Alert, 2 - Disco Alert, 3 - Dance Off",
"RoomAlerts": {
"LoungeInt" : [ ["3", 20.0, 30, 240, 0, 16] ],
"Spaceport": [ ["1", 20.0, 300, 300, 60, 0], ["2", 120.0, 1800, 3600, 60, 0] ],
"Academy": [ ["1", 20.0, 300, 300, 60, 0] ],
"ClubSSInt" : [ ["3", 20.0, 30, 240, 0, 16] ],
"JunkYardEMD": [ ["1", 20.0, 240, 300, 60, 0] ],
},
"// RacingMaxPlayers": "maximum players allowed in Thunder Run Racing (no more than 6)",