Page MenuHomeFeedback Tracker

change the functions OnInputForRemote and OnInputFromServer
Assigned, UrgentPublic

Description

// please change the structure of the functions
void OnInputForRemote (ParamsReadContext ctx) { }
void OnInputFromServer (ParamsReadContext ctx) { }

// this is how it is now

		void OnInputForRemote (ParamsReadContext ctx)
		{
		int userDataType = 0;
		if (!ctx.Read(userDataType))
		{
			Error("DayZPlayer: OnInputForRemote - cannot read input type");
			return;
		}

		switch (userDataType)
		{
			case INPUT_UDT_WEAPON_REMOTE_EVENT:
				GetDayZPlayerInventory().OnEventForRemoteWeapon(ctx);
				break;
			case INPUT_UDT_HAND_REMOTE_EVENT:
				GetDayZPlayerInventory().OnHandEventForRemote(ctx);
				break;
			case INPUT_UDT_INVENTORY:
				GetDayZPlayerInventory().OnInputUserDataForRemote(ctx);
				break;
			default:
				Error("OnInputForRemote - unknown userDataType=" + userDataType);
				break;
		}
		
		}
		
	    void OnInputFromServer (ParamsReadContext ctx)
	    {
		int userDataType = 0;
		if (!ctx.Read(userDataType))
		{
			Error("DayZPlayer: OnInputFromServer - cannot read input type");
			return;
		}

		switch (userDataType)
		{
			case INPUT_UDT_INVENTORY:
				GetDayZPlayerInventory().OnServerInventoryCommand(ctx);
				break;
			default:
				Error("OnInputFromServer - unknown userDataType=" + userDataType);
				break;
		}
	    }

//but for mass moding you need
void OnActionInputForRemote(int userDataType,ParamsReadContext ctx)
{

		switch (userDataType)
		{
			case INPUT_UDT_WEAPON_REMOTE_EVENT:
				GetDayZPlayerInventory().OnEventForRemoteWeapon(ctx);
				break;
			case INPUT_UDT_HAND_REMOTE_EVENT:
				GetDayZPlayerInventory().OnHandEventForRemote(ctx);
				break;
			case INPUT_UDT_INVENTORY:
				GetDayZPlayerInventory().OnInputUserDataForRemote(ctx);
				break;
			default:
				Error("OnInputForRemote - unknown userDataType=" + userDataType);
				break;
		}

}
override void OnInputForRemote (ParamsReadContext ctx)
{

		int userDataType = 0;
		if (!ctx.Read(userDataType))
		{
			Print("DayZPlayer: OnInputForRemote - cannot read input type");
			return;
		}
		OnActionInputForRemote(userDataType,ctx);

}

void OnActionFromServer(int userDataType,ParamsReadContext ctx)
{
switch (userDataType)

		{
			case INPUT_UDT_INVENTORY:
				GetDayZPlayerInventory().OnServerInventoryCommand(ctx);
				break;
			default:
				Error("OnInputFromServer - unknown userDataType=" + userDataType);
				break;
		}

}
override void OnInputFromServer (ParamsReadContext ctx)
{

		int userDataType = 0;
		if (!ctx.Read(userDataType))
		{
			Print("DayZPlayer: OnInputFromServer - cannot read input type");
			return;
		}
		OnActionFromServer(userDataType,ctx);

}

This solution can be implemented by a mod, but if someone else reassigns the OnInputForRemote or OnInputFromServer function, without super, then my function call will abort.

what we need, you have already implemented in the DayZPlayerImplement class
in function
void OnInputUserDataReceived (ParamsReadContext ctx)
which calls
bool OnInputUserDataProcess (int userDataType, ParamsReadContext ctx)

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
General

Event Timeline

komer created this task.Nov 9 2020, 6:22 AM
Geez changed the task status from New to Assigned.Nov 9 2020, 11:35 AM