1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 22:19:54 +00:00
Commit graph

215 commits

Author SHA1 Message Date
David Cernat
36ac2d9de4 [Client] Set packetOrigin for all ObjectList packets sent 2018-07-23 01:39:43 +03:00
David Cernat
2189ea1a63 [Client] Clean up sending of Container packets 2018-07-22 16:43:27 +03:00
David Cernat
09da24f1ea [General] Rename all instances of refNumIndex into refNum
This creates symmetry with mpNum and should cause less confusion in the future.
2018-07-13 04:12:03 +03:00
David Cernat
c2411982d2 [Client] Log object refNumIndexes and mpNums in a consistent way 2018-07-04 21:54:11 +03:00
David Cernat
b81ca18316 [Client] Don't clear container Ptrs when disposing of corpses
The reason for this is that only the server should be determine whether a corpse can be disposed of or not.
2018-06-28 01:45:15 +03:00
David Cernat
fd05beef94 [Client] Don't delete disposed of corpses on client
Clients should instead await a server reply approving the deletion.
2018-06-20 02:01:19 +03:00
David Cernat
78234f9071 [General] Rename Event into ObjectList & WorldObject into BaseObject 2018-05-13 00:42:24 +03:00
David Cernat
6bf3a0be1e [General] Rename WorldPackets into ObjectPackets for clarity 2018-05-12 19:40:00 +03:00
David Cernat
d8b48f6cf4 [Client] Remove redundant container methods from CellController 2018-04-01 07:11:43 +03:00
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.
2018-03-26 19:27:36 +03:00
David Cernat
f746958afa [Client] Send enchantmentCharge for items added or removed in containers 2018-01-17 08:10:49 +02:00
David Cernat
07f0cc2b0e
Merge pull request #353 from OpenMW/master
Add OpenMW commits up to 4 Dec 2017
2017-12-04 04:38:38 +02:00
Andrei Kortunov
8decd35607 Fixes crash on quickload from the container menu (bug #4239) 2017-12-03 21:49:13 +04:00
David Cernat
2ba1c84cf7 Merge pull request #335 from OpenMW/master while resolving conflicts
# Conflicts:
#	apps/openmw/mwgui/container.cpp
2017-11-12 06:35:15 +02:00
Andrei Kortunov
03f129b53c remove redundant allowedToInsertItems() function from ItemModel 2017-11-11 11:58:22 +04:00
Andrei Kortunov
3694b6ec90 Move onClose() check to item models 2017-11-10 10:58:43 +04:00
Andrei Kortunov
ac33ff9482 Move onDropItem() check to item models 2017-11-10 10:58:43 +04:00
Andrei Kortunov
3604b73d60 Move onTakeItem() to item models 2017-11-10 10:58:40 +04:00
David Cernat
711c4d83da [Client] Fix build after recent OpenMW changes to GUI 2017-10-07 23:33:36 +03:00
David Cernat
38247ff086 Merge pull request #303 from OpenMW/master while resolving conflicts
# Conflicts:
#	apps/openmw/mwbase/dialoguemanager.hpp
#	apps/openmw/mwdialogue/dialoguemanagerimp.hpp
#	apps/openmw/mwgui/container.cpp
#	apps/openmw/mwgui/windowmanagerimp.cpp
#	apps/openmw/mwscript/dialogueextensions.cpp
2017-10-06 04:10:04 +03:00
Andrei Kortunov
1cb7ed5db1 Use owned tooltips for items in containers correctly 2017-10-04 12:13:45 +04:00
Andrei Kortunov
04452b0949 Use a pickpocket crime instead of theft when pickpocketing was failed 2017-09-30 20:11:53 +04:00
scrawl
64e27c032b Merge pull request #1481 from scrawl/keyfocus
WindowManager overhaul & improved keyboard support
2017-09-28 22:34:05 +00:00
scrawl
d58ff4a736 Remove obsolete Container GUI keyboard handling 2017-09-24 19:08:16 +02:00
scrawl
4fff2e2e34 Refactor exitCurrentGuiMode 2017-09-24 19:08:13 +02:00
scrawl
84657271c7 Improve WindowManager API with a generic way of passing a Ptr to the opened GUI window 2017-09-24 19:08:12 +02:00
scrawl
01391b7eed Rename WindowBase's open/close to onOpen/onClose 2017-09-24 19:08:12 +02:00
David Cernat
73e7aa838d Merge pull request #296 from OpenMW/master while resolving conflicts
# Conflicts:
#	apps/openmw/mwgui/container.cpp
2017-09-22 19:12:41 +03:00
Andrei Kortunov
4580024d76 Unequip all items from dead corpse when take all items (bug #4095) 2017-09-22 12:32:47 +04:00
David Cernat
e3929df38a Merge pull request #239 from OpenMW/master
Add OpenMW commits up to 14 Jul 2017
2017-07-15 09:13:04 +03:00
Andrei Kortunov
54b4d93f79 Added a special function for GUI sounds playing 2017-07-10 15:48:00 +04:00
David Cernat
5bd95628ce [Client] Send an ObjectDelete packet when disposing of corpses 2017-05-08 08:44:43 +03:00
David Cernat
9d2c5c3502 [General] Simplify structure of BaseEvent 2017-05-06 21:57:29 +03:00
David Cernat
a82646a130 [Client] Delineate tes3mp-only code more clearly, part 2 2017-04-24 19:46:12 +03:00
David Cernat
679e790d8d [Client] Rename WorldController into CellController to avoid confusion with Networking's WorldPacketController 2017-04-05 12:00:21 +03:00
David Cernat
9759764699 [Client] Clean up getting and resetting of WorldEvent 2017-04-05 09:04:41 +03:00
David Cernat
2bd81c3de0 [Client] Use mpNum for every WorldObject 2017-04-04 11:07:16 +03:00
Koncord
690211ad99 [General] Extract BaseEvent & BasePlayer from packets to functions
Move Send and Read functions to BasePacket
2017-03-06 18:40:07 +08:00
Koncord
cea1425db1 [Client] Remove redundant newlines & keep ~120 columns 2017-03-04 14:55:35 +08:00
David Cernat
a58601fb2b [Client] Delineate tes3mp-only code more clearly, part 1 2017-02-26 16:59:53 +02:00
David Cernat
ed2176c984 [Client] Reuse 1 BaseEvent over and over instead of creating new ones 2017-02-23 09:19:09 +02:00
David Cernat
a4526605a6 [General] Remove goldValue from ContainerItem because it is never useful 2017-02-20 12:31:11 +02:00
David Cernat
4f2b88df8a [General] Remove owner var from ContainerItem because it is always empty 2017-02-18 23:59:02 +02:00
David Cernat
3b604a432e [General] Restructure ID_CONTAINER to allow multiple containers at once 2017-02-15 20:14:25 +02:00
David Cernat
f02840d638 [Client] Fix log messages when sending ID_CONTAINER 2017-02-09 21:48:22 +02:00
David Cernat
e52823394c [Client] Use correct count for ID_CONTAINER when dropping items 2017-02-06 22:53:18 +02:00
David Cernat
d8a9a5f6c9 [General] Send item owner in ID_CONTAINER 2017-02-06 22:45:23 +02:00
David Cernat
3614b21e10 [General] Send charge and goldValue in ID_CONTAINER 2017-02-06 21:28:03 +02:00
David Cernat
e703dd42aa [Client] Rename LocalEvent into WorldEvent 2017-02-06 17:40:32 +02:00
David Cernat
1f03c12d96 [Client] See when other players use the Take All button with a container 2017-02-05 20:04:50 +02:00