Commit Graph

83 Commits (6d43c8d63df27162e76aed2b16e8da82baf24d0a)

Author SHA1 Message Date
David Cernat 528bd26a3b [General] Allow followers to follow non-authority players through cells 7 years ago
David Cernat 837c5369c0 [Server] Add OnActorAI event and remove autosync for ActorAI packets 7 years ago
David Cernat 7f0549fc4f [Server] Remove hardcoded sync for VideoPlay and add OnVideoPlay event 7 years ago
David Cernat ae8b5a0709 [Server] Remove hardcoded sync for Place, Spawn & other Object packets 7 years ago
David Cernat c075496748 [General] Replace deathReason in death packets with a killer variable
Add serverside script functions for determining the killers of both players and actors.

Use unsigned ints for script functions returning an object or actor's refNumIndex or mpNum.

Remove updateDeadState() from LocalPlayer and make its code part of updateStatsDynamic() for simplicity.
7 years ago
David Cernat 7ffdb18bf9 [General] Implement ActorDeath packet, part 1
ActorDeath packets are sent for dead actors before their StatsDynamic packets. They contain the actor's deathReason in a manner similar to that of PlayerDeath packets.

A future commit will replace the deathReason with a variable named killer which will be an mwmp::Target.
7 years ago
David Cernat c3c7f2c8f9 [Server] Don't automatically synchronize ObjectDelete packets 7 years ago
David Cernat 72862dc255 [General] Turn PlayerMap into WorldMap, now a Worldstate packet 7 years ago
David Cernat 0be6de6607 [General] Turn RecordDynamic into a Worldstate packet 7 years ago
David Cernat 43a944ddaf [General] Add and implement new Worldstate packet type 7 years ago
David Cernat 02d8e08c58 [Server] Rename WorldProcessor into ObjectProcessor 7 years ago
David Cernat 78234f9071 [General] Rename Event into ObjectList & WorldObject into BaseObject 7 years ago
David Cernat 6bf3a0be1e [General] Rename WorldPackets into ObjectPackets for clarity 7 years ago
David Cernat 715012f087 [General] Implement sending of image data for map tiles in PlayerMap 7 years ago
David Cernat 66d5109509 [General] Fix information exchange for players sharing a cell
Previously, two players entering the same cell only sent and received their latest changes for dynamic stats, attributes, skills and equipment when they started sharing that cell.
7 years ago
David Cernat 28f1c1b0d3 [General] Rework CharGen slightly for clarity purposes
Previously, charGenStage.end was doing double duty as both the variable indicating the number of CharGen stages and – when set to 0 – the variable indicating that CharGen was over. The latter role is now filled by a new boolean.

(cherry picked from commit 926106cf8c)
7 years ago
David Cernat 76468dc8c6 [Server] Remove remnant of hardcoded container sync 7 years ago
David Cernat 5f6ddcfc59 [General] Rework container sync to prevent item duping
A main priority in TES3MP development is to avoid making major changes to OpenMW code, so as to avoid merge conflicts in the future. Whenever avoiding potential conflicts seems especially difficult for the proper implementation of a particular multiplayer feature, that multiplayer feature is often put off until later or partially implemented with the intent of being revisited in the future.

Container sync is the perfect example. Previously, the OpenMW code for container actions was kept exactly as it was, with clients unilaterally accepting their own container changes as per singleplayer-specific code, with only the addition that clients sent container packets every time they made a change in a container, packets which were then forwarded unquestioningly by the server to other players. This meant that two players clicking on the same item in a container at the same time both managed to take it, thus duplicating the item.

Immediately after the packets were already forwarded, server scripts were able to check for incorrect changes, such as the removal of more items than should have existed in a container, but they had to send their own packets that attempted to fix what had already been accepted on the initial client and then forwarded to all clients, which was quite onerous in some scenarios, such as when a player on a slow connection immediately dropped items in the world after taking them from a container (which is why the default TES3MP serverside scripts made no attempt at sending corrective packets at all, preferring to expect the matter to be solved in a later C++ implementation).

This commit fixes item duping in containers by preventing container actions from initially running on clients and by ending the automatic forwarding of container packets by the server. Instead, clients now send container packets that act as requests for container actions, and serverside scripts have to forward these requests themselves. In other words, without a matching Container event in the server's Lua scripts, players are completely unable to affect containers for themselves or for others.

To forward a received Container packet, the following line must be used in a Container event in the Lua scripts:

tes3mp.SendContainer(true, true)

When an invalid action count is used in a container request, the serverside scripts can amend it using the following new function:

tes3mp.SetReceivedContainerItemActionCount(objectIndex, itemIndex, actionCount)

Thus, the serverside scripts are able to allow only container actions that are correct based on their own recorded contents for that container.

The OpenMW code allowing unilateral container actions in mwgui/container.cpp is now prevented from executing. When a player's container request is returned to them, code in mwmp/WorldEvent.cpp simulates those container actions instead.
7 years ago
David Cernat 88ae0772cf [Server] Initialize new processors and fix issues with RecordDynamic 7 years ago
David Cernat 02af7f6ba1 [General] Add placeholders for new packet types 7 years ago
David Cernat 50d5fffb7f [General] Add and implement PlayerQuickKeys packet 7 years ago
David Cernat 3aedc2e5bc [Server] Don't automatically share PlayerTopic packets between players 7 years ago
David Cernat ac3254d85f [General] Don't send PlayerAttribute and PlayerSkill packets as werewolf
This will prevent the server from overwriting a player's human form stats with their werewolf form stats.

Additionally, share PlayerShapeshift packets last when exchanging data with another player.
7 years ago
David Cernat cd8d064761 [Server] Add PlayerShapeshift to PlayerCellChange's information exchange 8 years ago
David Cernat 43a3daf0aa [General] Add & implement PlayerShapeshift packet for werewolf states 8 years ago
David Cernat 3529f9b090 [General] Add placeholders for PlayerJail, ObjectState & ConsoleCommand 8 years ago
David Cernat 4e74910fdb [General] Disable automatic sync for PlayerJournal and PlayerFaction
Simplify PlayerFaction packets by removing BOTH action
8 years ago
Koncord 768790e9b4 [Server] Move Base processors and Initializer to processors subdirectory 8 years ago
David Cernat 71313c5aa6 [General] Implement PlayerMap packet, part 1 8 years ago
Koncord fcccd7b665 [General] Remove creatureStats.mDead from packets 8 years ago
David Cernat 813a3c89c4 [General] Implement PlayerBook packet to track skill books read 8 years ago
David Cernat b3b73c5cd2 [General] Implement resurrection at nearest shrine or temple 8 years ago
David Cernat 70d9374a6a [General] Implement PlayerKillCount packets 8 years ago
David Cernat 5b23da8e1c [General] Rename unused PlayerRegionChange packet into PlayerKillCount 8 years ago
David Cernat 27148ce9eb [General] Add placeholders for 12 new packets, to be implemented soon
Additionally, make it slightly clearer who created which previously existing packets.
8 years ago
David Cernat f47a10dd4a [Server] Add script callback and getter functions for ActorEquipment 8 years ago
David Cernat 08de349133 [General] Add placeholders for PlayerTopic & ObjectTrap packets 8 years ago
David Cernat 870fd9a78b [General] Remove ObjectUnlock packet, use ObjectLock with 0 lock instead 8 years ago
David Cernat e6983993c2 [General] Implement sending and reading of PlayerFaction packets 8 years ago
David Cernat 04c9c5ed48 [General] Forward PlayerJournal packets to other players 8 years ago
David Cernat 90c594b726 [Server] Make names for Player script callbacks shorter 8 years ago
David Cernat ad388c7e12 [General] Add placeholders for ActorEquipment & PlayerFaction packets
Also reorder packets and packet processors.
8 years ago
David Cernat 3c30801eac [Server] Try to fix server crash from iterations through invalid players 8 years ago
David Cernat 9d2c5c3502 [General] Simplify structure of BaseEvent 8 years ago
David Cernat 4d81455020 [General] Rework and simplify death reasons so they work with NPCs 8 years ago
David Cernat 06f3c07116 [Server] Only read Actor packets from players who are still authorities 8 years ago
David Cernat 63dd2d9246 [General] Remove code related to ActorAuthority packets that is not used 8 years ago
David Cernat 83ba4b62b1 [Server] Remove Actors from a Cell's ActorList when they change cells 8 years ago
David Cernat fafed96bf4 [Server] Store data from ActorPosition in the ActorLists of Cells 8 years ago
Koncord 1ce8c0f9ec [Server] Fix id in log message for ID_PLAYER_CELL_STATE processor 8 years ago