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

66 commits

Author SHA1 Message Date
David Cernat
7f017217c7 [Client] Fix position sync for falling actors 2021-10-15 17:11:03 +02:00
David Cernat
7393e3def6 [General] Add and use getShortDescription() for ESM::Cell
ESM::Cell's getDescription() method was modified by aa5161f99e despite being used heavily by TES3MP. All instances of it in the TES3MP code have now been changed into the newly added getShortDescription() that is identical to the previous getDescription().
2021-09-17 19:14:55 +02:00
David Cernat
3f3fe66fde [General] Track casters of spells in SpellsActive packets
Also simplify sending of SpellsActive packets slightly.
2021-07-21 18:14:31 +02:00
David Cernat
294f64d12d [General] Track timestamps for spells in SpellsActive packets
This makes it possible to remove a specific effect in effect stacks by checking its timestamp.
2021-07-04 12:54:11 +02:00
David Cernat
767287ae51 [General] Track stacking spells in SpellsActive packets 2021-06-10 13:27:52 +02:00
David Cernat
bf0a42fdad [General] Implement ActorSpellsActive packet, part 1
The packet can now set the active spells of DedicatedActors.
2021-04-20 03:25:14 +02:00
David Cernat
b3c40913f6 [Client] Remove 'using namespace std' from multiplayer-related code
This brings TES3MP in line with https://gitlab.com/OpenMW/openmw/-/merge_requests/664
2021-03-20 23:21:40 +02:00
David Cernat
4b27f8986b [Client] Synchronize positions for actors during death animations
This needs some improvements, because:

1) Sometimes the cell authority sends the death animation too late and a different one gets played on the other clients
2) There is probably a simpler check that can be done for position changes during a death animation.
2019-12-06 21:04:42 +02:00
David Cernat
1950748dae [Client] Always use autoEquip on newly initialized LocalActors
Previously, it was possible for a Container packet to clear all equipment slots for an actor without the actor's authority then sending an equipment packet to correct that, due to packet loss or sudden disconnection, leading to actors not wearing any equipment as soon as they acquired a new authority.

This ensures that newly initialized LocalActors will now autoEquip.
2019-12-06 12:21:30 +02:00
David Cernat
cd444f8707 [Client] Send actor equipment after Container packet causes autoEquip
Previously, a Container packet with a SET action for an actor would clear their entire InventoryStore, also clearing all of their equipment slots. The actor's authority would then autoEquip new equipment for the actor, but that new equipment would not actually get sent to the other players. As a result, they would see the actor fighting with hand-to-hand attacks, while also not actually wearing anything despite being rendered as wearing the same clothes and armor as before.

This commit makes the actor's authority resend the actor's equipment as soon as the Container packet has caused the autoEquip to happen.
2019-12-06 11:40:07 +02:00
David Cernat
a383b7b612 [General] Include death animations in ActorDeath packets 2019-12-05 13:27:55 +02:00
David Cernat
190c404b38 [Client] Calculate spell success in more appropriate place
Previously, creatures with fast spellcasting animations would cast their spells before their success had actually been calculated, causing them to fail.
2019-09-02 23:50:56 +03:00
David Cernat
9350e1d484 [General] Split up Attack packets into Attack and Cast ones
Create an entirely new PlayerCast packet for that purpose, but rename the already existing but unused ActorInteraction into ActorCast.
2019-08-25 09:35:23 +03:00
David Cernat
0339958e21 [General] Rename Log class into TimedLog 2019-08-19 21:39:33 +03:00
David Cernat
dcbc9d1831 [Client] Print cells for actor deaths 2019-02-21 21:51:02 +02:00
David Cernat
433a69a588 [Client] Send all data for newly initialized LocalActors at least once 2018-12-31 04:36:59 +02:00
David Cernat
b69e6b96e6 [Client] Use verbose logging level for LocalActor debug 2018-07-23 22:11:59 +03:00
David Cernat
5466092582 [Client] Reduce log level for actor cell changes 2018-07-21 14:41:48 +03:00
David Cernat
528bd26a3b [General] Allow followers to follow non-authority players through cells 2018-07-13 21:27:29 +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
17c234d9ca [Client] Use initial values for LocalPlayer and LocalActor killers 2018-07-06 02:07:55 +03:00
David Cernat
97cd3effa7 [Client] Make actor debug consistent with object debug 2018-07-06 00:32:45 +03:00
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.
2018-07-05 22:24:51 +03:00
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.
2018-06-27 21:47:55 +03:00
David Cernat
b9520c11da [General] Rework PlayerEquipment packets so they are of minimal size
Moreover, rename BaseNetCreature's equipedItems into equipmentItems.

