Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Damage Source

Open Absolutionism opened this issue 7 months ago • 5 comments

Problem

No current support for Damage Sources, including reading and checking data of damage sources, no previous event values for damage sources, and unable to create custom damage sources

Solution

New module for damage sources. Adds expressions and conditions to get/set/check the data of damage sources Updates EffHealth to allow use of custom damage sources DamageSourceWrapper for a continuous data setting of a custom damage source.

Testing Completed

The newly created test file

Supporting Information

Had to add an ignore list in ClassLoaderTest because when loading the DamageSourceWrapper on 1.19.4, was throwing an exception.


Completes: none Related: none

Absolutionism avatar May 18 '25 17:05 Absolutionism

I'm in agreeance with sovde here, a damage source should only be modifiable via the exprsec as a means to limit ambiguity, unsure how it would allow removal of the wrapper, it's still needed I would assume unless we store custom information onto the event.

Fusezion avatar May 19 '25 16:05 Fusezion

I'm in agreeance with sovde here, a damage source should only be modifiable via the exprsec as a means to limit ambiguity, unsure how it would allow removal of the wrapper, it's still needed I would assume unless we store custom information onto the event.

You can just store a builder on the exprsection, yes

sovdeeth avatar May 19 '25 17:05 sovdeeth

You can just store a builder on the exprsection, yes

We would still need the wrapper for a couple of reasons. To even initiate the builder, would need a DamageType, granted that could be mitigated by simply requiring it in the pattern of the ExprSec The Builder doesnt extend DamageSource so it wouldn't be viable for an event-value and the default expression. Another is that with the Builder, there are no getters. So if something is set then there's no way to ensure the finalization is valid. Which the only check needed to be done is to ensure that if causing entity is set, then the direct entity needs to be set, or else get an IllegalArgumentException

I feel the wrapper should be kept, since DamageSource is still experimental, if the API was updated to allow control over more aspects, then the wrapper would be nice to have.

Absolutionism avatar May 19 '25 17:05 Absolutionism

You can just store a builder on the exprsection, yes

We would still need the wrapper for a couple of reasons. To even initiate the builder, would need a DamageType, granted that could be mitigated by simply requiring it in the pattern of the ExprSec The Builder doesnt extend DamageSource so it wouldn't be viable for an event-value and the default expression. Another is that with the Builder, there are no getters. So if something is set then there's no way to ensure the finalization is valid. Which the only check needed to be done is to ensure that if causing entity is set, then the direct entity needs to be set, or else get an IllegalArgumentException

I feel the wrapper should be kept, since DamageSource is still experimental, if the API was updated to allow control over more aspects, then the wrapper would be nice to have.

The event-value thing could be easily done via just building the builder when necessary, but I see your point about future proofing given this api still seems very unfinished.

sovdeeth avatar May 19 '25 17:05 sovdeeth

btw, can you remove the up for debate now?

Absolutionism avatar May 20 '25 16:05 Absolutionism