forked from Mirrors/openclonk
shovel: fix the Destruction functionality
Previously, it was checked incorrectly whether the action was "Dig". Then the check was thrown out completely in https://git.openclonk.org/openclonk.git/commit/39e86474fccbd54eb357175d2b8fbec5c60639ab - which did remove the warning but not solve the defect. This should be a proper fix. The shovel only does stuff when the user is digging AND actually using this very shovel for it.epoxy
parent
a390f8f248
commit
76ac759533
|
@ -7,12 +7,14 @@ private func Hit()
|
|||
|
||||
private func Destruction()
|
||||
{
|
||||
if (Contained())
|
||||
if (Contained()->GetAction())
|
||||
// Stop shoveling when using the shovel when it's destroyed.
|
||||
var user = Contained();
|
||||
if (user)
|
||||
if (user->GetAction() == "Dig" && user->~GetUsedObject() == this)
|
||||
{
|
||||
// We assume that the clonk digs with this shovel. If not, too bad. You stop shoveling.
|
||||
Contained()->SetAction("Walk");
|
||||
Contained()->SetComDir(COMD_Stop);
|
||||
user->CancelUse();
|
||||
user->SetAction("Walk");
|
||||
user->SetComDir(COMD_Stop);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue