ff_d_plc_trash

Destroy the placeable’s inventory on close, with a small fire effect.

Turns a container placeable into a trash can: when it is closed with items inside, its whole inventory is destroyed and a small flame visual plays on it shortly after.

Scripts

OnClosed: ff_d_plc_trash

Source code

// @code

#include "ff_i_core"


// -----------------------------------------------------------------------------

//! @brief Destroy the content of the trash can.
//! @param oSelf The trash can.
void OnClose(object oSelf)
{
  if (GetIsInventoryEmpty(oSelf))
    return;

  effect eVis = EffectVisualEffect(VFX_IMP_FLAME_S);
  DelayCommand(0.7f, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oSelf));
  DestroyInventory(oSelf);
}


// -----------------------------------------------------------------------------

void main()
{
  int nEvent = GetCurrentlyRunningEvent();
  if (nEvent == EVENT_SCRIPT_PLACEABLE_ON_CLOSED)
    OnClose(OBJECT_SELF);
}