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))
|
for (var inv in ForceToInventoryArray(prop_enemy.Inventory))
|
||||||
{
|
{
|
||||||
// Action hacking to instantly pick up carry heavy objects.
|
// Special way to pick up carry heavy objects instantly.
|
||||||
enemy->SetAction("Jump");
|
if (inv->~IsCarryHeavy() && (enemy->GetOCF() & OCF_CrewMember))
|
||||||
var inv_obj = enemy->CreateContents(inv);
|
inv_obj = enemy->CreateCarryHeavyContents(inv);
|
||||||
enemy->SetAction("Walk");
|
else
|
||||||
|
inv_obj = enemy->CreateContents(inv);
|
||||||
// Infinite ammo.
|
// Infinite ammo.
|
||||||
if (inv_obj)
|
if (inv_obj)
|
||||||
inv_obj->~SetInfiniteStackCount();
|
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 GetCarryHeavy() { return lib_carryheavy_obj; }
|
||||||
public func IsCarryingHeavy() { return lib_carryheavy_obj != nil; }
|
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 */
|
/* Overloads for Inventory */
|
||||||
|
|
||||||
// Check if we can carry a carry heavy object
|
// Check if we can carry a carry heavy object
|
||||||
|
@ -173,7 +183,7 @@ private func DoLiftCarryHeavy(object obj)
|
||||||
if (obj->Contained() != this)
|
if (obj->Contained() != this)
|
||||||
return;
|
return;
|
||||||
// If inside something or not walking, skip the animation
|
// If inside something or not walking, skip the animation
|
||||||
if (Contained() || GetAction() != "Walk")
|
if (Contained() || GetAction() != "Walk" || this.BlockCarryHeavyPickUpAnimation)
|
||||||
return;
|
return;
|
||||||
AddEffect("IntLiftHeavy", this, 1, 1, this, nil, obj);
|
AddEffect("IntLiftHeavy", this, 1, 1, this, nil, obj);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue