enemy.lslp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * sloodle_quiz_router.lsl
  3. * Part of the Sloodle project (www.sloodle.org)
  4. *
  5. * Copyright (c) 2011-06 contributors (see below)
  6. * Released under the GNU GPL v3
  7. * -------------------------------------------
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * All scripts must maintain this copyrite information, including the contributer information listed
  23. *
  24. * Contributors:
  25. * Paul Preibisch
  26. *
  27. * DESCRIPTION
  28. * This script will send messages to waiting quizServers. When a player enters the game, this router
  29. * sends a message to all listening quizServers asking if anyone is available.
  30. * The quiz servers will report if they are AVAILABLE or BUSY.
  31. * The router will select an available quizServer and then send that quizServer the id of the player.
  32. *
  33. * Contributors:
  34. * Edmund Edgar
  35. * Paul Preibisch
  36. */
  37. integer TIMELIMIT=60; //five minutes
  38. vector RED =<1.00000, 0.00000, 0.00000>;
  39. vector ORANGE=<1.00000, 0.43763, 0.02414>;
  40. vector YELLOW=<1.00000, 1.00000, 0.00000>;
  41. vector GREEN=<0.00000, 1.00000, 0.00000>;
  42. vector BLUE=<0.00000, 0.00000, 1.00000>;
  43. vector BABYBLUE=<0.00000, 1.00000, 1.00000>;
  44. vector PINK=<1.00000, 0.00000, 1.00000>;
  45. vector PURPLE=<0.57338, 0.25486, 1.00000>;
  46. vector BLACK= <0.00000, 0.00000, 0.00000>;
  47. vector WHITE= <1.00000, 1.00000, 1.00000>;
  48. vector AVCLASSBLUE= <0.06274,0.247058,0.35294>;
  49. vector AVCLASSLIGHTBLUG=<0.8549,0.9372,0.9686>;//#daeff7
  50. integer SLOODLE_ROUTER=-1639271139;
  51. integer SLOODLE_PLAYERSERVER=-1639271140;
  52. integer SLOODLE_DEREZ=-1639271141;
  53. list waitingToPlay;
  54. list playing;
  55. string hover;
  56. float alpha;
  57. explosion(key id){
  58. if (id==NULL_KEY){
  59. llParticleSystem ([]);
  60. return;
  61. }
  62. llParticleSystem ([
  63. PSYS_SRC_PATTERN,8,
  64. PSYS_PART_FLAGS,(0|PSYS_PART_EMISSIVE_MASK|PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_INTERP_SCALE_MASK|PSYS_PART_TARGET_POS_MASK),
  65. PSYS_PART_START_COLOR, <0.96,0.98,0.98>,
  66. PSYS_PART_END_COLOR, <0.40,0.83,0.89>,
  67. PSYS_PART_START_ALPHA, 0.58,
  68. PSYS_PART_END_ALPHA, 0.20,
  69. PSYS_PART_START_SCALE, <3.86,3.91,0>,
  70. PSYS_PART_END_SCALE, <3.89,3.82,0>,
  71. PSYS_SRC_BURST_SPEED_MIN, 1.11,
  72. PSYS_SRC_BURST_SPEED_MAX, 1.13,
  73. PSYS_SRC_ACCEL, <-8.15,-5.70,-10.00>,
  74. PSYS_SRC_OMEGA, <-8.99,-10.00,-10.00>,
  75. PSYS_SRC_ANGLE_END, 0.75,
  76. PSYS_SRC_ANGLE_BEGIN, 0.03,
  77. PSYS_PART_MAX_AGE, 1.20,
  78. PSYS_SRC_BURST_PART_COUNT, 1,
  79. PSYS_SRC_BURST_RATE, 0.00,
  80. PSYS_SRC_BURST_RADIUS, 1.56,
  81. PSYS_SRC_MAX_AGE, 0.00,
  82. PSYS_SRC_TEXTURE, "9c8eca51-53d5-42a7-bb58-cef070395db8",
  83. PSYS_SRC_TARGET_KEY, id
  84. ]);
  85. }
  86. playDieSound(){
  87. llTriggerSound("SND_JELLY_SQUISH",1.0);
  88. }
  89. default {
  90. state_entry() {
  91. llListen(SLOODLE_ROUTER, "", "", "");
  92. llListen(SLOODLE_PLAYERSERVER, "", "", "");
  93. llListen(SLOODLE_DEREZ, "", "", "");
  94. //llSetText("ready"+(string)llFrand(10), BLUE, 1);
  95. explosion(NULL_KEY);
  96. }
  97. touch_start(integer num_detected) {
  98. integer j;
  99. for (j=0;j<num_detected;j++){
  100. llRegionSay(SLOODLE_ROUTER, "ENEMY CLICKED|"+(string)llDetectedKey(j));
  101. }
  102. }
  103. listen(integer channel, string name, key id, string message) {
  104. list data = llParseString2List(message, ["|"], []);
  105. string cmd = llList2String(data,0);
  106. if (cmd=="EXPLODE"){
  107. llOwnerSay("message came in: "+message);
  108. explosion(llList2Key(data,1));
  109. state DIEING;
  110. }
  111. if (channel == SLOODLE_DEREZ){
  112. llDie();
  113. }
  114. }
  115. }
  116. state DIEING{
  117. state_entry() {
  118. llListen(SLOODLE_DEREZ, "", "", "");
  119. playDieSound();
  120. alpha=1;
  121. llSetTimerEvent(0.2);
  122. llMessageLinked(LINK_SET, -99, "DEAD", NULL_KEY);
  123. }
  124. listen(integer channel, string name, key id, string message) {
  125. if (channel == SLOODLE_DEREZ){
  126. llDie();
  127. }
  128. }
  129. timer() {
  130. alpha=alpha-0.1;
  131. llMessageLinked(LINK_SET, -99, "SET ALPHA|"+(string)alpha,NULL_KEY);
  132. llMessageLinked(LINK_THIS, -99, "SET ALPHA|"+(string)alpha,NULL_KEY);
  133. if (alpha<0){
  134. llSetTimerEvent(0);
  135. state restart;
  136. explosion(NULL_KEY);
  137. }
  138. integer num = llGetNumberOfPrims();
  139. integer j;
  140. for (j=0;j<num;j++){
  141. llSetLinkPrimitiveParamsFast(j,[PRIM_COLOR,ALL_SIDES,BLACK,alpha]);
  142. }
  143. }
  144. }
  145. state restart{
  146. state_entry() {
  147. llListen(SLOODLE_DEREZ, "", "", "");
  148. llSetTimerEvent(10);
  149. llParticleSystem([]);
  150. }
  151. listen(integer channel, string name, key id, string message) {
  152. if (channel == SLOODLE_DEREZ){
  153. llDie();
  154. }
  155. }
  156. timer() {
  157. //llMessageLinked(LINK_SET, -99, "SET ALPHA|"+(string)counter,NULL_KEY);
  158. integer num = llGetNumberOfPrims();
  159. integer j;
  160. for (j=0;j<num;j++){
  161. llSetLinkPrimitiveParamsFast(j,[PRIM_COLOR,ALL_SIDES,WHITE,1]);
  162. }
  163. llSetTimerEvent(0);
  164. state default;
  165. }
  166. }
  167. // Please leave the following line intact to show where the script lives in Git:
  168. // SLOODLE LSL Script Git Location: mod/interaction-1.0/objects/enemyrezzer/assets/enemy.lslp