forked from Mirrors/openclonk
carry heavy: add option for scripters to skip pick up animation
This is probably not the cleanest solution but I needed one and could not think of a better option.install-platforms
parent
2b4e40e589
commit
d411f07fda
|
@ -158,10 +158,11 @@ private func LaunchEnemyAt(proplist prop_enemy, int wave_nr, int enemy_plr, prop
|
|||
{
|
||||
for (var inv in ForceToInventoryArray(prop_enemy.Inventory))
|
||||
{
|
||||
// Action hacking to instantly pick up carry heavy objects.
|
||||
enemy->SetAction("Jump");
|
||||
var inv_obj = enemy->CreateContents(inv);
|
||||
enemy->SetAction("Walk");
|
||||
// Special way to pick up carry heavy objects instantly.
|
||||
if (inv->~IsCarryHeavy() && (enemy->GetOCF() & OCF_CrewMember))
|
||||
inv_obj = enemy->CreateCarryHeavyContents(inv);
|
||||
else
|
||||
inv_obj = enemy->CreateContents(inv);
|
||||
// Infinite ammo.
|
||||
if (inv_obj)
|
||||
inv_obj->~SetInfiniteStackCount();
|
||||
|
|
|
@ -10,6 +10,16 @@ local lib_carryheavy_obj; // object beeing carried with carryheavy
|
|||
public func GetCarryHeavy() { return lib_carryheavy_obj; }
|
||||
public func IsCarryingHeavy() { return lib_carryheavy_obj != nil; }
|
||||
|
||||
|
||||
// Helper function to create carry heavy contents without doing the pick up animation.
|
||||
public func CreateCarryHeavyContents(id obj_id, int amount)
|
||||
{
|
||||
this.BlockCarryHeavyPickUpAnimation = true;
|
||||
var res = CreateContents(obj_id, amount);
|
||||
this.BlockCarryHeavyPickUpAnimation = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Overloads for Inventory */
|
||||
|
||||
// Check if we can carry a carry heavy object
|
||||
|
@ -173,7 +183,7 @@ private func DoLiftCarryHeavy(object obj)
|
|||
if (obj->Contained() != this)
|
||||
return;
|
||||
// If inside something or not walking, skip the animation
|
||||
if (Contained() || GetAction() != "Walk")
|
||||
if (Contained() || GetAction() != "Walk" || this.BlockCarryHeavyPickUpAnimation)
|
||||
return;
|
||||
AddEffect("IntLiftHeavy", this, 1, 1, this, nil, obj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue