|
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
- This actor is already defined in GZDoom, there's no reason to define it again.
- In fact, trying to define an actor with the same name will cause an error (because it already exists).
- If you want to make your own version of this actor, use inheritance.
- Definitions for existing actors are put on the wiki for reference purpose only.
|
Fléchette
|
Actor type
|
Artifact
|
Game
|
(Hexen)
|
DoomEd Number
|
8000
|
Class Name
|
ArtiPoisonBag
|
Spawn ID
|
72
|
Identifier
|
T_ITEMFLECHETTE
|
Classes: Inventory→ArtiPoisonBag
→ArtiPoisonBag1
→ArtiPoisonBag2
→ArtiPoisonBag3
→ArtiPoisonBagGiver
→ArtiPoisonBagShooter
A collectible vial of green liquid which acts as a versatile support weapon for the player characters of Hexen. The item's subclasses provide the differing behaviours for the three Hexen player classes. The correct subclass is placed in the player's inventory when the item is picked up, based on the player class's Player.FlechetteType property.
- Note: Because this item itself is never actually placed in the player's inventory but replaced by one of its subclasses, it cannot be activated by the use artipoisonbag console command. A special useflechette command is provided instead, which activates the correct type of ArtiPoisonBag depending on the player's class.
|
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
|
class ArtiPoisonBag : Inventory
{
Default
{
+FLOATBOB
Inventory.DefMaxAmount;
Inventory.PickupFlash "PickupFlash";
+INVENTORY.INVBAR +INVENTORY.FANCYPICKUPSOUND
Inventory.Icon "ARTIPSBG";
Inventory.PickupSound "misc/p_pkup";
Inventory.PickupMessage "$TXT_ARTIPOISONBAG";
Tag "$TAG_ARTIPOISONBAG";
}
States
{
Spawn:
PSBG A -1;
Stop;
}
//============================================================================
//
// AArtiPoisonBag :: BeginPlay
//
//============================================================================
override void BeginPlay ()
{
Super.BeginPlay ();
// If a subclass's specific icon is not defined, let it use the base class's.
if (!Icon.isValid())
{
Icon = GetDefaultByType("ArtiPoisonBag").Icon;
}
}
//============================================================================
//
// GetFlechetteType
//
//============================================================================
private class<Actor> GetFlechetteType(Actor other)
{
class<Actor> spawntype = null;
PlayerPawn pp = PlayerPawn(other);
if (pp)
{
spawntype = pp.FlechetteType;
}
if (spawntype == null)
{
// default fallback if nothing valid defined.
spawntype = "ArtiPoisonBag3";
}
return spawntype;
}
//============================================================================
//
// AArtiPoisonBag :: HandlePickup
//
//============================================================================
override bool HandlePickup (Inventory item)
{
// Only do special handling when picking up the base class
if (item.GetClass() != "ArtiPoisonBag")
{
return Super.HandlePickup (item);
}
if (GetClass() == GetFlechetteType(Owner))
{
if (Amount < MaxAmount || sv_unlimited_pickup)
{
Amount += item.Amount;
if (Amount > MaxAmount && !sv_unlimited_pickup)
{
Amount = MaxAmount;
}
item.bPickupGood = true;
}
return true;
}
return false;
}
//============================================================================
//
// AArtiPoisonBag :: CreateCopy
//
//============================================================================
override Inventory CreateCopy (Actor other)
{
// Only the base class gets special handling
if (GetClass() != "ArtiPoisonBag")
{
return Super.CreateCopy (other);
}
class<Actor> spawntype = GetFlechetteType(other);
let copy = Inventory(Spawn (spawntype));
if (copy != null)
{
copy.Amount = Amount;
copy.MaxAmount = MaxAmount;
GoAwayAndDie ();
}
return copy;
}
}
See also
|
Note: This is legacy code, kept for archival purposes only. DECORATE is deprecated in GZDoom and is completely superseded by ZScript. GZDoom internally uses the ZScript definition above.
|
ACTOR ArtiPoisonBag : Inventory native
{
+FLOATBOB
Inventory.DefMaxAmount
Inventory.PickupFlash "PickupFlash"
+INVBAR
+FANCYPICKUPSOUND
Inventory.Icon "ARTIPSBG"
Inventory.PickupSound "misc/p_pkup"
Inventory.PickupMessage "$TXT_ARTIPOISONBAG" // "FLECHETTE"
Tag "$TAG_ARTIPOISONBAG"
States
{
Spawn:
PSBG A -1
Stop
}
}