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

442 commits

Author SHA1 Message Date
David Cernat
b7090b2550 [Server] Add experimental option for not crashing from Lua script errors
Additionally, fix return type of GetPluginEnforcementState()
2018-12-01 03:03:39 +02:00
David Cernat
d8ca268067 [Server] Move plugin enforcement functions to ServerFunctions 2018-11-30 22:43:10 +02:00
David Cernat
2933526995 [Server] Include errors related to Lua calls in server logs 2018-11-30 22:01:02 +02:00
Koncord
e162af0003 [Server] Disallow non void callbacks 2018-10-30 15:32:52 +08:00
Koncord
07a5f5296c [Server] Rework OnRequestPluginList callback. Add AddPluginHash function 2018-10-30 14:56:54 +08:00
Koncord
20a7619a4a [Server] Remove result from the OnPlayerConnect callback
Now it's recommended to use tes3mp.Kick() function
2018-10-30 13:18:32 +08:00
Koncord
f1e8569291 [Server] Remove result from the OnPlayerSendMessage callback 2018-10-30 13:13:07 +08:00
Koncord
efa362031e [Server] Remove unused Main callback 2018-10-30 13:03:37 +08:00
Koncord
b83e4056a8 [Server] Remove CallFF dependency as it not fully supported by Windows and MacOS 2018-10-30 12:59:47 +08:00
Koncord
585557ad8a [Server] Remove argument cast in the Call with va_args 2018-10-30 12:58:15 +08:00
Koncord
3101de5f02 [Server] Add kicked load status 2018-10-30 12:56:50 +08:00
David Cernat
99f8ef88a5 [Server] Add SetObjectActivatingPid() script function 2018-10-22 16:25:50 +03:00
David Cernat
bb834748c5 [Server] Log player kicks 2018-10-13 09:34:29 +03:00
David Cernat
292536439e [Server] Rename script functions for clearing packet vectors for players 2018-10-03 02:26:47 +03:00
David Cernat
c79660f721 [Server] Make inventory script functions consistent with others
Functions that add elements to a vector should not change the action. This fixes the last remaining oddity in Koncord's original implementation of inventory sync.
2018-10-01 18:29:50 +03:00
Koncord
48f4792bc1 [Server] Add GetMaxPlayers, GetPort and HasPassword functions to API 2018-09-05 18:19:34 +08:00
David Cernat
75a64a69c7 [Server] Add GetInventoryChangesAction() script function
Additionally, fix a typo in the description of GetSpellBookChangesAction()
2018-08-21 10:06:40 +03:00
David Cernat
5fd4113978 [General] Implement sending of ActorSpeech packets from server scripts 2018-08-13 20:39:03 +03:00
David Cernat
aec0c5bd49 [Server] Make capitalization consistent for AI-related script functions 2018-08-11 18:57:36 +03:00
David Cernat
8df08c7d10 [General] Implement PlayerItemUse packet
Players can no longer unilaterally use items on themselves in their inventory. When they try to use an item, they send a PlayerItemUse packet to the server with the item's details. A serverside script can then check the item and either send the packet back to make the item use go through or drop it.
2018-08-09 18:25:20 +03:00
David Cernat
888e1dfff8 [General] Allow setting of AI fight & dynamic stats in record packets
Additionally, allow the setting of the Autocalc flag for an NPC record based on an existing record.
2018-08-05 11:00:25 +03:00
David Cernat
6498bcb22b [Server] Add script functions for getting player draw & sneak states 2018-08-03 18:26:44 +03:00
David Cernat
b57807407a [General] Implement RecordDynamic packet, part 1
Spell, potion, enchantment, creature, NPC, armor, book, clothing, miscellaneous and weapon record data can now be sent in a RecordDynamic packet. Additionally, the packets include data related to associated magical effects (for spells, potions and enchantments), data related to default inventory contents (for creatures and NPCs) and data related to body parts affected (for armor and clothing).

The server now has associated script functions for setting most of the details of the above, with the main exception being individual creature and NPC stats.

Records can either be created entirely from scratch or can use an existing record (set via the baseId variable) as a starting point for their values. In the latter case, only the values that are specifically set override the starting values. Creature and NPC records also have an inventoryBaseId that can be used on top of the baseId to base their inventories on another existing record.

The client's RecordHelper class has been heavily expanded to allow for the above mentioned functionality.

When players create spells, potions and enchantments as part of regular gameplay, they send RecordDynamic packets that provide the server with the complete details of the records that should be created. When they create enchantments, they also provide the server with armor, book, clothing and weapon records corresponding to the items they've enchanted.

