View Issue Details [ Jump to Notes ] [ Related Changesets ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004726 | Spring engine | General | public | 2015-04-03 17:13 | 2016-08-26 19:14 | ||||
Reporter | PepeAmpere | ||||||||
Assigned To | hokomoko | ||||||||
Priority | normal | Severity | feature | Reproducibility | always | ||||
Status | resolved | Resolution | reopened | ||||||
Product Version | 98.0 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0004726: implement SetFeatureMaxHealth | ||||||||
Description | Spring.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 Reproduce | 1) featuredID = Spawn feature with maxHealth 50 2) Spring.SetFeatureHealth(featureID, 100) 3) local health = Spring.GetFeatureHealth(featureID) 4) Spring.Echo(health) | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
PepeAmpere (reporter) 2015-04-07 11:33 |
Btw generally it should work same way as Spring.SetUnitHealth works. |
hokomoko (developer) 2016-01-07 00:21 |
Fix 1b7fab6b746e5d0b589d5c93c74544dbad0aee91 committed to develop branch: Fix 0004726, repo: spring changeset id: 6151 |
PepeAmpere (reporter) 2016-08-22 18:44 |
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 |
hokomoko (developer) 2016-08-22 21:07 |
Isn't this how SetUnitHealth works? |
PepeAmpere (reporter) 2016-08-23 08:55 |
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. |
hokomoko (developer) 2016-08-26 19:14 |
Fix f3eb50f28d662c3caad9eb6e2febd2351b3ab1c7 committed to develop branch: implement SetFeatureMaxHealth Fix 0004726, repo: spring changeset id: 7268 |
![]() |
|||
spring: develop 1b7fab6b
Timestamp: 2016-01-07 00:23:59 Author: hokomoko [ Details ] [ Diff ] |
Fix 0004726 | ||
mod - rts/Lua/LuaSyncedCtrl.cpp | [ Diff ] [ File ] | ||
spring: develop f3eb50f2
Timestamp: 2016-08-26 19:15:47 Author: hokomoko [ Details ] [ Diff ] |
implement SetFeatureMaxHealth Fix 0004726 |
||
mod - rts/Lua/LuaSyncedCtrl.cpp | [ Diff ] [ File ] | ||
mod - rts/Lua/LuaSyncedCtrl.h | [ Diff ] [ File ] | ||
![]() |
|||
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 |