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

760 commits

Author SHA1 Message Date
David Cernat
deda6ec071 [Client] Don't send WorldMap packets for already explored map tiles 2018-06-25 02:34:11 +03:00
David Cernat
7e90d1f2a4 [Client] Fix interior-to-exterior and v.v. cell transitions for actors
Make sure only players who are cell authorities can get actors to teleport across cells for them, and display a message box for players who are not cell authorities.
2018-06-21 16:44:49 +03:00
David Cernat
aa3639f2da
Merge pull request #450 from TES3MP/0.6.2
Add 0.6.2 commits up to 19 Jun 2018
2018-06-19 05:26:38 +03:00
David Cernat
5b461b09ca [Client] Display error when receiving ID_INCOMPATIBLE_PROTOCOL_VERSION 2018-06-19 05:24:26 +03:00
David Cernat
29be79e852 [General] Switch RakNet enums to CrabNet enums
CrabNet is TES3MP's fork of RakNet that has deviated too far from RakNet to still be compatible with it.
2018-06-19 00:37:52 +03:00
David Cernat
72862dc255 [General] Turn PlayerMap into WorldMap, now a Worldstate packet 2018-06-07 12:51:45 +03:00
David Cernat
0d0c4ac235 [Client] Use REPLY_TO_REQUEST container sub-action for partial requests 2018-06-05 19:40:39 +03:00
David Cernat
83014d6381 [Client] Set actors as the owners of their items when editing containers 2018-06-05 14:55:57 +03:00
David Cernat
494edbe5cb [General] Add REPLY_TO_REQUEST container sub-action 2018-06-05 14:16:27 +03:00
David Cernat
8ea9485e6b [Client] Make container debug information more useful 2018-06-05 12:01:16 +03:00
David Cernat
3efe05a88e [General] Implement WorldCollisionOverride packet 2018-05-27 16:05:40 +03:00
David Cernat
e8ec031a81 [Client] Create Worldstate class that inherits BaseWorldstate 2018-05-27 15:57:47 +03:00
David Cernat
f7a084c824 [Client] Use faster check for whether actors are DedicatedPlayers 2018-05-26 08:13:26 +03:00
David Cernat
416ee77639 [General] Add placeholder for WorldCollisionOverride packet 2018-05-25 07:09:32 +03:00
David Cernat
2edb511a0b [Client] Remove unnecessary condition from WorldTime processor 2018-05-25 07:08:51 +03:00
David Cernat
3b5fb9cd6b [General] Make it possible to set year via WorldTime 2018-05-25 03:33:12 +03:00
David Cernat
4acf93b7db [General] Make it possible to set days passed via WorldTime 2018-05-24 14:02:04 +03:00
David Cernat
46744ee90f [General] Make WorldTime script functions more consistent with others 2018-05-24 09:38:06 +03:00
David Cernat
8d36d0d945 [General] Make it possible to change world's time scale via WorldTime 2018-05-23 08:31:25 +03:00
David Cernat
0be6de6607 [General] Turn RecordDynamic into a Worldstate packet 2018-05-23 07:48:28 +03:00
David Cernat
da66face25 [General] Rename GameTime packet into WorldTime 2018-05-23 00:41:29 +03:00
David Cernat
5af1150ab2 [General] Turn GameTime into a Worldstate packet 2018-05-21 07:14:08 +03:00
David Cernat
e87e1dbb30 [General] Fix Worldstate packets by adding missing lines 2018-05-21 07:12:55 +03:00
David Cernat
43a944ddaf [General] Add and implement new Worldstate packet type 2018-05-18 06:40:28 +03:00
David Cernat
049d0d9ba7 [General] Fix remaining references to world packets/events 2018-05-17 00:08:37 +03:00
David Cernat
51698bed48 [Client] Rename WorldProcessor into ObjectProcessor 2018-05-15 22:56:47 +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
77389538e8 [General] Implement ActorAI packet, part 1
The server can now make actors become followers of players or other actors.
2018-05-12 06:29:11 +03:00
David Cernat
7f00005f04 [Client] Fix GCC build
Based on 71040659ac
2018-05-10 07:16:33 +03:00
David Cernat
715012f087 [General] Implement sending of image data for map tiles in PlayerMap 2018-05-08 05:57:04 +03:00
David Cernat
df0f9b0f5e [Client] Require a certain Skill progress amount before sending packet 2018-05-01 19:34:21 +03:00
David Cernat
1b1e5e86d1 [Client] Avoid sending CellStates to server after initialization
Although b4e8560698 made players instantly able to see each other on minimalist servers that did not change their cells from the default, it created problems with the default CoreScripts where players need to be logged in before receipt of a CellStates packet from them is taken into account, with the result being that a player was recorded as having loaded their initial cells on the server's C++ side but not on the Lua side.

It may simply be best to expect servers to set player cells.
2018-05-01 18:19:52 +03:00
David Cernat
099f85be0a [General] Implement PlayerMomentum packet & associated script functions 2018-04-29 23:47:17 +03:00
David Cernat
4b501a39f4 [General] Implement DoorDestination packet & associated script functions 2018-04-29 22:32:22 +03:00
David Cernat
3b07dc4b42 [Client] Send equipment packets whenever an item charge or count changes
Since the beginnings of TES3MP, equipment packets have only been sent whenever an item has been replaced by an item with a different refId, with changes in an item's charge or count not sending a packet (but being included in the next packet sent as a result of a refId change). The reason for this was ostensibly the fact that every single equipment packet always included the details for all 19 equipment items (as per Koncord's original design decision), which would have led to massive packet spam if such a packet was sent every time you shot an arrow or lost a little bit of your armor's condition.

With minimalist equipment packets, it is now viable to send equipment packets whenever any item changes in some way, by having the equipment packet contain only that one item.
2018-04-29 05:40:42 +03:00
David Cernat
399e049d87 [Client] Fix logic for minimal size packets in LocalPlayer
Previously, the index changes were not cleared at the start of their corresponding update functions, which in turn meant that an Attribute/Skill/StatsDynamic/Equipment packet received by a player from the server made that player send back the same packet, as the index changes from it were retained.

Additionally, exchangeFullInfo was not set to false, thus sometimes leading to constant full exchanges of information.
2018-04-27 03:45:17 +03:00
David Cernat
608dcbafe6 [Client] Fix skill updates for LocalPlayer partially broken by 78441c769a 2018-04-22 11:22:36 +03:00
David Cernat
a541d7df3c [General] Rework PlayerStatsDynamic packets so they are of minimal size
(cherry picked from commit fc5e883160)
2018-04-21 00:43:49 +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
c5b08d6109 [General] Simplify storing of attribute and skill index changes
(cherry picked from commit bd9e8bd10f)
2018-04-19 23:28:03 +03:00
David Cernat
2c77d5f498 [General] Set enforcedLogLevel to -1 when initializing BasePlayer 2018-04-19 20:42:27 +03:00
David Cernat
b6099024df [General] Rework PlayerAttribute packets so they are of minimal size
Previously, whenever a single attribute value changed for a player, that player then sent a PlayerAttribute packet with all values for all 8 attributes.

This did not cause anywhere as much packet spam as PlayerSkill used to, but there was no good reason not to fix it as well.

(cherry picked from commit b0965f094a)
2018-04-19 17:26:20 +03:00
David Cernat
78441c769a [General] Rework PlayerSkill packets so they are of minimal size
Previously, whenever a single skill value changed for a player, that player then sent a PlayerSkill packet with all values for all 27 skills, plus the player's progress towards the next level and the bonuses to each attribute on the next level up as the result of sklll increases thus far.

This commit makes PlayerSkill contain only the values of specific skills, moves the player's progress towards the next level to PlayerLevel packets, and moves the bonuses to each attribute on the next level up to PlayerAttribute packets.

Players now also send a PlayerSkill packet whenever their progress towards a new point in a skill changes. This was previously avoided so as to not have massive packet spam.

(cherry picked from commit ef79a98544)
2018-04-19 15:18:38 +03:00
David Cernat
af4fcb7261 [Client] Don't force skill update on cell change
Previously, an attempt by the server to simultaneously change a player's cell and skills (as you'd expect when a player file is loaded) led to:

1) The server sending the cell packet first and the skill packet afterwards

2) The player receiving the cell packet and sending their own skill packet as part of the client's forced skill update

3) The player receiving the skill packet from the server

4) The server receiving the skill packet from the player

The result was that, if the player then left the server without sending another skill packet, the server's memory retained the skills the player had sent instead of the skills it had sent to the player.

This is the first step in a solution to that situation and similar ones.

(cherry picked from commit cac4684986)

Note: In 0.6.x, this was only a problem if a player's cell was set by the server first and their skills were set next, i.e. this was not a problem in the default CoreScripts because the opposite order used there masked the problem. It was a more significant problem in 0.7 because all packets were queued for a player and sent in a specific hardcoded order.
2018-04-19 14:22:14 +03:00
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)
2018-04-19 13:25:29 +03:00
David Cernat
9d46de88e0 [Client] Send cell states correctly after inputting name
Previously, initial cell states were sent in LocalPlayer::processCharGen() and were ignored by the server because the player was not yet regarded as loaded. The result was that existing players logging in could not see each other until they went through at least one cell change.

