Commit graph

18 commits

Author SHA1 Message Date
Kevin Eady
d916f86408
Update container OnRemove, CanRemove program parameters (#647)
* Implementation
- Add `amount` to CanRemove script
- Add `split_from` to OnRemove script

* Tests

* Add docs and core-changes

* Fix tests... maybe?

* Restore testing for client events in container event tests
2024-05-16 22:49:51 +02:00
Kevin Eady
1a2668e36b
Trigger WalkOnScript for Boats; Add lastrealm to WalkOnScript (#638)
* Add boat walkon script

* Add tests

* Add lastrealm to walkon script

* Update walkon tests for last position check

* Update docs

* Add core-changes

* Add pre-test cleanup to corpse equipment tests
2024-03-24 14:39:11 +01:00
Kevin Eady
ac97667b3b
Corpse equipment changes; Fix support of MaxItems 0 for containers (#635)
* Implementation

* Add core-changes

* Fix warnings

* Fix support of MaxItems 0 for "unlimited" in containers

* add initial tests

* Update core-changes
2024-03-24 10:17:35 +01:00
Kevin Eady
3f82fbafb4
Add boat.set_alternate_multiid (#593)
* Fix unhandled exception in UBoat::create_component

* Return 0 on unsuccessful boat move with MoveBoat and MoveBoatRelative

* Add boat.set_alternate_multiid

* skip base multiid in alternates boat struct

* Add test for boat.set_alternate_id

* docs, core-changes

* use array equals in test
2024-01-10 11:34:40 +01:00
Kevin Eady
e5209a51ff
Add support for boat piloting via mouse movement (#558)
* Initial work on boat piloting changes
- Changed: Boat script is now registered as the boat's control script
- Added: Boat piloting via mouse movement
- Added: boatRef.pilot member
- Added: boatRef.pilot([charRef]) method

* add first test

* Fix boat control script attach on scripted create

* move boat move packet warnings to suspicious acts

* set pilot now errors when mutli has no process

* Add test, testclient support for boat move packet

* Touchup pilot members and methods
- Change `pilot` method to `setpilot`. This standarizes it a bit with
the same naming convention of `npc.setmaster`.
- Fix return values in `pilot` member, returning `0` if no pilot.

* Refactor to put functionality inside UBoat

* Address Discord comments
- Remove SuspecisionActs for no boat process.
- Add `relative_direction` to boat move sysevent.

* destroy boatmount on chr death; more error checks

* Fix compilation after master merge

* Fix relative_direction calculation

* wip tests

* Fix boat tests

* Address review comments
- Initialize UBoat::mountpiece

* Add HSA check to boat.setpilot

* Reject movement if boat mountpiece equipped

* docs; test cleanup

* add test for blocked movement

* Address Discord review comments
- Add suspicious acts notice for client movement while piloting
- Return error on attempting to script move a char that is piloting a boat

* Fix compiler warning
2024-01-06 18:01:31 +07:00
turleypol
d873551c25
removed pol_distance/inrange* functions (#556)
* removed pol_distance/inrange* functions
replaced lastxyz with Pos4d

* replaced WorldIterator::InVisualRange with InMaxVisualRange returning
all objects in maximum update range. Adapted each caller, they now have
to check in_visual_range
Multis should now be send to clients with its footprint in mind.
added testscript for boat moving in/out of range

* removed non pos InRange/InBox functions
gamestate.update_range doesnt need to be a Vector, renamed

* corrected send_action_to_inrange

* replaced clip methods with general numeric type clamp function

* added Range2d constructor with radius

* splitted update_range. chr has now a los_size (how far can it see) and
an object has a visible_size (0 for objects 1/2 footprint for multis)

* use in_range instead of pol_distance

* corrected order of checks

* fixed warnings

* fixed visual size of multis
testclient added wornitems pkt support
added tests for los

* corechanges
2023-12-25 22:02:52 +01:00
turleypol
cb6750405c
Double to string precision (#580)
* use std::to_chars for doubles

* fixed cmake errors when an escript error occurs

* macos 13 with clang15

* CI: macos new cache version

* guessing game

* guess no2

* test shipped clang with deloytarget env

* adapted testdata, lets see if all platforms behave the same

* explicit test if high precision double can get packed+unpacked

* log testclient receive buffer on error

* added docs
2023-12-20 22:13:39 +01:00
turleypol
a905142818
extend testclient to unpack compressed gumps (#539)
closes it directly and sends an event with the content
added simple test
2023-08-28 10:33:34 +02:00
Kevin Eady
ecec3a2206
reworked get_item and its undo behaviour (#514)
* reworked get_item and its undo behaviour.
old position gets stored and in case of failures restored

* removed ancient container content defines

* Fix some packet oddities
- dropitem: Success sent after rejections
- getitem: Double Delete Item packet due to item->extricate

* Store container serial when creating GottenInfo

* Add tests

* add socket mutex to disconnect checks

* Use mutable socket mutex

* add core changes

---------

Co-authored-by: turleypol <turley@polserver.com>
2023-05-23 17:07:23 +02:00
Kevin Eady
8cc1c6cade
Improve WarmodeInhibitsRegen functionality (#523)
* Improve WarmodeInhibitsRegen
- Change implementation
- Update documentation

* Add tests, core-changes

* Change test waiting times
2023-05-15 13:27:07 +02:00
turleypol
830daf726e
Fix crash when event queue is full (#521)
* each SpeechEvent needs to contain a copy of the speechtokens

* added core changes

* prevent memoryleak

* add basic pol test

* Remove extraneous prints in test

* Address review comments
- Refactor token encoding into a method

---------

Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
2023-05-12 20:45:40 +02:00
Kevin Eady
1b879bc59f
Add script helpers to implement stealing skill (#493)
* add item.character_owner

* Address review comments
- Cleanup chr_from_wornitems
- Return BError if no character owner

* Add Target option TGTOPT_ALLOW_NONLOCAL

* Address review comments
- Remove `Core::chr_from_wornitems`

* Add pol tests for snooping

* Add tests for TGTOPT_ALLOW_NONLOCAL

* target_nonlocal_checklos pol test debugging

* target_nonlocal_checklos pol test debugging
- Remove destroy of obstacle
- Add a CheckLosAt call to error return

* target_nonlocal_checklos pol test debugging
- Enable USAN build

* undo test debugging changes

* use mobile for los when targetting snoopable items

* Update core-changes

* Persist SnoopScript for items on save

* Add snoop_script_ to Item::estimatedSize

* document SnoopScript script type
2023-01-08 16:59:28 +01:00
turleypol
99667711af
Fixed move of mobiles/items between realms (#446)
* MoveObject fix between realms for mobiles and items

* missing poltool changes
2021-12-15 07:47:54 +01:00
turleypol
76d9c5e9d6
not yet active: handle update range of client. (#440)
* not yet active: handle update range of client.

* allow down to 5 as client view range

* try to secure testclient against racecondition
2021-10-28 23:08:38 +02:00
turleypol
f211e16658
wrappers for realm/uworld methods accepting Posclasses. (#428)
* wrappers for realm/uworld methods accepting Posclasses.

* switched memoryorder of realm zone

* fixed nullptr check

* renamed Realm::getzone to getzone_grid

* moved getzone to Realm

* testclient: xfixed multiple full pkts
2021-09-18 19:15:54 +02:00
turleypol
aa6b0ec3ba
Smooth Boat pkt: overflow/invis objects (#403)
* Test: move boat while client on ship
* added f3 pkt
* pkt id on assert failure
* 7090 pkts
* smooth boat pkt
* silent the spam
* syncpoint for moveobjecttolocation of char
* added sync point for silent item updates
* starting actual test for boat movement to check correcr coords
* read z coord as signed short
* clarified names

* smooth boat pkt rewrite. dont include invis objs, send the correct obj count in case of overflows

* core changes
2021-06-21 18:13:15 +02:00
turleypol
c6f957d4fa
Testclient api: listobjects, open backpack, target (#393)
* added api to get information of the internal state of the client
lock cleanup

* test cleanup
added ability to ignore tests
client communication can now be transfered to different scripts
setup script handles now the initial connection

* added api for open backpack and target/targetcoordinates

* helper function to create account with char
fixed signed char range
added testclient timeout for initial connection

* higher timeout
2021-03-28 14:25:56 +02:00
turleypol
8b7ece1c18
Testclient (#390)
* first testclient version
fixed dangling pointer in openconnection
added option to keep connection alive

* movement tests
OpenConnection do not start socketclient on connection error
changed communication pkts between testclient and server
send every event to server from testclient

* add new item event
serialize method
check move position

* added openconnection docs

* test if the ci can fail to find python3

* explicit add python3

* added multiclient support

* debug logs

* more debug

* id out of sync?

* cleanup fixed typo

* transfer client id

* send todos to the correct brain

* addee core changes
2021-03-25 19:26:09 +01:00