This functionality added by this packet was originally supposed to be exclusive to the rewrite, but I've gone ahead and tried to provide it for the pre-rewrite in a way that can mostly be reused for the rewrite.
2018-07-30 10:56:26 +03:00
David Cernat
d93b67ef21 [General] Sync soul refIds for items and add related script functions 2018-07-26 22:37:04 +03:00
David Cernat
d778bc3b8a [Server] Turn readWorldstate and writeWorldstate into static variables 2018-07-26 20:03:42 +03:00
David Cernat
b4802e4201 [General] Use Time struct for time in BaseWorldstate 2018-07-26 19:01:27 +03:00
David Cernat
a4b588d1b5 [General] Add optional timestamps to journal entries in PlayerJournal 2018-07-26 04:36:12 +03:00
David Cernat
b79221efcc [Server] Rename variable i into index in ActorFunctions 2018-07-24 21:29:40 +03:00
David Cernat
8fbed1f808 [General] Remove custom data from PlayerSpellbook packet
It has never made sense to have custom spell data in PlayerSpellbook packets, so it has been removed.
2018-07-24 20:58:55 +03:00
David Cernat
2e0b6e4e3e [Server] Rename variable i into index in script function arguments
Additionally, rename i into index in LangLua.
2018-07-24 20:14:51 +03:00
David Cernat
d4a84ac34a [Server] Update script function descriptions for ObjectList origin 2018-07-22 23:08:32 +03:00
David Cernat
3dc2d1b214 [General] Add packetOrigin and originClientScript to ObjectList packets
Additionally, add script functions for getting the packetOrigin and originClientScript of received ObjectList packets.
2018-07-22 18:38:05 +03:00
David Cernat
892d71ce71 [General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e2 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.

My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.

However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 05:20:26 +03:00
David Cernat
3649cf553f [General] Rename PlayerKillCount into WorldKillCount
This should clarify the real meaning of the packet and its associated event.

The event itself has been renamed from OnPlayerKillCount to OnWorldKillCount.
2018-07-15 05:34:59 +03:00
David Cernat
6ebe09375f [General] Implement ObjectActivate packet & associated script functions 2018-07-15 03:16:04 +03:00
David Cernat
81b160cae8 [General] Add placeholder for ObjectActivate packet 2018-07-15 01:08:31 +03:00
David Cernat
61da0d2475 [General] Turn PlayerInteraction into PlayerInput 2018-07-15 00:36:07 +03:00
David Cernat
ab5fd0aef8 [Server] Clean up descriptions for Object script functions 2018-07-13 04:55:05 +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
20296859ee [Server] Clarify functions used for getting data in Networking 2018-07-13 02:40:24 +03:00
David Cernat
04dd59e638 [Server] Use clearer names for functions used to get last received data
Additionally, rename GetObjectChangesSize() into the less confusing GetObjectListSize()
2018-07-13 02:33:50 +03:00
David Cernat
aeb2e57444 [Server] Bring Actor functions in line with Object functions, part 2
The ActorPacket-sending functions now have sendToOtherVisitors and skipAttachedPlayer arguments, except for the ones for ActorList and ActorAuthority (because such arguments don't make sense for those).
2018-07-13 01:25:43 +03:00
David Cernat
837c5369c0 [Server] Add OnActorAI event and remove autosync for ActorAI packets 2018-07-13 01:05:27 +03:00
David Cernat
8f745df055 [Server] Bring Actor functions in line with Object functions, part 1
The last received ActorList can now be copied into the write-only ActorList that can be sent in packets. Changing the pid of the write-only ActorList can now be done separately from clearing its contents.
2018-07-13 01:04:41 +03:00
David Cernat
bdf2f03c4f [General] Remove unnecessary MapChanges struct from BaseWorldstate 2018-07-12 05:06:31 +03:00
David Cernat
5bb442bbd3 [Server] Add sendToOtherVisitors boolean to SendActorAI()
Additionally, avoid repetition in functions that send Actor packets.
2018-07-11 22:17:00 +03:00
David Cernat
bff6e9e235 [General] Implement ActorAI packet, part 5
Allow repetition for AiWander package to be turned on and off.
2018-07-10 23:18:32 +03:00
David Cernat
00c13ae96c [General] Implement ActorAI packet, part 4
The server can now make actors activate players and objects, at least in theory. In practice, OpenMW''s AiActivate package needs to be worked so it allows specific objects as targets instead of just refIds.
2018-07-10 07:07:37 +03:00
David Cernat
0e13207afe [General] Implement ActorAI packet, part 3
The server can now cancel actor AI, make actors travel to a location, make actors wander, and make actors get escorted by a player or another actor.
2018-07-10 05:07:58 +03:00
David Cernat
cbb9817913 [Server] Add missing descriptions for PlayAnimation() and PlaySpeech() 2018-07-08 02:03:33 +03:00