Skip to content
Permalink
Browse files

Grapple bow: Show hook in extra slot (#1768).

This will give you visible feedback if the hook is fired or not. Perfect for dual hook handling situations. Library_HasExtraSlot is used to show this but IsContainer returns false. This will prevent hook extraction using the interaction menu. Removing the hook from the grapple bow will cause errors (this should probably be taken care of sometime).
  • Loading branch information
Armag3ddon committed Jul 31, 2016
1 parent 0cbb476 commit 8966df8310aff44e279c808bce5ed2d8fc6a5b55
Showing with 15 additions and 7 deletions.
  1. +15 −7 planet/Objects.ocd/Items.ocd/Tools.ocd/GrappleBow.ocd/Script.c
@@ -5,18 +5,21 @@
@author Randrian
*/

// Display the hook on the inventory HUD
#include Library_HasExtraSlot
// Do mind that IsContainer is set to false, so the hook can't be taken out via the interaction menu (very important)
// See below for IsContainer

local is_aiming;
local animation_set;
local hook;
local hook_attach;


private func Initialize()
{
// The aiming animation is done by adjusting the animation position to fit the angle.
animation_set = {
AimMode = AIM_Position,
AimMode = AIM_Position,
AnimationAim = "CrossbowAimArms",
AnimationShoot = nil,
ShootTime = 20,
@@ -29,8 +32,7 @@ private func Initialize()
return;
}


/*-- Animations --*/
/*-- Clonk Animations --*/

public func GetCarrySpecial(object clonk)
{
@@ -55,7 +57,6 @@ public func GetAnimationSet() { return animation_set; }

public func HoldingEnabled() { return true; }


public func RejectUse(object clonk)
{
// Burned?
@@ -143,7 +144,6 @@ public func ControlUseCancel(object clonk, int x, int y)
return true;
}


/*-- Bow Mechanics --*/

public func SetHook(object new_hook)
@@ -212,6 +212,12 @@ public func LaunchProjectile()
_inherited(...);
}

func RejectCollect(id whatever, object hopefully_hook)
{
// The grapple bow will only its own hook, very picky thing
if (hopefully_hook != hook) return true;
return false;
}

/*-- Fire Effects --*/

@@ -239,7 +245,6 @@ private func Extinguishing()
return _inherited(...);
}


/*-- Animation functions --*/

public func Reset(object clonk)
@@ -249,13 +254,16 @@ public func Reset(object clonk)
StopAnimation(GetRootAnimation(6));
}

/* Anything else */

public func Hit()
{
Sound("Hits::GeneralHit?");
}

public func IsInventorProduct() { return true; }

func IsContainer() { return false; } // See above for explanation

/*-- Properties --*/

0 comments on commit 8966df8

Please sign in to comment.
You can’t perform that action at this time.