#include "channel_include"
#include "cas_casinoinc"

const float COOLDOWN_SECONDS = 7200.0f; // 2 hours
const string LOC_COOLDOWN = "CAS_SEX_ANNOUNCE_COOLDOWN";

void main()
{
    object oUser = GetLastUsedBy();
    if (!GetIsObjectValid(oUser) || !GetIsPC(oUser)) return;

    // Cooldown check on the placeable itself
    if (GetLocalInt(OBJECT_SELF, LOC_COOLDOWN) == 1)
    {
        SendMessageToPC(oUser, "This announcer is cooling down. Try again later.");
        return;
    }

    // Fire the announcement
    BroadcasteMessageToCustomPublicChannel(
        oUser,
        "Someone has entered the gloryhole at the Casino of Coins.",
        CHANNEL_CUSTOM_PUBLIC_SEX, // 0x00000008
        FALSE                      // bAddChatSource (leave FALSE unless you want the username prefixed)
    );

    // Arm cooldown
    SetLocalInt(OBJECT_SELF, LOC_COOLDOWN, 1);
    DelayCommand(COOLDOWN_SECONDS, DeleteLocalInt(OBJECT_SELF, LOC_COOLDOWN));
}
