2025-07-21 22:29 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002267Spring engineUnit Scriptingpublic2011-02-07 23:17
Reporteruser744 
Assigned ToKloot 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version0.82.6.1 
Target VersionFixed in Version0.82.7+git 
Summary0002267: killing unit with AddUnitDamage in script.Create crashes on /give but not from factory
Descriptionif below script is used on a unit, spring.exe crashes when the unit is spawned with the /give command
if made via a factory, spring does not crash.

http://pastebin.ca/2025211
http://pastebin.ca/2025210
Additional Informationfunction script.Create()
    Spring.Echo ("yo")
    Spring.AddUnitDamage (unitID, 9001)
end

function script.Deactivate()
end

function script.Killed(recentDamage, maxHealth)
    return 0
end
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0006112

user744

a slightly changed version:
http://pastebin.ca/2025221
crashes even when build from factory.
unit gets build but instead of destroying itself, it kills spring.exe
http://pastebin.ca/2025219

Btw i use addunitdamage to avoid recursion warning
http://springrts.com/phpbb/viewtopic.php?f=23&t=24728

~0006117

Kloot (developer)

Last edited: 2010-12-21 16:16

Neither of those scripts crashes master (build + base content from 375affbde3a71fc27430abd7ea94b6457a459399) through /give or through building the unit normally, please confirm this.

~0006342

abma (administrator)

missing feedback :-/

~0006356

user744

hey, sorry late answer had forgotten about this one..

I think the crash was actually due to a missing wreck 3dobject in the unitdef.
That is now visible with Spring 0.82.7.1:
[f=0000252] WARNING: could not load model "objects3d/bgenericwreckage.s3o" (missing file?)
(0.82.7.1 gives that error in chat & and does not crash)

I still have 0.81 installed so tested again and 0.81 does just crash at this point.

So the reason why it worked from factory might have been because the unit was still a nanoframe when being killed and thus left no wreck. But with /give it was completed and then the missing wreck crashed it.
Now why it only crashed on this unit and not on any other unit that also have entries for non-existing wrecks, i dont know.

As I had already made a "non-crashing script version" and now know it was probally the wreck's fault, for me this issue is closed/resolved.
In case someone wants to have a closer look still, here is the mod:
http://www.file-upload.net/download-3195716/Brickcraft.sdd.zip.html

1) /give tpupgradewheels
script = [[selfkill_bugged.lua]],
0.82: killing itself works, missing wreck message
0.81: crash

2) /give tpupgradequadcannon
script = [[selfkill.lua]],
0.82: killing itself works, no error message
0.81: killing itself works, no error message

infolog with using /give on both units 0.82:
http://pastebin.com/B91dHvxa
+Notes

-Issue History
Date Modified Username Field Change
2010-12-21 07:50 user744 New Issue
2010-12-21 08:14 user744 Note Added: 0006112
2010-12-21 16:15 Kloot Note Added: 0006117
2010-12-21 16:15 Kloot Status new => feedback
2010-12-21 16:16 Kloot Note Edited: 0006117
2011-02-04 13:01 abma Note Added: 0006342
2011-02-04 13:01 abma Status feedback => resolved
2011-02-04 13:01 abma Resolution open => unable to reproduce
2011-02-04 13:01 abma Assigned To => abma
2011-02-07 09:28 user744 Note Added: 0006356
2011-02-07 09:28 user744 Status resolved => assigned
2011-02-07 09:28 user744 Resolution unable to reproduce => reopened
2011-02-07 23:16 Kloot Status assigned => resolved
2011-02-07 23:16 Kloot Fixed in Version => 0.82.7+git
2011-02-07 23:16 Kloot Resolution reopened => fixed
2011-02-07 23:17 Kloot Assigned To abma => Kloot
2011-02-07 23:17 Kloot Status resolved => assigned
2011-02-07 23:17 Kloot Resolution fixed => reopened
2011-02-07 23:17 Kloot Status assigned => resolved
2011-02-07 23:17 Kloot Resolution reopened => fixed
+Issue History