patreon controller screens

main
Samantha Wright 2024-10-03 18:41:31 -07:00
parent bb3367b58a
commit d4f64c02e0
5 changed files with 666 additions and 54 deletions

View File

@ -6,7 +6,7 @@
*
* =========================================================================
*
* YS-712 XSU Hardware Driver
* VAR/I Analyte Hardware Driver
*
* This program is covered under the terms of the ARES Software Copyright
* License, Section 3 (ASCL-iii). It may be redistributed or used as the

View File

@ -12,3 +12,4 @@
#define SCREEN_REVENANT 6
#define SCREEN_AIDE 7
#define SCREEN_DAX3 8
#define SCREEN_DAYBREAK 9

View File

@ -65,6 +65,7 @@
SCREEN_REVENANT - projected hybrid display with accessory positioning HUD
SCREEN_DAX3 - cylindrical image is on the outside of a tube prim with path cut 0.3625 to 0.6375 (centered at 0.5)
SCREEN_AEGIS - concave cylindrical display and lever-action hinge
SCREEN_DAYBREAK - only the background prim exists; non-interactive
*/
#if SCREEN_TYPE == SCREEN_SUPERVISOR
@ -243,6 +244,10 @@ float lubricant = 1.0;
integer opo;
integer obo;
#ifndef SOCKET_NAME
#define SOCKET_NAME "socket"
#endif
integer FAN;
integer POWER_GAUGE;
integer RATE_GAUGE;
@ -269,7 +274,7 @@ integer door_open;
integer soothe;
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE || SCREEN_TYPE == SCREEN_DAYBREAK
// on these screen types only, suppress beep from displaying menu after session start
integer silence_menu;
#endif
@ -335,7 +340,11 @@ integer timer_spark;
#define play_sound(_name) llTriggerSound(getjs(sounds, [_name]), (float)getjs(sounds, ["volume"]))
#if SCREEN_TYPE != SCREEN_NONE
#if SCREEN_TYPE == SCREEN_DAYBREAK
clear_screen(integer partial) {
}
#elif SCREEN_TYPE != SCREEN_NONE
clear_screen(integer partial) {
// #define ALIGN_TEXT
integer pmax = llGetNumberOfPrims();
@ -753,7 +762,7 @@ default {
operate_door();
}
#endif
#if SCREEN_TYPE != SCREEN_NONE
#if (SCREEN_TYPE != SCREEN_NONE) && (SCREEN_TYPE != SCREEN_DAYBREAK)
} else if(part == "text" && power_on) {
list ps = llParseString2List(gets(getp(pi, [PRIM_DESC]), 0), ["T", ","], []);
integer row = (integer)gets(ps, 0);
@ -895,7 +904,7 @@ default {
tell(system, c, "conf-get interface.sound");
tell(system, c, "conf-get hardware.controller");
#ifndef OVERRIDE_TOUCH
#if SCREEN_TYPE != SCREEN_NONE
#if SCREEN_TYPE != SCREEN_NONE && SCREEN_TYPE != SCREEN_DAYBREAK
tell(system, c, "menu start " + (string)avatar); // menu <session> get|touch|... [<button>] <uuid>
#endif
#endif
@ -1238,8 +1247,13 @@ default {
linked(LINK_THIS, 0, "menu-close", "");
#endif
clear_screen(FALSE);
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE
setp(SCREEN, [PRIM_TEXTURE, ALL_SIDES, llGetInventoryKey("m_boot"), ONES, ZV, 0
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE || SCREEN_TYPE == SCREEN_DAYBREAK
setp(SCREEN, [PRIM_TEXTURE, ALL_SIDES, llGetInventoryKey("m_boot"), ONES, ZV,
#if SCREEN_TYPE == SCREEN_DAYBREAK
PI_BY_TWO
#else
0
#endif
#ifdef FULL_COLOR_BOOT
, PRIM_COLOR, ALL_SIDES, ONES, 1
#endif
@ -1284,7 +1298,7 @@ default {
]);
#endif
} else {
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE || SCREEN_TYPE == SCREEN_DAYBREAK
if(silence_menu) {
silence_menu = 0;
} else {
@ -1294,8 +1308,13 @@ default {
play_sound("go");
#endif
clear_screen(TRUE);
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE
setp(SCREEN, [PRIM_TEXTURE, ALL_SIDES, llGetInventoryKey("m_main"), ONES, ZV, 0
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE || SCREEN_TYPE == SCREEN_DAYBREAK
setp(SCREEN, [PRIM_TEXTURE, ALL_SIDES, llGetInventoryKey("m_main"), ONES, ZV,
#if SCREEN_TYPE == SCREEN_DAYBREAK
PI_BY_TWO
#else
0
#endif
#ifdef FULL_COLOR_BOOT
, PRIM_COLOR, ALL_SIDES, c4, 1
#endif
@ -1344,50 +1363,52 @@ default {
}
#endif
if(menu_name != "end"
#if SCREEN_TYPE == SCREEN_SUPERVISOR || SCREEN_TYPE == SCREEN_PLANAR || SCREEN_TYPE == SCREEN_DAX3 || SCREEN_TYPE == SCREEN_AEGIS || SCREEN_TYPE == SCREEN_NIGHTFALL
// hide text from the boot screen?
&& menu_name != "boot"
#endif
) {
list lines = splitnulls(m, "\n");
string l1 = gets(lines, 1);
#if SCREEN_TYPE == SCREEN_PLANAR || defined(ALTER_MENU_IDENTIFIER)
if(substr(l1, 0, 31) == " Command Interface")
l1 = "ARES" + substr(l1, 14, LAST);
#if SCREEN_TYPE != SCREEN_DAYBREAK
if(menu_name != "end"
#if SCREEN_TYPE == SCREEN_SUPERVISOR || SCREEN_TYPE == SCREEN_PLANAR || SCREEN_TYPE == SCREEN_DAX3 || SCREEN_TYPE == SCREEN_AEGIS || SCREEN_TYPE == SCREEN_NIGHTFALL
// hide text from the boot screen?
&& menu_name != "boot"
#endif
#ifdef ALL_CAPS
variatype(llToUpper(l1), TEXT_START, 12);
variatype(llToUpper(gets(lines, 3)), TEXT_START + 6, 12);
variatype(llToUpper(gets(lines, 2)), TEXT_START + 60, 6);
#else
variatype(l1, TEXT_START, 12);
variatype(gets(lines, 3), TEXT_START + 6, 12);
variatype(gets(lines, 2), TEXT_START + 60, 6);
#endif
integer lmax = button_count = count(lines) - 4;
integer li = 0;
integer max_width = 6;
if(lmax > 16)
max_width = 2;
else if(lmax > 8)
max_width = 3;
// integer max_width = 6 / (integer)(lmax / 8);
while(li < lmax) {
integer li_y = li % 8 + 2;
integer li_col = (li >> 3) * max_width;
#ifdef ALL_CAPS
variatype(llToUpper(gets(lines, li + 4)), TEXT_START + (li_y * 6 + li_col), max_width);
#else
variatype(gets(lines, li + 4), TEXT_START + (li_y * 6 + li_col), max_width);
) {
list lines = splitnulls(m, "\n");
string l1 = gets(lines, 1);
#if SCREEN_TYPE == SCREEN_PLANAR || defined(ALTER_MENU_IDENTIFIER)
if(substr(l1, 0, 31) == " Command Interface")
l1 = "ARES" + substr(l1, 14, LAST);
#endif
++li;
#ifdef ALL_CAPS
variatype(llToUpper(l1), TEXT_START, 12);
variatype(llToUpper(gets(lines, 3)), TEXT_START + 6, 12);
variatype(llToUpper(gets(lines, 2)), TEXT_START + 60, 6);
#else
variatype(l1, TEXT_START, 12);
variatype(gets(lines, 3), TEXT_START + 6, 12);
variatype(gets(lines, 2), TEXT_START + 60, 6);
#endif
integer lmax = button_count = count(lines) - 4;
integer li = 0;
integer max_width = 6;
if(lmax > 16)
max_width = 2;
else if(lmax > 8)
max_width = 3;
// integer max_width = 6 / (integer)(lmax / 8);
while(li < lmax) {
integer li_y = li % 8 + 2;
integer li_col = (li >> 3) * max_width;
#ifdef ALL_CAPS
variatype(llToUpper(gets(lines, li + 4)), TEXT_START + (li_y * 6 + li_col), max_width);
#else
variatype(gets(lines, li + 4), TEXT_START + (li_y * 6 + li_col), max_width);
#endif
++li;
}
}
}
#endif
#endif
} else if(cmd == "integrity") {
// integrity <integrity> <chassis-strength-multiplier> <remaining-durability>
@ -1468,7 +1489,7 @@ default {
POWER_GAUGE = pi;
else if(pn == "rate_gauge")
RATE_GAUGE = pi;
else if(pn == "socket")
else if(pn == SOCKET_NAME)
SOCKET = pi;
else if(pn == "speaker") {
llLinkSetSoundQueueing(pi, TRUE);
@ -1518,8 +1539,13 @@ default {
#if SCREEN_TYPE != SCREEN_NONE
clear_screen(FALSE);
if(SCREEN) {
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE || SCREEN_TYPE == SCREEN_PLANAR
setp(SCREEN, [PRIM_TEXTURE, ALL_SIDES, llGetInventoryKey("m_boot"), ONES, ZV, 0
#if SCREEN_TYPE == SCREEN_SXD || SCREEN_TYPE == SCREEN_AIDE || SCREEN_TYPE == SCREEN_PLANAR || SCREEN_TYPE == SCREEN_DAYBREAK
setp(SCREEN, [PRIM_TEXTURE, ALL_SIDES, llGetInventoryKey("m_boot"), ONES, ZV,
#if SCREEN_TYPE == SCREEN_DAYBREAK
PI_BY_TWO
#else
0
#endif
#ifdef FULL_COLOR_BOOT
, PRIM_COLOR, 1, ONES, 1
#endif

View File

@ -0,0 +1,209 @@
/* =========================================================================
*
* Nanite Systems Advanced Research Encapsulation System
*
* Copyright (c) 20222024 Nanite Systems Corporation
*
* =========================================================================
*
* VAR/H Metropolis Hardware Driver
*
* This program is covered under the terms of the ARES Software Copyright
* License, Section 3 (ASCL-iii). It may be redistributed or used as the
* basis of commercial, closed-source products so long as steps are taken
* to ensure proper attribution as defined in the text of the license.
*
* To see the full text of the ASCL, type 'help license' on any standard
* ARES distribution, or visit http://nanite-systems.com/ASCL for the
* current version.
*
* DISCLAIMER
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS
* IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DAMAGES HOWEVER CAUSED ON ANY THEORY OF LIABILITY ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* =========================================================================
*
*/
#include <utils.lsl>
#include <objects.lsl>
vector base_c = <0, 0.5, 1>;
vector c4 = <0, 0.75, 1>;
integer open;
integer power_on;
float scale = 1.0;
#define step 0.1
#define span -2.4
#define original_size 0.114149
operate_door() {
vector s = llGetScale();
scale = s.x / original_size;
vector so = getv(getp(2, [PRIM_POS_LOCAL]), 0);
float polarity = 1;
if(open) {
polarity = -1;
llTriggerSound("3f075de9-738c-1b1e-ae67-8149a84647ee", 1);
} else {
llTriggerSound("0c205a19-ebd7-7195-7e8e-426b1bda48d4", 1);
}
llTriggerSound("10722bf0-fdac-2497-3b2c-f6d9e6625f7c", 1);
float initial = span * open;
float target = (span * (1 - open)) - initial;
float i;
float r;
#define ioff 0.0073
#define doff 0.0078
vector vo = so + <0, 0, 0.0317 - doff>;
for(i = 0; i <= 1 + step; i += step) {
r = i * target + initial;
list f = [];
integer p = 6;
while(p--) {
rotation r0 = llEuler2Rot(<180, 180, p * 60 + 30> * DEG_TO_RAD);
rotation r1 = llEuler2Rot(<0, r, 0>);
vector v = <-0.014654 - ioff, 0, 0>;
f += [
PRIM_LINK_TARGET, p + 22,
PRIM_POS_LOCAL, (<ioff, 0, doff> * r1 + v) * scale * r0 + vo,
PRIM_ROT_LOCAL, r1 * r0
];
}
setp(0, f);
}
if(open)
llTriggerSound("d24539cd-0dd0-c0c3-99c2-3421fdbf5656", 1);
else
llTriggerSound("2227d6ea-fe24-dd2f-fb1e-a31e1531b402", 1);
open = !open;
// linked(LINK_THIS, 109, (string)open, "");
/*
r = open * span;
left_rot = llEuler2Rot(<r, 0, 0>);
right_rot = llEuler2Rot(<-r, 0, 0>);
llSetLinkPrimitiveParams(0, [
PRIM_LINK_TARGET, L,
PRIM_POS_LOCAL, door_L_pos * scale + door_L_hinge * scale * r * left_rot + door_L_extend * scale * open,
PRIM_ROT_LOCAL, ZERO_ROTATION * left_rot,
PRIM_LINK_TARGET, R,
PRIM_POS_LOCAL, door_R_pos * scale + door_R_hinge * scale * r * right_rot + door_R_extend * scale * open,
PRIM_ROT_LOCAL, ZERO_ROTATION * right_rot
]); */
}
key hatch_operator;
default {
state_entry() {
llSetMemoryLimit(0x8000);
}
touch_start(integer n) {
while(n--) {
key toucher = llDetectedKey(n);
integer pi = llDetectedLinkNumber(n);
string part = llGetLinkName(pi);
if(part == "lid" && !power_on) {
linked(LINK_THIS, 0, "touch-hatch", toucher);
if(open) {
hatch_operator = toucher;
integer CL = 105 - (integer)("0x" + substr(llGetOwner(), 29, 35));
tell(llGetOwner(), CL, "hatch-blocked-q");
llSetTimerEvent(0.75);
} else {
operate_door();
}
} else {
// if "Object" || ("lid" && power_on)
linked(LINK_THIS, 0, "menu-request", toucher);
/*if(!power_on) {
} else {
linked(LINK_THIS, 0, "menu-start", toucher);
}*/
}
}
}
timer() {
operate_door();
llSetTimerEvent(0);
}
link_message(integer s, integer n, string m, key id) {
if(n == 1) {
// non-light-bus messages
if(m == "door 1") {
if(open)
operate_door();
} else if(m == "door 0") {
if(!open)
operate_door();
}
} else {
if(m == "on") {
power_on = 1;
} else if(m == "off") {
power_on = 0;
// damp(0);
} else if(m == "hatch-blocked") {
// tell(hatch_operator, 0, "Cannot close hatch while ejected battery is present.");
llSetTimerEvent(0);
} else {
list argv = split(m, " ");
string cmd = gets(argv, 0);
/*if(cmd == "fan") {
fan = (float)gets(argv, 1);
damp(rate * 0.001 + fan * 0.5);
} else*/
if(cmd == "color") {
base_c = (vector)concat(delitem(argv, 0), " ");
/* if(screen_open)
screen_control(TRUE); */
} else if(cmd == "color-4") {
c4 = (vector)concat(delitem(argv, 0), " ");
}
/*else if(cmd == "rate") {
rate = (float)gets(argv, 1);
if(rate > 0)
power_on = 1;
// damp(rate * 0.001 + fan * 0.5);
}*/
}
}
}
}

View File

@ -0,0 +1,376 @@
/* =========================================================================
*
* Nanite Systems Advanced Research Encapsulation System
*
* Copyright (c) 20222024 Nanite Systems Corporation
*
* =========================================================================
*
* NS-476 Aegis Hardware Driver
*
* This program is covered under the terms of the ARES Software Copyright
* License, Section 3 (ASCL-iii). It may be redistributed or used as the
* basis of commercial, closed-source products so long as steps are taken
* to ensure proper attribution as defined in the text of the license.
*
* To see the full text of the ASCL, type 'help license' on any standard
* ARES distribution, or visit http://nanite-systems.com/ASCL for the
* current version.
*
* DISCLAIMER
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS
* IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DAMAGES HOWEVER CAUSED ON ANY THEORY OF LIABILITY ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* =========================================================================
*
*/
#include <utils.lsl>
#include <objects.lsl>
vector base_c = <0, 0.5, 1>;
vector c4 = <0, 0.75, 1>;
#define SCREEN 5
// #define SCREEN_2 8
// #define SCREEN_3 9
#define SCREEN_CONE 6
#define TEXT_START 7
#define TEXT_COUNT 66
#define LID 73
#define LOGO 74
integer screen_open = FALSE;
#define X_STEP (1.0/15.0)
#define Y_STEP (1.0/52.0)
#define X_BIAS -2.5
#define Y_BIAS -5.0
#define projection_magnitude 0.5
key system;
integer CL;
screen_control(integer open) {
list acts;
if(open) {
if(power_on && !door_open)
operate_door();
vector scale = <0, 5 * X_STEP, 3 * X_STEP>;
integer pn = TEXT_START;
vector screen_origin = <0, 0.625, 0.0>;
acts += [
PRIM_LINK_TARGET, SCREEN,
PRIM_SIZE, <projection_magnitude * 0.5, projection_magnitude, projection_magnitude> * 1.05,
PRIM_POS_LOCAL, screen_origin,
/*PRIM_LINK_TARGET, SCREEN_2,
PRIM_SIZE, <0.24, 0.06, 0.06>,
PRIM_POS_LOCAL, screen_origin + <-0.05, 0, 0.18>,
PRIM_LINK_TARGET, SCREEN_3,
PRIM_SIZE, <0.24, 0.06, 0.06>,
PRIM_POS_LOCAL, screen_origin + <-0.05, 0, -0.18>, */
PRIM_LINK_TARGET, SCREEN_CONE,
PRIM_SIZE, <projection_magnitude * 0.5, projection_magnitude, projection_magnitude> * 1.05,
PRIM_POS_LOCAL, screen_origin + <0, 0, -0.001>,
PRIM_COLOR, ALL_SIDES, base_c, 0.05,
PRIM_LINK_TARGET, 1,
PRIM_COLOR, 1, base_c, 1,
PRIM_FULLBRIGHT, 1, TRUE,
PRIM_GLOW, 1, 0.2
];
rotation post_R = llEuler2Rot(<PI_BY_TWO, PI, 0>);
while(pn < TEXT_START + TEXT_COUNT) {
integer tx = (pn - TEXT_START) % 6;
integer ty = (pn - TEXT_START) / 6;
float x = (float)tx + X_BIAS;
float dy = 10 - ty;
float secondary_scale = 1.0;
if(dy == 9) {
dy = 9.25;
secondary_scale = 1;
} else if(dy == 0) {
dy = -0.25;
secondary_scale = 1;
} else if(dy == 10) {
dy = 10.5;
secondary_scale = 1;
}
float y = (float)(dy) + Y_BIAS;
rotation R = llEuler2Rot(<0, 0.17075 * -x * PI_BY_TWO, 0>);
acts += [
PRIM_LINK_TARGET, pn,
// PRIM_DESC, "T" + (string)ty + "," + (string)tx,
PRIM_SIZE, scale * secondary_scale,
PRIM_POS_LOCAL, (<0, y * Y_STEP, 0.025 * secondary_scale * secondary_scale> * secondary_scale - <0, 0, projection_magnitude * 0.55>) * R * post_R + screen_origin,
PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_MASK, 128,
// PRIM_ALPHA_MODE, ALL_SIDES, PRIM_ALPHA_MODE_BLEND, 128,
PRIM_ROT_LOCAL, llEuler2Rot(<-PI_BY_TWO, 0, PI_BY_TWO>) * R * post_R
//,
//PRIM_COLOR, ALL_SIDES, ONES, 1
];
++pn;
if(llGetFreeMemory() < 256) {
setp(0, acts);
acts = [];
}
}
setp(0, acts);
} else {
integer pn = TEXT_START;
vector screen_origin = <0, 0, 0.25>;
acts += [
PRIM_LINK_TARGET, SCREEN,
PRIM_SIZE, ZV,
PRIM_POS_LOCAL, ZV,
/*PRIM_LINK_TARGET, SCREEN_2,
PRIM_SIZE, ZV,
PRIM_POS_LOCAL, ZV,
PRIM_LINK_TARGET, SCREEN_3,
PRIM_SIZE, ZV,
PRIM_POS_LOCAL, ZV,*/
PRIM_LINK_TARGET, SCREEN_CONE,
PRIM_SIZE, ZV,
PRIM_POS_LOCAL, ZV,
PRIM_LINK_TARGET, 1,
PRIM_COLOR, 1, ZV, 1,
PRIM_FULLBRIGHT, 1, FALSE,
PRIM_GLOW, 1, 0
];
while(pn < TEXT_START + TEXT_COUNT) {
integer tx = (pn - TEXT_START) % 6;
integer ty = (pn - TEXT_START) / 6;
float x = (float)tx - 2.5;
float dy = 10 - ty;
if(dy == 9)
dy = 9.25;
else if(dy == 0)
dy = -0.25;
else if(dy == 10)
dy = 10.5;
float y = (float)(dy) - 5.5;
acts += [
PRIM_LINK_TARGET, pn,
// PRIM_DESC, "T" + (string)ty + "," + (string)tx,
PRIM_SIZE, ZV,
PRIM_POS_LOCAL, ZV
// PRIM_ROT_LOCAL, ZR,
// PRIM_COLOR, ALL_SIDES, ONES, 1
];
++pn;
if(llGetFreeMemory() < 256) {
setp(0, acts);
acts = [];
}
}
setp(0, acts);
if(door_open)
operate_door();
}
screen_open = open;
// echo("screen now " + (string)open);
}
integer power_on;
#define DOOR_MOVE_SOUND "c4f9e160-641f-b61d-7b9e-0bc9d4ac0ea1"
integer door_open;
operate_door() {
llLinkPlaySound(LID, DOOR_MOVE_SOUND, 1, SOUND_PLAY);
if(door_open && !power_on)
tell(system, CL, "door 0");
// door_open = 1;
door_open = !door_open;
float sign = (float)(door_open << 1) - 1.0;
float hi = 0;
list lid_props = getp(LID, [PRIM_SIZE, PRIM_POS_LOCAL, PRIM_ROT_LOCAL]);
list lid2_props = getp(LOGO, [PRIM_SIZE]);
vector lids = getv(lid_props, 0);
vector lidp = getv(lid_props, 1);
rotation lidr = getr(lid_props, 2);
vector lido = <0, lids.y * -0.5, lids.z * -0.5>;
vector lid2s = getv(lid2_props, 0);
vector lid2o = <0, -0.01, -0.01125>;
float lid2_scale_factor = lid2s.y / 0.0246600;
rotation postR_logo = llEuler2Rot(<0, 0, PI>);
while(hi <= 1) {
rotation lidnr = llEuler2Rot(<120 * DEG_TO_RAD * hi * sign, 0, 0>);
rotation lid2nr = llEuler2Rot(<120 * DEG_TO_RAD * hi * sign, 0, 0>);
setp(LID, [
PRIM_POS_LOCAL, lidp + (lido - lido * lidnr) * lidr,
PRIM_ROT_LOCAL, lidnr * lidr,
PRIM_LINK_TARGET, LOGO,
PRIM_POS_LOCAL, lidp + (lido - (lid2o * lid2_scale_factor + lido) * lidnr) * lidr,
PRIM_ROT_LOCAL, postR_logo * lidnr * lidr
]);
hi += 0.1;
llSleep(0.022);
}
if(door_open && !power_on)
tell(system, CL, "door 1");
}
integer timer_close_hatch;
default {
state_entry() {
// llLinkStopSound(LINK_SET);
llSetLinkTextureAnim(SCREEN_CONE, ANIM_ON | SMOOTH | LOOP | PING_PONG, ALL_SIDES, 0, 0, 0, 1, 100);
llSetLinkTextureAnim(SCREEN, ANIM_ON | SMOOTH | LOOP | PING_PONG, 1, 0, 0, 0, 1, 100);
llSetMemoryLimit(0x8000);
#ifdef TEST_SCREEN
power_on = 1;
screen_control(TRUE);
linked(LINK_THIS, 0, "menu-start", "");
#else
screen_control(FALSE);
linked(LINK_THIS, 0, "menu-end", "");
#endif
// damp(0);
/* echo(llGetLinkName(HOSE_L));
echo(llGetLinkName(HOSE_R)); */
// damp(0.0);
/*integer pn = llGetNumberOfPrims();
while(pn--) {
echo((string)pn + " = " + llGetLinkName(pn));
}*/
}
touch_start(integer n) {
while(n--) {
key toucher = llDetectedKey(n);
integer pi = llDetectedLinkNumber(n);
string part = llGetLinkName(pi);
if(part == "lid" && !power_on) {
if(door_open) {
timer_close_hatch = 1;
// tell(llGetOwner(), CL, "hatch-blocked-q");
linked(LINK_THIS, 0, "touch-hatch", toucher);
llSetTimerEvent(0.75);
} else {
operate_door();
}
//operate_door();
} else if(part == "text" && power_on) {
linked(LINK_THIS, pi, "touch-screen", toucher);
} else if(part == "lid" && power_on) {
if(door_open && screen_open) {
screen_control(FALSE);
} else {
linked(LINK_THIS, 0, "menu-start", toucher);
screen_control(TRUE);
}
} else if(part == "screen") {
} else {
// if "Object" || ("lid" && power_on)
if((power_on && screen_open) || !power_on) {
linked(LINK_THIS, 0, "menu-request", toucher);
} else {
linked(LINK_THIS, 0, "menu-request", toucher);
/*
linked(LINK_THIS, 0, "menu-start", toucher);
screen_control(TRUE);
*/
}
}
}
}
timer() { // hatch open
llSetTimerEvent(0);
if(door_open && timer_close_hatch && !power_on)
operate_door();
timer_close_hatch = 0;
}
link_message(integer s, integer n, string m, key id) {
// echo("supervisor screen: " + m);
if(m == "hatch-blocked") {
llSetTimerEvent(0);
timer_close_hatch = 0;
} else if(m == "on") {
timer_close_hatch = 0;
llSetTimerEvent(0);
power_on = 1;
system = id;
CL = 105 - (integer)("0x" + substr(llGetOwner(), 29, 35));
} else if(m == "off") {
power_on = 0;
system = id;
CL = 105 - (integer)("0x" + substr(llGetOwner(), 29, 35));
screen_control(FALSE);
linked(LINK_THIS, 0, "menu-end", "");
// damp(0);
} else if(m == "menu-open") {
if(!screen_open)
screen_control(TRUE);
} else if(m == "menu-close") {
system = id;
screen_control(FALSE);
linked(LINK_THIS, 0, "menu-end", "");
} else {
list argv = split(m, " ");
string cmd = gets(argv, 0);
/*if(cmd == "fan") {
fan = (float)gets(argv, 1);
damp(rate * 0.001 + fan * 0.5);
} else*/
if(cmd == "color") {
base_c = (vector)concat(delitem(argv, 0), " ");
/* if(screen_open)
screen_control(TRUE); */
} else if(cmd == "color-4") {
c4 = (vector)concat(delitem(argv, 0), " ");
if(screen_open)
screen_control(TRUE);
}
/*else if(cmd == "rate") {
rate = (float)gets(argv, 1);
if(rate > 0)
power_on = 1;
// damp(rate * 0.001 + fan * 0.5);
}*/
}
}
}