wolfSink
Wolf Territoriesinteger wolfSink(integer end, float seconds, integer after, float after_seconds, integer effects)
Sinks the boat this script is in: it floods and lists, goes down bow first (WOLF_SINK_BOW), stern first (WOLF_SINK_STERN) or on an even keel (WOLF_SINK_LEVEL) over `seconds` (5 to 120; 0 = 20) and settles on the seabed. Everyone sitting on it is stood up and left floating at the surface. Then, `after_seconds` (10 to 3600) later: WOLF_SINK_STAY (stays a wreck until wolfRestoreBoat), WOLF_SINK_RESTORE (back afloat as it was), WOLF_SINK_RETURN (back to the owner's inventory) or WOLF_SINK_DELETE (gone). effects: WOLF_SINK_BUBBLES and/or WOLF_SINK_DEBRIS particles. It must be over water and the owner allowed to build there. Returns 1, or 0 with wolfGetLastError saying why. Defined on Wolf_Api.wolfSink / WolfWreck.
Sinks the boat the script is in, like a real ship going down. It floods and settles lower in the water with a list to one side, goes under bow first, stern first or on an even keel, and comes to rest on the seabed, tilted as a wreck would lie. Everyone sitting on it is stood up and left floating at the surface; nobody is dragged down with it. Bubbles and bits of debris can go with it. Afterwards it can stay down as a wreck, come back up exactly as it was, go back to your inventory (Lost and Found) or be removed, a set time after it reaches the seabed. The region moves it itself, so every viewer sees it go down smoothly and it works the same whichever physics engine the region runs; a physical boat is made non-physical for the sinking and physical again when it comes back. The boat must be over water (not aground) and you must be allowed to build where it is. The bow is the root prim's forward end (+X), as for vehicles. Returns 1, or 0 with wolfGetLastError saying why. Regions take it up as they restart onto the new release.
Parameters
| Type | Name | What it does |
|---|---|---|
| integer | end | WOLF_SINK_BOW (bow first), WOLF_SINK_STERN (stern first) or WOLF_SINK_LEVEL (on an even keel, rolling over). |
| float | seconds | How long it takes from the first flooding to resting on the seabed, 5 to 120. 0 = 20. |
| integer | after | What happens once it is down: WOLF_SINK_STAY (stays a wreck until wolfRestoreBoat), WOLF_SINK_RESTORE (back afloat as it was), WOLF_SINK_RETURN (back to your inventory) or WOLF_SINK_DELETE (gone, like a temporary boat). |
| float | after_seconds | Seconds on the seabed before "after" happens, 10 to 3600. Not used with WOLF_SINK_STAY. |
| integer | effects | 0, WOLF_SINK_BUBBLES (bubbles rising round the hull), WOLF_SINK_DEBRIS (a burst of bits of the boat), or both: WOLF_SINK_BUBBLES | WOLF_SINK_DEBRIS. |
Example
// Sinking boat - Wolf Territories, wolfSink / wolfRestoreBoat.
//
// Put this script in your boat, next to its own engine script. Say on channel 7:
// /7 sink the boat floods, lists, goes down bow first and settles on the seabed, with bubbles
// and debris; everyone aboard is stood up and left floating at the surface.
// Five minutes later it comes back up by itself.
// /7 raise bring it back up now, exactly where and how it was (and cancel the timed one).
//
// Rules the grid keeps: only over water (not aground), only where you may build, and only your
// own boat (the script's owner). A boat sunk with WOLF_SINK_STAY stays a wreck until /7 raise.
// Other ways to end: WOLF_SINK_RETURN (back to your inventory) or WOLF_SINK_DELETE (gone, like a
// temporary boat from a rezzer).
integer CHANNEL = 7;
default
{
state_entry()
{
llListen(CHANNEL, "", llGetOwner(), "");
}
on_rez(integer p)
{
llResetScript();
}
listen(integer ch, string name, key id, string msg)
{
msg = llToLower(llStringTrim(msg, STRING_TRIM));
if (msg == "sink")
{
// end, seconds to go down, what happens afterwards, how long afterwards, effects
if (!wolfSink(WOLF_SINK_BOW, 25.0, WOLF_SINK_RESTORE, 300.0, WOLF_SINK_BUBBLES | WOLF_SINK_DEBRIS))
llOwnerSay("It will not sink: " + wolfGetLastError());
}
else if (msg == "raise")
{
if (!wolfRestoreBoat())
llOwnerSay("Cannot raise it: " + wolfGetLastError());
}
}
}A rezzer boat that sinks and is gone after a minute
wolfSink(WOLF_SINK_STERN, 20.0, WOLF_SINK_DELETE, 60.0, WOLF_SINK_BUBBLES);
A wreck that stays on the seabed
wolfSink(WOLF_SINK_BOW, 40.0, WOLF_SINK_STAY, 0.0, WOLF_SINK_BUBBLES | WOLF_SINK_DEBRIS);
Ours alone. Grid features you will not find on any other OpenSimulator grid.