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

55 commits

Author SHA1 Message Date
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
David Cernat
2e8714afaa [Client] Rethink and restructure tes3mp combat code so it works for NPCs 2017-04-19 22:06:04 +03:00
David Cernat
f0f0b2dcc9 [General] Send and read ActorSpeech packets 2017-04-16 18:43:13 +03:00
David Cernat
d2178e5414 [Client] Assign LocalActor movement settings before rotations get reset 2017-04-16 17:09:47 +03:00
David Cernat
1fb11dafef [General] Send and read ActorStatsDynamic packets 2017-04-16 16:42:07 +03:00
David Cernat
2872675f5e [General] Send and read ActorAnimPlay packets 2017-04-15 13:42:30 +03:00
David Cernat
56aeb85965 [Client] Update method names in ActorList 2017-04-15 11:45:20 +03:00
David Cernat
e7960eee76 [General] Rename DrawState packets into AnimFlags ones for clarity 2017-04-14 16:00:34 +03:00
David Cernat
de8d28e2c3 [Client] Improve logic for updating LocalActors & sending their packets 2017-04-13 18:59:22 +03:00
David Cernat
d2fe777f89 [General] Send and read ActorDrawState packets 2017-04-13 15:26:48 +03:00
David Cernat
9852076590 [Client] Send all NPC data to newly arriving players 2017-04-10 18:24:30 +03:00
David Cernat
d14102716d [Client] Retool LocalActors and DedicatedActors for ActorPosition packet 2017-04-10 17:10:18 +03:00