(cherry picked from commit d1ad0c91f8)
2018-04-20 22:46:16 +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
20caea083a [Client] Use correct count for items in equipment packets
Previously, throwing weapon sync was completely broken for players, as the count for their equipped throwing weapons was never set and – as a result – defaulted to a count of 1 on other clients. As a result, any time a player threw a dart, they would then appear as having switched to hand-to-hand for other players.

Moreover, the count of equipped items was mistakenly based on the total count of items with that refId in the inventory. As a result, if – for example – I equipped 1 Daedric Longsword and had 4 others in my inventory, my DedicatedPlayer on other clients would equip a Daedric Longsword with a count of 5. If I was overencumbered by having that many Daedric Longswords on me and then dropped 4 of them, allowing myself to move again, my DedicatedPlayer would still walk around with 5 Daedric Longswords and lack animations due to still being overencumbered on the other clients.

These problems were less prevalent for actors, but their equipment updating code has also been changed to match that of players.
2018-03-12 23:31:37 +02:00
David Cernat
77ce05b7d6 [Client] Fix spell casting probability synchronization 2017-08-06 00:11:54 +03:00
David Cernat
4db64e1721 [Client] Synchronize spellcasting for non-bipedal creatures 2017-07-28 20:49:26 +03:00
David Cernat
796118c266 [Client] Send StatsDynamic packets more often 2017-07-26 20:15:35 +03:00
Koncord
9519c467eb [Client] Simplify updateEquipment for LocalPlayer & LocalActor 2017-06-29 14:52:23 +08:00
Koncord
596f42e408 [Client] Fix "invalid iterator" error 2017-06-29 14:36:56 +08:00
Koncord
aa12b35d03 [Client] Update LocalActor to C++11 2017-06-27 21:12:00 +08:00
Koncord
6222c20e82 [Client] Convert MechanicsHelper to namespace 2017-06-27 16:43:53 +08:00
David Cernat
312fc84a6f [Client] Use update timer in mwmp::Cell instead of LocalActor 2017-06-10 03:29:51 +03:00
David Cernat
ea2a060c67 [Client] Sync actor movements from interiors to exteriors & vice versa 2017-05-28 01:11:32 +03:00
David Cernat
311ce4119d [General] Fix logic issues related to ActorEquipment 2017-05-26 22:53:28 +03:00
David Cernat
4f273932af [General] Implement sending and reading of ActorEquipment packets 2017-05-26 04:37:49 +03:00
David Cernat
5a786e6c56 [Client] Make all LocalActors get initialized correctly again 2017-05-09 14:19:25 +03:00
David Cernat
d7d4dec200 [Client] Don't spam AnimFlags packets when a Player or Actor is flying 2017-05-09 12:27:59 +03:00
David Cernat
cc559cf8e2 [General] Don't send packets for dead LocalActors, to fix Position spam 2017-05-09 02:47:29 +03:00
David Cernat
3def111ca1 [Client] Fix graphical glitches related to DedicatedActor initialization 2017-05-06 04:49:49 +03:00
David Cernat
ef12a37d59 [Client] Send ActorPosition packets based on a timeout 2017-05-06 00:33:48 +03:00
David Cernat
db3859565b [Client] Send ActorStatsDynamic packets only when stats change enough 2017-05-05 23:17:15 +03:00
David Cernat
e05adbfe65 [Client] Add better debug for Actor cell changes 2017-05-05 04:46:40 +03:00
David Cernat
e8e0090b9b [General] Use new SimpleCreatureStats struct in BaseActor 2017-04-30 18:44:59 +03:00
David Cernat
ea7c3f2dc7 [Client] Make tes3mp combat code work with Creatures, not just NPCs 2017-04-24 21:06:23 +03:00
David Cernat
841e6a63f8 [Client] Initialize Creatures as LocalActors 2017-04-24 11:58:39 +03:00
David Cernat
1f6ba9d9ee [Client] Remove jump check from LocalActor that is irrelevant for NPCs 2017-04-24 10:58:39 +03:00
David Cernat
871d8c8308 [Client] Send and read ActorCellChange packets 2017-04-23 14:01:13 +03:00