ff_d_plc_sit

Make the user sit on the placeable.

Turns a placeable into a seat: the creature that uses it sits on it. Nothing happens if someone already sits on it.

Scripts

OnUsed: ff_d_plc_sit

Source code

// @code

#include "ff_i_core"


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

//! @brief Make the user sit, unless the seat is taken.
//! @param oSelf The seat.
void OnUsed(object oSelf)
{
  // Sit only if the seat is free.
  if (!GetIsObjectValid(GetSittingCreature(oSelf)))
    AssignCommand(GetLastUsedBy(), ActionSit(oSelf));
}


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

void main()
{
  int nEvent = GetCurrentlyRunningEvent();
  if (nEvent == EVENT_SCRIPT_PLACEABLE_ON_USED)
    OnUsed(OBJECT_SELF);
}