(cherry picked from commit b4e8560698)

# Conflicts:
#	apps/openmw/mwmp/LocalPlayer.cpp
2018-04-18 20:30:48 +03:00
David Cernat
50fe54af5d [Client] Update DedicatedPlayer creature if displayCreatureName changes 2018-04-17 15:23:10 +03:00
David Cernat
a01fc577f1 [Client] Add setAttributes() and setSkills() methods to DedicatedPlayer 2018-04-13 16:59:48 +03:00
David Cernat
716809f2db [Client] Prevent errors from NPC-only packets for DedicatedPlayers 2018-04-13 16:23:42 +03:00
David Cernat
68ee64902d [Client] Track & use previous race & creatureRefId for DedicatedPlayers 2018-04-13 16:16:43 +03:00
David Cernat
acb1335d78 [Client] Make creature disguises update correctly 2018-04-13 11:30:38 +03:00
David Cernat
70f9cb535e [General] Use RecordHelper methods to create and update DedicatedPlayers 2018-04-13 08:37:06 +03:00
David Cernat
9d27f5f154 [Client] Create RecordHelper class with initial NPC and creature methods 2018-04-12 14:18:19 +03:00
David Cernat
9697595857 [Client] Don't equip already equipped items in local setEquipment()
This avoids the following error when receiving repeated PlayerBaseInfo packets: "Error in frame: Invalid slot, make sure you are not calling RefData::setCount for a container object"

Additionally, only re-equip items as the result of a PlayerBaseInfo packet if resetStats is true (because of its side effect of auto-equipping items for the player).
2018-04-10 19:02:55 +03:00
David Cernat
72463cfdb6 [Client] Refresh equipment for DedicatedPlayers when setting base info
Additionally, move default fatigue value to DedicatedPlayer initialization.
2018-04-10 19:02:55 +03:00
David Cernat
73dea494c4 [General] Allow changes from PlayerBaseInfo without player stat reset 2018-04-09 19:21:19 +03:00
David Cernat
c132dc70d2 [Client] Make PlayerShapeshift turn DedicatedPlayers into creatures 2018-04-09 15:23:05 +03:00
David Cernat
141eb8b7c2 [Client] Streamline creation of references for DedicatedPlayers
Additionally, delete DedicatedPlayers who disconnect.

Previously, all disconnected DedicatedPlayers were still kept in memory, but never used again. There was code that suggested they were meant to be reused upon reconnecting, but that reuse had never actually been implemented, and would probably not be that useful anyway.
2018-04-08 15:02:43 +03:00
David Cernat
14f90e773d [Client] Split up creation of DedicatedPlayers into multiple methods
Additionally, print player guids using their string representations for consistency.

The creation and updating of DedicatedPlayer references remains very inelegant, but this commit is the first step towards fixing that.
2018-04-08 10:56:33 +03:00
David Cernat
c8abd11f5d [General] Move creature disguises for players to PlayerShapeshift packet
Additionally, make associated variables clearer, and move associated server script functions next to other shapeshifting functions.
2018-04-05 15:42:06 +03:00
David Cernat
34be9383e5 [General] Add isPlayer boolean to targets in packets 2018-04-05 12:48:53 +03:00
David Cernat
0eed05610b [Client] Fix autoequipping for creatures in WorldEvent::editContainers() 2018-04-03 15:22:51 +03:00
David Cernat
a86c68c5a1 [General] Add sync for ranged weapon & projectile strike enchantments 2018-04-03 14:12:27 +03:00
David Cernat
3f8d94b030 [General] Synchronize strike enchantments in combat 2018-04-03 10:27:02 +03:00
David Cernat
26a56d6a02 [Client] Include NPC/creature containers when adding all cell containers 2018-04-01 14:58:04 +03:00
David Cernat
1e3c4fd488 [Client] Fix ProcessorContainer typos caused by careless copy-pasting 2018-04-01 10:47:57 +03:00
David Cernat
f80f3bd484 [Client] Make it possible to reply to requests about specific containers
Previously, a Container packet with a REQUEST action always made the client respond with the contents of all the containers in that cell.

