2019-08-21 14:04 CEST

View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0004726Spring engineGeneralpublic2016-08-26 19:14
ReporterPepeAmpere 
Assigned Tohokomoko 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionreopened 
Product Version98.0 
Target VersionFixed in Version 
Summary0004726: implement SetFeatureMaxHealth
DescriptionSpring.SetFeatureHealth can set health on only in bounds of [0, maxHealth]. In 94.1, 96.0 it was possible to set higher health.

I think it should be possible from general perspective.

Options - possible solutions:
[A] - when set health is higher then current maxHealth, set maxHealth implicitly to that value.
[B] - if setting health on higher values than maxHealth is not allowed, handle it as error input
[C] - add second optional parameter to SetFeatureHealth which will set also maxHealth
   - rest same as in option [B]
[D] - add new API command Spring.SetFeatureMaxHealth(number maxHealth) which will set maxHealth
   - rest same as in option [B]
Steps To Reproduce1) featuredID = Spawn feature with maxHealth 50
2) Spring.SetFeatureHealth(featureID, 100)
3) local health = Spring.GetFeatureHealth(featureID)
4) Spring.Echo(health)
TagsNo tags attached.
Checked infolog.txt for lua Errors
Attached Files

-Relationships
+Relationships

-Notes

~0014278

PepeAmpere (reporter)

Btw generally it should work same way as Spring.SetUnitHealth works.

~0015455

hokomoko (developer)

Fix 1b7fab6b746e5d0b589d5c93c74544dbad0aee91 committed to develop branch: Fix 0004726, repo: spring changeset id: 6151

~0016611

PepeAmpere (reporter)

On Spring 103.0

function gadget:FeatureCreated(featureID, allyTeam)
    local oldHealth = Spring.GetFeatureHealth(featureID)
    Spring.SetFeatureHealth(featureID, oldHealth*20)
    local newHealth = Spring.GetFeatureHealth(featureID)
    Spring.Echo(oldHealth, newHealth)
end

Prints e.g.

337, 337

~0016612

hokomoko (developer)

Isn't this how SetUnitHealth works?

~0016613

PepeAmpere (reporter)

SetUnitHealth was able to increase the health over the max and set new max this way. (it was doing this at the time of the report) Thats whats in the description of the task.

Truth is that once i test this on 103.0, it works different now

local oldHealth = Spring.GetUnitHealth(unitID)
Spring.SetUnitHealth(unitID, oldHealth * 20)
local newHealth = Spring.GetUnitHealth(unitID)
Spring.Echo("unit", oldHealth, newHealth)

really prints e.g.

"unit", 17152, 17152

so I agree it is consistent with feature version of the function now and from that perspective its fine.

--------

Although my use case is setting health over max health. I see there is SetUnitMaxHealth in docu, is there similar function for the Features which is not documented? If yes, I would expect it works consistent with the Unit-one. Pls check it in the engine and if given function exist, I will document it on the wiki.

~0016627

hokomoko (developer)

Fix f3eb50f28d662c3caad9eb6e2febd2351b3ab1c7 committed to develop branch: implement SetFeatureMaxHealth

Fix 0004726, repo: spring changeset id: 7268
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2015-04-03 17:13 PepeAmpere New Issue
2015-04-07 11:33 PepeAmpere Note Added: 0014278
2016-01-07 00:21 hokomoko Changeset attached => spring develop 1b7fab6b
2016-01-07 00:21 hokomoko Note Added: 0015455
2016-01-07 00:21 hokomoko Assigned To => hokomoko
2016-01-07 00:21 hokomoko Status new => resolved
2016-01-07 00:21 hokomoko Resolution open => fixed
2016-08-22 18:44 PepeAmpere Note Added: 0016611
2016-08-22 18:44 PepeAmpere Status resolved => feedback
2016-08-22 18:44 PepeAmpere Resolution fixed => reopened
2016-08-22 21:07 hokomoko Note Added: 0016612
2016-08-23 08:55 PepeAmpere Note Added: 0016613
2016-08-23 08:55 PepeAmpere Status feedback => assigned
2016-08-23 12:03 hokomoko Severity minor => feature
2016-08-23 12:03 hokomoko Summary Spring.SetFeatureHealth is not able to set health higher than maxHealth as it was possible in older versions => implement SetFeatureMaxHealth
2016-08-26 19:14 hokomoko Changeset attached => spring develop f3eb50f2
2016-08-26 19:14 hokomoko Note Added: 0016627
2016-08-26 19:14 hokomoko Status assigned => resolved
+Issue History