Merge pull request #461 from EmosewaMC/mailboxSpecialCase

Addressed special case in GameMessage for interacting with a mailbox
This commit is contained in:
Daniel Seiler 2022-02-24 16:10:10 +01:00 committed by GitHub
commit a49f9dc586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 11 deletions

View File

@ -4992,17 +4992,6 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity,
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MISSION_INTERACTION, interactedObject->GetLOT(), interactedObject->GetObjectID());
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_NON_MISSION_INTERACTION, interactedObject->GetLOT(), interactedObject->GetObjectID());
//Do mail stuff:
if (interactedObject->GetLOT() == 3964) {
AMFStringValue* value = new AMFStringValue();
value->SetStringValue("Mail");
AMFArrayValue args;
args.InsertValue("state", value);
GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, "pushGameState", &args);
delete value;
}
}
void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity) {

View File

@ -162,6 +162,7 @@
#include "GrowingFlower.h"
#include "BaseFootRaceManager.h"
#include "PropertyPlatform.h"
#include "MailBoxServer.h"
// Racing Scripts
#include "RaceImagineCrateServer.h"
@ -580,6 +581,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new PropertyPlatform();
else if (scriptName == "scripts\\02_server\\Map\\VE\\L_VE_BRICKSAMPLE_SERVER.lua")
return new VeBricksampleServer();
else if (scriptName == "scripts\\02_server\\Map\\General\\L_MAIL_BOX_SERVER.lua")
script = new MailBoxServer();
//Racing:
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\RACE_IMAGINE_CRATE_SERVER.lua")

View File

@ -0,0 +1,12 @@
#include "MailBoxServer.h"
#include "AMFFormat.h"
#include "GameMessages.h"
void MailBoxServer::OnUse(Entity* self, Entity* user) {
AMFStringValue* value = new AMFStringValue();
value->SetStringValue("Mail");
AMFArrayValue args;
args.InsertValue("state", value);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
delete value;
}

15
dScripts/MailBoxServer.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include "CppScripts.h"
class MailBoxServer : public CppScripts::Script {
public:
/**
* When a mailbox is interacted with, this method updates the player game state
* to be in a mailbox.
*
* @param self The object that owns this script.
* @param user The user that interacted with this Entity.
*/
void OnUse(Entity* self, Entity* user) override;
};