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

30 commits

Author SHA1 Message Date
David Cernat
3a8831dc15 [Server] Add server functions for reading equipment change indexes 2020-07-07 15:41:03 +02: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
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
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
d93b67ef21 [General] Sync soul refIds for items and add related script functions 2018-07-26 22:37:04 +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
563269d359 [Server] Bring comments up-to-date for packet-sending script functions 2018-07-07 20:16:36 +03:00
David Cernat
2f1ef049d2 [Server] Turn sendToAttachedPlayer into skipAttachedPlayer
Unfortunately, default values set in the C++ code for our script function parameters don't actually seem to work, and they always default to false because they receive a nil value from Lua. As a result, to not break compatibility with previous scripts, I've decided to use a skipAttachedPlayer argument instead so it can default to false while still providing the same benefits that sendToAttachedPlayer provided.
2018-07-07 20:08:59 +03:00
David Cernat
6a3fbf4e98 [Server] Use consistent arguments for script functions that send packets
Previously, there was a confusing separation between script functions that had a "broadcast" argument and script functions that had a "toOthers" argument.

Those with broadcast sent the packet to all players on the server when broadcast was true. Those with toOthers sent the packet to all players other than the packet's attached player.

The former was based on the pattern of the original SendMessage() script function. The latter more closely resembled RakNet's own broadcast argument as seen here:

https://github.com/TES3MP/CrabNet/blob/master/include/raknet/RakPeer.h#L219

This commit makes it so all sending functions have a sendToOtherPlayers argument that is false by default and a sendToAttachedPlayer that is true by default. This should simultaneously allow sending to be more intuitive, while not breaking previous existing scripts to a significant degree.

Additionally, this commit also reduces some code repetition for all instances of packet-fetching in script functions.
2018-07-07 18:29:31 +03:00
David Cernat
311f770de7 [Server] Document script functions, part 4
Additionally, clean up some variable names.
2018-04-18 11:02:18 +03:00
David Cernat
9935f56d46 [General] Use doubles instead of ints for enchantmentCharge
Additionally, include enchantmentCharges for items  in PlayerEquipment packets.
2018-01-17 08:10:49 +02:00
David Cernat
993081ba1e [General] Add enchantmentCharge to worldObjects and items 2017-12-23 13:16:38 +02:00
David Cernat
6dde0ca9c9 [Server] Rework script functons by removing unnecessary vector buffers
Add new initialization script functions to allow clearing all player changes vectors in a manner consistent with Actor and World functions

Add toOthers boolean to all methods that send packets with player changes vectors
2017-07-07 09:25:48 +03:00
David Cernat
1b714fbfa7 [Server] Make script functions more consistent 2017-04-09 12:28:38 +03:00
David Cernat
b651c4deb4 [Server] In Item script functions, rename itemId into refId for clarity 2017-02-07 13:50:28 +02:00
David Cernat
f314b13edf [General] Rename item health into charge, for consistency with OpenMW 2017-02-05 14:56:27 +02:00
David Cernat
d308897f95 Rename PacketItems, PacketSpells into InventoryChanges, SpellbookChanges 2017-01-20 12:43:05 +02:00
David Cernat
6b14ca0775 Finish renaming of script functions for sending items and spells 2017-01-19 18:30:31 +02:00
David Cernat
33e85c54de Rename BasePlayer Inventory & Spellbook into PacketItems & PacketSpells
This avoids confusion when either of those is used to store and send a single item, and no longer requires coming up with confusing variable names like realSpellbook or realInventory for actual full spellbooks and inventories.
2017-01-19 18:06:59 +02:00
David Cernat
c81b58e1be Add spell script functions to tes3mp server 2016-11-21 20:37:04 +02:00
David Cernat
456aee65d9 Add and implement ClearInventory() script function 2016-11-20 04:06:33 +02:00
David Cernat
56928bdc4c Clean up inventory script functions so they are usable for equipment too 2016-11-18 00:52:17 +02:00
David Cernat
356143faed Rename GetEquipmentSlotCount() into GetEquipmentSize() 2016-11-18 00:46:42 +02:00
David Cernat
977e93288e Add GetEquipmentSlotCount() to item script functions 2016-11-17 23:07:29 +02:00
David Cernat
46b41b605a Revert "Use lowerCamelCase in tes3mp server script function names, part 1"
This reverts commit 0e2b589cdb.
2016-11-16 19:28:22 +02:00
David Cernat
0e2b589cdb Use lowerCamelCase in tes3mp server script function names, part 1 2016-11-16 16:52:16 +02:00
Koncord
c27351c19e Implement inventory functions
AddItem, RemoveItem, GetItemName, GetItemCount, GetItemHealth, GetInventorySize SendInventory
Example:
```lua
tes3mp.AddItem(pid, "glass dagger", 1, 50)
tes3mp.AddItem(pid, "glass dagger", 1, -1)
tes3mp.SendInventory(pid)
tes3mp.RemoveItem(pid, "glass dagger", 1)
tes3mp.SendInventory(pid)
local invSize = tes3mp.GetInventorySize(pid) - 1
for i = 0, invSize do
    print(("%s %d %d"):format(tes3mp.GetItemName(pid, i), tes3mp.GetItemCount(pid, i), tes3mp.GetItemHealth(pid, i)))
end
```
2016-10-23 02:57:49 +08:00
David Cernat
4b96080521 Make GetItemSlot work and add SendEquipment in server item functions 2016-09-30 12:30:05 +03:00
Koncord
1186d09ec0 ScriptFunctions.hpp size reduction 2016-08-30 12:20:39 +08:00