Commit graph

424 commits

Author SHA1 Message Date
Jonathan Morland-Barrett
8df2f6515e
Added dynaprops for min and max attack range increase. (#511)
* Initial commit of min and max range increase dynaprops.

* Fixed documentation and reported style issues.

* More style check fixes.

* Update missing uobject and script objects for new props.

* Rectify missing code from uoscrobj which prevented assignment on mobiles.
Changed range logic from weapons to include some sanity checks.

* Add a simple test

---------

Co-authored-by: Jonathan Morland-Barrett <jonathan@veridiandynamics.com.au>
Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
2024-11-02 15:46:50 +01:00
turleypol
300a9ca47d
added ssopt AllowVisualRangeModification (#726)
* added ssopt AllowVisualRangeModification which allows clients to modiy
their LOS via pkt 0xC8

* added ssopt MinimumVisualRange and MaximumVisualRange to limit the range
a client can define.
added r/w script member client.visual_range
if set via script the updaterange can no longer be modified by the
client

* fixed typo

* missing include

* if via script the visual_range is set to 0 use the client given range
remove/add objects when the visual range changes
added test
fixed testclient 0xbf sub clienttype packet

* extra logic to send/remove objects only if they are now/no longer
visible due to range change
script can by pass the VisualRange limit
added docs

* core changes
2024-11-01 19:07:43 +01:00
Kevin Eady
ef5931bcc6
Correctly load packages in ecompile (#731) 2024-10-27 11:06:48 +00:00
Kevin Eady
2d0b675754
Fix super-scoped function resolution; Fix SourceLocation for scoped function calls (#730)
* Fix super-scoped function resolution

* Fix SourceLocation for scoped function calls
2024-10-25 11:20:41 +02:00
Lukáš Novotný
d56a6df251
Add moved_at and position_changed_at members to characters (#729)
* add moved_at and position_changed_at members to characters

* add core changes, docs

# Conflicts:
#	docs/docs.polserver.com/pol100/corechanges.xml
#	pol-core/doc/core-changes.txt

* fix docs
2024-10-23 20:27:56 +02:00
Kevin Eady
150d7982fb
Fix too-early fail on calling scoped variable as function (#728) 2024-10-20 17:42:07 +02:00
Lukáš Novotný
6acc69edc7
Configurable visual range (#715)
* configurable visual range

* visual range => default visual range

* fix code style

* move to ssopt
2024-10-19 15:42:50 +02:00
Kevin Eady
f45d12665d
Fix various case sensitivity issues in classes (#725) 2024-10-18 06:53:50 +02:00
turleypol
034f4687e3
SmoothBoat pkts: reduced pktsize even more 10% + extra margin (#724)
* SmoothBoat pkts: reduced pktsize even more 10% + extra margin

* no need to create 8000 items for the limit test
2024-10-17 22:51:49 +02:00
turleypol
2320a5dd35
Socket::has_incoming_data closes socket on error (#721)
* Socket::has_incomming_data closes socket on error
eg auxclient via OpenConnection had the problem that a closed connection
by the other side wasnt detected.
cleanup timeout params uses now milliseconds
removed old unused pollingwithselect
renamed pol.cfg entry for SingleThreadLoginServer socket timeout

* changed the default for the loginserver to single thread
Formatter defaults when no cfg can be loaded match the cfg case now.
added docs
2024-10-17 06:55:06 +02:00
turleypol
084a4e78e7
Removed PolLock when handling nonallowed pkts (#720)
* do not lock PolLock if a client sends a non-allowed pkt, this will be
only logged like undefine pkts and thus does not need the log.
added debug define to polsem.h which prints file/line of each PolLock

* extended SelectTimeout docs

* fixed debug define

* added cfg to disconnect clients if they send unknown/non-allowed pkts
during login phase

* docs
2024-10-15 17:23:02 +02:00
Kevin Eady
0fa1b893a0 Update core-changes, break-changes for classes support (#719)
* Format testsuite escript

* Format testsuite pol

* Update docs
Switch "attributes" to "members" to better align with Escript terms.

* Add core-changes, breaking-changes
2024-10-10 18:06:04 +02:00
Kevin Eady
0988c17f29 Add classes documentation (#717)
* Add escript guide docs for classes

* Add ClassInstanceRef to objref docs

* Use objref.dot to generate svg
2024-10-10 18:06:04 +02:00
turleypol
145eb8185b
fixed missing space when packing funcrefs (#714)
* fixed missing space when packing funcrefs
pack functioncall during group formatting without forcing a newline

* error if resulting format string is empty

* core changes

* do not start a newline when next part is a closing parenthesis during
groupformatting

* pkg loading is again quiet
2024-10-03 15:10:21 +02:00
turleypol
ba9ad6d1d5
more formatting improvements (#696)
* more formatting improvements:

replace inside of comments tabs with spaces if UseTabs is false
do not strip whitespaces at the beginning of linecomments
better handling of long lines eg string additions
"binpack":
  if an array fits equally into up to 3 lines use this instead of having each element in a newline
  struct/dicts get only packed if they fit into a single line, or half of the room for two lines
align comments in statements

* fixed linecomment forcing newline in simple splits
formatting of functionexpressions
```
@(blubb) {
  blah;
};
```

* fixed windows lineendings
fixed extra newline before long comment in certain situations
added option FormatterFormatInsideComments to deactivate trimming and
replacing of tabs

* fixed typo..
ecompile cfg is now FormatterIndentLevel

* FormatterBracketAttachToType: array{} vs array {}
FormatterAllowSingleLines: allow single line case/functionrefs

* align case label expressions
comments at the end still make the expression packable
other bugs

* better detection of case labels, by buffering the text. fixed more
problems with comments while packing lines

* do not allow more then 3 lines to be packed to a single one

* fixed hopefully last bug with comments and packing

removed FormatterAllowSingleLines
added
 FormatterAlignTrailingComments
 FormatterAlignConsecutiveShortCaseStatements
 FormatterAllowShortCaseLabelsOnASingleLine
 FormatterAllowShortFuncRefsOnASingleLine

* better linesplits when prefferedBreak is used (functions with params)

* fixed unalign lines with comments in arrays

* simplified ecompile code, use callback for compilation during iteration
through the directories.
use for pkgs recursive_directory_iterator

* core-changes

* onlinedocs

* onlinedocs-typo

* corrected cfg

* do not touch comments at all when disabled
detect aligned */

* fixed group formatting in var statements in more complicated situations

* when packing finishes right before the last element check if this
element also fit into the last line

* remaining ); or similar parts dont start a new line during group
formatting

* fixed edge cases of preferredBreak tactic with paranthesis alignment

* changed defaults, updated docs
2024-09-13 06:49:00 +02:00
Kevin Eady
ad4882821c
Use SLL parsing with ANTLR (#708)
* use SLL parsing

* Move listeners, fix error catching

* Move error listeners back

* fix warning

* docs
2024-08-31 09:16:14 +02:00
Reloecc
1da821f0f9
ssopt.MobilesBlockNpcMovement allows followers to stack on a tile (#702)
* ssopt.MobilesBlockNpcMovement = 2 allows followers to stack on single tile

* enum MOVEBLOCKMODE for ssopt.MobilesBlockNpcMovement

---------

Co-authored-by: jan.cernin <jan.cernin@3it.cz>
2024-08-29 07:54:11 +02:00
Kevin Eady
29bf643c06
Fix Z calculation for turning objects on boat (#700)
* Implementation

* Tests

* Docs
2024-08-24 09:27:05 +00:00
turleypol
50a6658883
Formatter variable declaration, align open parentheses (#691)
* Formatter: variable declaration list gets aligned with "var" breaked at
the comma.
if a linebreak happens while a paranthesis is open align next line with it

* added corechanges
2024-08-11 22:09:30 +02:00
Kevin Eady
88b4f9923d
Allow function reference calls across executors (#687)
* Allow function reference calls across executors

* Update core-changes

* Address review todos

* Change Globals2 to reference

* Revert "Change Globals2 to reference"

This reverts commit 37e37506be.

* Change Globals2 to shared pointer

* Address review comments
- Remove handled TODO comment
- Move arguments passed by value
2024-08-10 17:43:21 +02:00
Kevin Eady
a780712ec7
Add spread operator for array initializers, function calls, and method calls (#684)
* Update grammar

* Update parser and AST generator

* Update semantic analysis, tests

* Handle instruction generation

* Executor implementation
- Instruction `ins_storestackcount`
- Instruction `ins_spread`
- Update listfile tests for new `storestackcount`` instruction

* Add tests targetting resource tracker

* Revert "Executor implementation"

This reverts commit f0caede24179cb11b6d98c8cd1fecd91ce546148.

* New instruction implementation
- Introduce `BSpread` object to manage spreading an object at runtime.

* More tests

* Fix memory leak

* Add test spreading non-arrays

* Add failure reason to bfunc method call
Better than getting uninit

* Core changes; docs + accompanying tests for docs

* Resolve CI annotation warnings
- this statement may fall through

* Fix listfile snapshots due to base rebase, whoops
2024-08-06 23:34:24 +02:00
Kevin Eady
6ed593ac81
Add function reference table to EScriptProgram (#686)
* Introduce FunctionReferenceRegistrar
- Track function references created by functors
- Remove ValueStack-held attributes for functors
- Add Function References section to escript program
- Use Function References section in ins_functor
- Update escript version

* Update listfile snapshots
- Remove ValueStack-held attributes created by functors

* Add function reference tracking to function references
- `emit.function_reference` uses funcref registrar + emits that index
- `ins_funcref` uses parameter count + is variadic from prog funcref table
- update listfile snapshots

* Add core-changes
2024-08-06 20:29:02 +02:00
Kevin Eady
93645f0770
Add variable arguments to user functions (#679)
* Update grammar

* Update parser and AST generator

* Update semantic analysis

* Executor implementation
- Move Executor stack modification logic to BFunctionRef
- Handle user function calls
- Handle expression function calls

* Tests

* Update existing listfile snapshots
- Adds variadic boolean to instruction stack
- Changes instruction counts and offsets

* Fix test issue

* Better implementation of calling user functions

* Add var-args-captures test

* Refactor continuation handling + handle variadic args
- Move stack modifications from make/withContinuation into the executor's handling of the continuation
- Only trim args in continuation call if function is not variadic

* Add var-args-continuation test (via array.filter)

* update escriptguide + formatting, docs

* Fix CI annotations
- '=': conversion from 'size_t' to 'unsigned int', possible loss of data
- declaration of 'continuation' hides previous local declaration
2024-08-04 17:13:30 +02:00
Kevin Eady
cfd241bb93
Add support to change House multi id via house.set_multiid() (#677)
* Some changes
- add house `MTH_SET_MULTIID`
- `UMutli::multiid` protected, rename to `multiid_`
- Make setting `multi.graphic` a no-op

* implementation

* initial test

* add walkon, collision tests

* Address review comments
- Add nullptr check

* Add ability to pass string name; tests;

* Add docs

* update objref.xml datemodified
2024-08-03 15:08:43 +02:00
Kevin Eady
5daca73d65
Fix bad docs (#682) 2024-08-03 12:27:36 +00:00
Kevin Eady
d1a1bd3afe
Additional escript array functional methods (#674)
* Implementation change for continuation handling

* Implement array methods find, findIndex, map, reduce

* Add tests

* update filter test for coverage

* update docs

* change implementation to not copy

* update tests; add tests for "polyfill" comparison

* update escript guide
2024-08-02 20:39:32 +02:00
turleypol
814c80acc5
use xml text for description of methods/members (#678)
xslt copies text node, so that more style options are available
(br/code/...)
fix alternating color of lines
2024-08-01 22:49:37 +02:00
Kevin Eady
060814ec67
Fix function expression assignment to locals and captures (#676)
* implementation

* tests

* docs
2024-08-01 20:22:21 +02:00
Kevin Eady
e43cc86c19
Fix function expression captures to be byref (#675)
* implementation

* tests

* docs
2024-08-01 12:26:49 +02:00
turleypol
d2450b0508
improved escript formatter when formatting if's/function parameters (#673)
* improved escript formatter when formatting if's/function parameters

logical operators get now a preferred break style same for commas in
function/program parameters. split based on this flag the line

* when logical "and/or" and commas from function parameters are in one
line only split based on logical ones

* core changes
2024-08-01 08:00:35 +02:00
Kevin Eady
f381f46dc3
Add compiler support for function expressions (#671)
* initial poc of function expressions
- update grammar
- mock AST builder to return BBoolean(true) for a func expr
- update prettifier for skeleton implementation

* more skeleton work
create AST class FunctionExpression mimicking boolean value

* create ast UserFunction, add to workspace from functexpr

* can generate instructions

* reorg tests; add test for instructions

* can track FunctionDepth in Variable

* can get captures for funcexprs inside funcs.. tbd if this way of nesting works

* Implement create-functor instruction
- Move function depth from Variable to Variables
- Introduce stacking of `Variables` for function expresions via `FunctionVariableScope`
- Add `TOK_FUNCTOR` instruction for 'create-functor'
- Handle emitting a `FunctionExpression` AST node
- Update `emit.declare_variable` and `emit.access_variable` to account for function captures
- Remove `in_function` from instruction generator, as it is tracked via `UserFunction` stack
- Update tests

* Address Discord comments
- Swap pop param order

* Bubble up captured variables through nested functions

* Improve testing infrastructure; add some test cases

* Fix compilation error

* prepend captures to function parameters in funcref mth_call

* update tests

* move from function{} to @{}

* implementation fix

* some more tests

* update docs

* Some cleanup

* fix CI annotation warning
- 'argument': conversion from 'size_t' to 'VariableIndex', possible loss of data

* Address review comments
- Add `passert_always`
- Use better example in docs

* Some cleanup
- Remove unused functions
2024-07-29 22:30:52 +02:00
Kevin Eady
21fc580e66
Add filter method to escript arrays (#667)
* POC of calling user functions from core

* rename to BContinuation

* fix annotation warnings

* fix annotation warnings 2

* some cleanup, comments

* add more params to filter

* add more tests

* fix stack issues, wip determine what to do with printStack helper testing function

* print stack only for debug; increase OTContinuation to 100

* docs

* remove debugging leftovers
2024-07-28 22:51:04 +02:00
Kevin Eady
f47ce97d26
Add compiler support for expressions as function callee (#670)
* initial support for function calls with expression callee

* Add support for identifier-named callees

* add compilation failure test; better code docs

* Add core-changes

* Address compiler warnings
- conversion from 'size_t' to 'unsigned int', possible loss of data

* Update grammar

* implementation

* tests

* update core-changes

* Address CI warnings
- declaration of 'method' hides previous local declaration
2024-07-28 20:21:23 +02:00
Lukáš Novotný
fea0ed7a53
Fix status hp values upon realm change (#669)
* fix status hp values upon realm change

* update core changes
2024-07-21 20:17:57 +02:00
Kevin Eady
0b1bb4c2bf
Add source location to Print() messages sent to debugger (#664)
* Implementation

* Tests

* Update core-changes
2024-07-16 20:23:17 +02:00
Kevin Eady
271722af13
Send Print() messages to attached debugger (#663)
* Implementation

* Tests

* Update core-changes

* Implementation fixup
- do not copy message from executor
2024-07-16 12:41:55 +02:00
turleypol
774a9349f3
rewrite Decay system (#660)
* rewrite Decay system
removed setting to switch to multithread decay
Syshook:: call_long treats true/false as 1/0
can_decay hook if it returns 2 skip multicheck

* sleeptime is used outside of PolLock, guarded via atomic

* updated docs

* renamed syshook private methods
added corechanges
2024-07-14 17:34:17 +02:00
Kevin Eady
2589457275
Attack when character (defender) unhides (#661)
* Implementation

* tests

* core changes
2024-07-13 18:28:50 +02:00
Kevin Eady
fa70dbd1d3
Attack when character unhides honoring swing timer (#658)
* implementation

* tests

* core changes

* add debugging for tests

* Revert "add debugging for tests"

This reverts commit 3b9f4a6d2b.

* adjust test scope
2024-07-11 18:14:18 +02:00
turleypol
f526ef17bd
Boat refactor Part 3 of N (#656)
* refactored boat move, fixed truncation of position when switching realm.
more simplifications
added more tests

* move_multi now accepts oldlocation like the other move functions

* added corechanges
2024-07-10 19:54:31 +02:00
Lukáš Novotný
f4b9be4314
Improve held weight computations (#650) 2024-06-17 09:56:40 +02:00
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
9ebf0a0572
Fix client issue with stacks not updated correctly in containers (#648) 2024-05-15 16:59:32 +02:00
Kevin Eady
c4f6e32e88
Add held_weight_multiplier for containers; Fix missing tooltip updates (for weight) (#646)
* Implementation

* wip testing

* allow setting held weight mod to long value

* more tests

* address github actions warnings
- unary minus operator applied to unsigned type, result still unsigned

* Add docs, core-changes

* fix GetItemDescriptor() for HeldWeightMultiplierMod; update tests

* update docs a bit more

* Remove mod suffix
2024-05-14 08:24:19 +02:00
Reloecc
0c51385614
Add servspecopt NpcMinimumMovementDelay (#642)
Co-authored-by: jan.cernin <jan.cernin@3it.cz>
2024-04-24 17:02:13 +02:00
Kevin Eady
09bb6d97f3
Add servspecopt BoatSailsCollide (#640)
* Implementation

* Add tests

* Update docs

* Rename test function

* Tweak boat cleanup if test fails

* Address review comments
- check objtype passable in boat unregself
2024-04-18 14:59:23 +02:00
Kevin Eady
b01a6a6ee6
Fix thread-safety on PolConfig (#639)
* Implementation, tests, core-changes

* More decay-based options to atomic
2024-04-14 18:50:15 +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
814f864989
Fix map crash on edges in Tokuno; Introduce Realm Descriptor versioning (#634)
* Update solidx size, shift, cellmask to 8, 3, 7

* Introduce realm descriptor versioning

* Add core-changes

* Update breaking-changes.txt
2024-03-18 20:47:29 +01:00