The previous behavior now only happens for requests that have no WorldObjects attached, while requests that have WorldObjects attached get a reply with the contents of those specific containers.
2018-04-01 10:00:39 +03:00
David Cernat
258e319acb [Client] Require InventoryStore for autoequipping actors 2018-04-01 09:02:26 +03:00
David Cernat
afe8c97cb9 [Client] Require InventoryStore for unequipping actors in editContainers 2018-04-01 08:41:57 +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
9165b12d78 [Client] Update inventory views when receiving inventory or equipment 2018-03-26 10:01:26 +03:00
David Cernat
bbdc30628b [Client] Use the correct guid for a received WorldEvent or ActorList 2018-03-21 06:08:04 +02:00
David Cernat
14f0299322 [Client] Don't log InputBox inputs for client 2018-03-20 06:41:04 +02: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
b249162ca1 [General] Implement setting of enforced client log level in GameSettings
Certain servers do not want the players to have debug information about the locations and actions of other players, so a client's log level can now be enforced by the server via the GameSettings packet.
2018-03-11 04:50:59 +02:00
David Cernat
a3a341fee6 [Server] Reimplement 4ebfcc4a21 for 0.6 2018-03-10 22:19:44 +02:00
David Cernat
03266d7648 [Client] Prevent guards from arresting players who are currently jailed 2018-02-25 21:33:04 +02:00
David Cernat
60f686ee43 [General] Implement setting of physics framerate as part of GameSettings 2018-02-14 05:53:44 +02:00
David Cernat
886b3431bc [Client] When resurrecting players, set pcknownwerewolf to 0
This makes it so players are no longer known werewolves and are no longer attacked infinitely by guards.
2018-02-13 21:55:10 +02:00
David Cernat
74765b3ace [General] Implement selected spell sync as part of PlayerMiscellaneous 2018-02-06 06:36:46 +02:00
David Cernat
029dfc56ba [General] Implement player scale as part of PlayerShapeshift 2018-02-01 02:11:45 +02:00
David Cernat
aa448523f8 [Client] Clean up WorldEvent::runConsoleCommands() slightly 2018-01-31 23:23:52 +02:00
David Cernat
ce5670e57e [Client] Ignore invalid object refIds from ObjectPlace packets 2018-01-31 18:51:53 +02:00
David Cernat
66078bfea7 [General] Implement Mark location sync as part of PlayerMiscellaneous 2018-01-31 04:50:29 +02:00
David Cernat
989f6e6b51 [General] Implement PlayerReputation packet 2018-01-30 22:55:29 +02:00
David Cernat
3d80e2db62 [General] Add placeholders for new packet types, part 2 2018-01-30 16:01:33 +02:00
David Cernat
02af7f6ba1 [General] Add placeholders for new packet types 2018-01-29 22:32:51 +02:00
David Cernat
ce11a1dfa9 [Client] Fix potential invalid pointer when storing cell unloads
Notably, builds of the client done with Clang were crashing on startup before this.
2018-01-29 00:14:26 +02:00
David Cernat
420dab10e1 [General] Track objects directly placed by players in ObjectPlace
This allows the OnPCDrop variable to get set correctly even when object placements have to go through the server first in order to gain a unique multiplayer index (mpNum).

Among other things, this makes it possible to roll marijuana joints in the popular mod "Tribunal Code Patch".
2018-01-28 17:46:51 +02:00
David Cernat
d7e29f1f61 [Client] Unequip items with constant effect damage when resurrected 2018-01-27 20:19:39 +02:00
David Cernat
d19d8b0a34 [Client] Add and use enchantmentType argument for unequipItemsByEffect() 2018-01-27 19:37:16 +02:00
David Cernat
6c4bb8c423 [Client] Move resurrection code for local player to LocalPlayer 2018-01-27 19:09:55 +02:00
David Cernat
6b75a82777 [Client] Ignore equipment items for DedicatedActors with count below 0 2018-01-27 18:08:45 +02:00
David Cernat
e3bc11d9eb [Client] Fix ListBox overlap crashes by removing ListBoxes properly 2018-01-27 15:41:11 +02:00
David Cernat
c6a85ee8f9 [Client] Add doesEffectListContainEffect() method to MechanicsHelper 2018-01-26 03:18:01 +02:00
David Cernat
aa392ebf20 [Client] Unequip items if necessary when attr/skill modifier is set to 0 2018-01-26 00:45:39 +02:00
David Cernat
ace825b99c [Client] Ignore invalid player class IDs from packets
Additionally, clean up variables names in related code.
2018-01-24 02:47:56 +02:00
David Cernat
c6874509b6 [Client] Ignore invalid faction IDs from packets 2018-01-24 02:25:44 +02:00