removed useless _ folders
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<Solution name="Opensim exploding wall and grenade">
|
||||
<Project name="Opensim exploding wall and grenade" path="Opensim exploding wall and grenade\Opensim exploding wall and grenade.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,100 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:01
|
||||
// :EDITED:2015-04-23 12:48:01
|
||||
// :ID:1076
|
||||
// :NUM:1743
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// This script is goes into a brick
|
||||
|
||||
// :CODE:
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
integer ExplosionChannel = -1337;
|
||||
integer listenHandle;
|
||||
// float explosionDistance; // unused fkb
|
||||
// vector impulseDirection; / unused fkb
|
||||
float blastRadius = 2.0;
|
||||
integer counter = 0;
|
||||
integer superCounter = 0;
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
listenHandle = llListen(ExplosionChannel, "", "", "");
|
||||
}
|
||||
listen (integer channel, string name, key id, string message)
|
||||
{
|
||||
list messageList = llParseString2List(message, ["|"], []);// Parse Message to get greande position and explosion force
|
||||
//llSay(0, messageList(0));
|
||||
vector grenadeLocation = llList2Vector(messageList, 0); // Grenade position is in the first cell of the list
|
||||
float explosionForce = (float)llList2String(messageList, 1); // Explosion force value is in the second cell of the list
|
||||
vector objectLocation = llGetPos();
|
||||
/*explosionDistance = llVecDist(grenadeLocation, objectLocation); // Calculate the distance from grenade to object
|
||||
// Impulse on object is based on how close the object is to the explosion
|
||||
impulseDirection = <grenadeLocation.x-objectLocation.x, grenadeLocation.y-objectLocation.y, grenadeLocation.z-objectLocation.z>;//explosionDistance;
|
||||
if(explosionDistance <= 15) llApplyImpulse(impulseDirection*10, TRUE); // If the object is within 15 meters of the explosion, make object react
|
||||
llSay(0, message);*/
|
||||
|
||||
//llSay(0, (string)objectLocation);
|
||||
//llSay(0, (string)grenadeLocation);
|
||||
//BELOW: From Mike
|
||||
vector diff = objectLocation-grenadeLocation;//objectLocation-grenadeLocation;//mypos-bpos;
|
||||
//llSay(0, (string)diff);
|
||||
float mag = llVecMag(diff);
|
||||
//llSay(0, (string)mag);
|
||||
//llSay(0, "diff.z: " + (string)diff.z);
|
||||
float cylinderMag = llVecMag(<diff.x, diff.y, 0>); // Come up with better name
|
||||
if(cylinderMag < blastRadius && diff.z < blastRadius*2){ // Make bricks within blast radius and those near destroyed bricks ready to react to detonation
|
||||
llSetStatus(STATUS_PHYSICS, TRUE); // make the object Physical
|
||||
llSetStatus(STATUS_PHANTOM, FALSE); // no phantom objects
|
||||
}
|
||||
if(mag < blastRadius){ // Make all bricks within blast radius to get exploded
|
||||
//llSetStatus(STATUS_PHYSICS, TRUE); // make the object Physical
|
||||
//llSetStatus(STATUS_PHANTOM, FALSE); // no phantom objects
|
||||
float brickMass = llGetMass();
|
||||
vector velocityVector = explosionForce*diff;
|
||||
vector momentumVector = brickMass * velocityVector;
|
||||
//llSetVelocity(diff*(blastRadius-mag), TRUE);
|
||||
//llSetPos(llGetPos()+diff*(blastRadius-mag));
|
||||
llApplyImpulse(momentumVector, FALSE);//diff*(blastRadius-mag), FALSE);
|
||||
//llSetForce(diff*(blastRadius-mag), TRUE);
|
||||
llSetTimerEvent(1.0); // Start timer to see how long it make bricks come to rest after so many seconds
|
||||
}
|
||||
}
|
||||
timer()
|
||||
{
|
||||
counter++;
|
||||
if (counter == 20) {
|
||||
//llSay(0, (string)llGetVel());
|
||||
if (llVecMag(llGetVel()) == 0) {
|
||||
llSetStatus(STATUS_PHYSICS, FALSE); // If the object has stopped moving, make it Non-physical
|
||||
} else if(superCounter == 5){
|
||||
llSetVelocity(<0.0,0.0,0.0>, FALSE);
|
||||
llSetStatus(STATUS_PHYSICS, FALSE);
|
||||
} else {
|
||||
counter = 0;
|
||||
superCounter++;
|
||||
//llSay(0, (string)superCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:02
|
||||
// :EDITED:2015-04-23 12:48:02
|
||||
// :ID:1076
|
||||
// :NUM:1744
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// When attached to an object, this script will allow that object to be deleted once the deleter button is pushed.
|
||||
// Use: attach this script to any item that needs to be deleted regularly. This is good for cleaning up after spawning a large number of that you may or may not be keeping track of.
|
||||
|
||||
// :CODE:
|
||||
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
integer objectChannel = -9;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(objectChannel, "", "", "Die Prims"); // Listen for "Die Prims" to be entered broadcasted over objectChannel
|
||||
}
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if(message == "Die Prims") llDie(); //Delete Prims
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:03
|
||||
// :EDITED:2015-04-23 12:48:03
|
||||
// :ID:1076
|
||||
// :NUM:1745
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// This script is used to generate lingering smoke effects after detonation of Grenade etc.
|
||||
// Use: This should be applied to a grenade object. It's best if this script is placed in one of the other prims comprising the grenade other than the one using the GrenadeExploder script.
|
||||
|
||||
|
||||
// :CODE:
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
|
||||
integer explosionChannel = -1337; // CHannel used to make objects involved in explosions communicate with one another
|
||||
// integer listenHandle; // unused - Ferd Frederix
|
||||
float detonationTime = 4.0;
|
||||
float counter = 0.0;
|
||||
integer primGeneratorStartValue = 10;
|
||||
|
||||
// Modified from http://community.secondlife.com/t5/Scripting/Starting-an-explosion-script/td-p/453247
|
||||
makeLingeringSmoke()
|
||||
{
|
||||
//local_offset is ignored
|
||||
llParticleSystem([ // Taken From: http://forums-archive.secondlife.com/54/73/273441/1.html
|
||||
PSYS_PART_START_ALPHA, 0.3,
|
||||
PSYS_PART_END_ALPHA, 0.0,
|
||||
PSYS_PART_START_COLOR, <0.667, 0.667, 0.667>,
|
||||
PSYS_PART_END_COLOR, <0.667, 0.667, 0.667>,
|
||||
PSYS_PART_START_SCALE, <20.0, 20.0, 20.0>,
|
||||
PSYS_PART_END_SCALE, <5.0, 5.0, 5.0>,
|
||||
PSYS_PART_MAX_AGE, 3.0,
|
||||
PSYS_SRC_ACCEL, ZERO_VECTOR,
|
||||
PSYS_SRC_ANGLE_BEGIN, 0.0,
|
||||
PSYS_SRC_ANGLE_END, PI,
|
||||
PSYS_SRC_BURST_PART_COUNT, 100,
|
||||
PSYS_SRC_BURST_RADIUS, 0.0,
|
||||
PSYS_SRC_BURST_RATE, 0.2,
|
||||
PSYS_SRC_BURST_SPEED_MIN, 2.5,
|
||||
PSYS_SRC_BURST_SPEED_MAX, 5.0,
|
||||
PSYS_SRC_PATTERN,
|
||||
PSYS_SRC_PATTERN_EXPLODE,
|
||||
PSYS_PART_FLAGS,
|
||||
0
|
||||
| PSYS_PART_INTERP_COLOR_MASK
|
||||
| PSYS_PART_INTERP_SCALE_MASK
|
||||
]);
|
||||
}
|
||||
|
||||
default // Detonate grenade after so many seconds
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
}
|
||||
on_rez(integer start_param)
|
||||
{
|
||||
if(start_param == primGeneratorStartValue) // If Grenade was spawned from the 'grenade launcher', then start the timer.
|
||||
{
|
||||
llSetTimerEvent(1.0); // Start timer
|
||||
}
|
||||
}
|
||||
timer()
|
||||
{
|
||||
++counter;
|
||||
if(counter == detonationTime-1){ // Explosion is generated one second before grenade is removed
|
||||
makeLingeringSmoke(); // Generate the lingering smoke effects
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:04
|
||||
// :EDITED:2015-04-23 12:48:04
|
||||
// :ID:1076
|
||||
// :NUM:1746
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
//
|
||||
//This script generates the grenade prim at a certain velocity in the direction of where the avatar's camera is facing
|
||||
//Use: Create a Grenade Launcher Button, and apply this script to it. Each time you click the button a grenade should fly out of it, so it's best if the button is on your HUD somewhere; this will cause the grenade to fly out of your avatar at about head level.
|
||||
// :CODE:
|
||||
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
integer Boxes = 1;
|
||||
integer permission_track_camera = 0x400; // Permission varaible for tracking the camera position
|
||||
|
||||
vector relativePosOffset = <0.4, 0.0, 0.0>;
|
||||
vector relativeVel = <7.0, 0.0, 5.0>;
|
||||
rotation relativeRot = <0.0, 0.0, 0.0, 0.0>;
|
||||
integer startParam = 10; // Variable needed by llRezObject that provides permissions to allow the object to be spawned
|
||||
integer grenadeChannel = -9000;
|
||||
|
||||
makePrims(){
|
||||
integer i = 0;
|
||||
relativePosOffset = relativePosOffset + llGetCameraPos(); // Adjust the spawn direction to be that of the camera
|
||||
vector myPos = llGetPos();
|
||||
rotation myRot = llGetRot();
|
||||
vector rezPos = myPos+relativePosOffset*myRot; // Set the spawn location to be offset by the avatar position and the camera position
|
||||
vector rezVel = relativeVel*myRot; // modify the grenade velocity by the avatar's rotation... think of Shot Put
|
||||
rotation rezRot = relativeRot*myRot; // modify the grenade rotation with that of the avatar's... again... Shot Put
|
||||
|
||||
// Spawn the grenade with the appropriate position, velocity, and rotation
|
||||
llRezObject(llGetInventoryName(INVENTORY_OBJECT, 0), rezPos, rezVel, rezRot, startParam);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
on_rez(integer a)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
state_entry()
|
||||
{
|
||||
}
|
||||
touch_start(integer a)
|
||||
{
|
||||
llRegionSay(grenadeChannel, "Destroy Grenade"); // Destroy any lingering grenades... This may deprecated
|
||||
makePrims();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -0,0 +1,112 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:00
|
||||
// :EDITED:2015-04-23 12:48:00
|
||||
// :ID:1076
|
||||
// :NUM:1742
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
This script generates the explosion for a spawned grenade once this grenade is detonataed. This script handles the detonation events, communication with surrounding objects, and deletion of the grenade object. // Use: Apply this script to a grenade object
|
||||
// :CODE:
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
integer grenadeChannel = -9000; // This channel variable MUST have the same value as that in the greandeThrower script.
|
||||
integer explosionChannel = -1337; // CHannel used to make nearby objects react physically to the grenade explosion
|
||||
//integer listenHandle;/ unused fkb
|
||||
float detonationTime = 4.0;
|
||||
float counter = 0.0;
|
||||
integer primGeneratorStartValue = 10;
|
||||
float explosionForce = 0.5;
|
||||
// BELOW: Particle Effect Variables
|
||||
integer particleCount = 450;
|
||||
vector particleColorStart = <1.000, 0.863, 0.000>/1.5; // Orange
|
||||
vector particleColorEnd = <0.5, 0.5, 0.5>;//<0.667, 0.667, 0.667>; // Grey
|
||||
vector particleScaleStart = <0.8, 0.8, 0.8>;
|
||||
vector particleScaleEnd = <5.0, 5.0, 5.0>;
|
||||
float particleSpeed = 8;
|
||||
float particleLifetime = 0.2;
|
||||
float particleBurstRate = 10.0;
|
||||
string sourceTextureID = "";
|
||||
vector localOffset = <0.0, 0.0, 0.0>; // local_offset is ignored
|
||||
|
||||
// Taken from http://community.secondlife.com/t5/Scripting/Starting-an-explosion-script/td-p/453247
|
||||
fakeMakeExplosion(integer particle_count, vector particle_color_start, vector particle_color_end,
|
||||
vector particle_scale_start, vector particle_scale_end, float particle_speed,
|
||||
float particle_lifetime, float particle_burst_rate, string source_texture_id, vector local_offset)
|
||||
{
|
||||
// Make explosion burst
|
||||
llParticleSystem([
|
||||
PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK
|
||||
| PSYS_PART_INTERP_COLOR_MASK
|
||||
| PSYS_PART_INTERP_SCALE_MASK,
|
||||
PSYS_PART_START_COLOR, particle_color_start,
|
||||
PSYS_PART_END_COLOR, particle_color_end,
|
||||
PSYS_PART_START_SCALE, particle_scale_start,
|
||||
PSYS_PART_END_SCALE, particle_scale_end,
|
||||
PSYS_PART_MAX_AGE, particle_lifetime,
|
||||
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE,
|
||||
PSYS_SRC_BURST_RATE, particle_burst_rate,
|
||||
PSYS_SRC_BURST_PART_COUNT, particle_count,
|
||||
PSYS_SRC_BURST_SPEED_MIN, 0,
|
||||
PSYS_SRC_BURST_SPEED_MAX, particle_speed
|
||||
]);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
counter = 0.0;
|
||||
}
|
||||
on_rez(integer start_param)
|
||||
{
|
||||
if(start_param == primGeneratorStartValue) // If ball was spawned from the 'grenade launcher', then start the timer.
|
||||
{
|
||||
llSetTimerEvent(1.0); // Start the timer
|
||||
}
|
||||
}
|
||||
touch_start(integer num_detected) // Set grenade timer by clicking it
|
||||
{
|
||||
llSetTimerEvent(1.0); // Start the timer
|
||||
}
|
||||
timer()
|
||||
{
|
||||
string landLocation;
|
||||
++counter;
|
||||
if(counter == detonationTime-1){ // Explosion is generated one second before grenade is removed
|
||||
fakeMakeExplosion(particleCount, particleColorStart, // Make an explosion
|
||||
particleColorEnd, particleScaleStart,
|
||||
particleScaleEnd, particleSpeed,
|
||||
particleLifetime, particleBurstRate,
|
||||
sourceTextureID, localOffset);
|
||||
llSetAlpha(0, ALL_SIDES); // Make the grenade no longer visible... but don't delete it just yet because particle effects
|
||||
llRegionSay(explosionChannel, "Smokey Time"); // Generate lingering smoke effects
|
||||
llTriggerSound("Grenade_Explosion", 30.0); // Make explosion sound
|
||||
landLocation = (string)llGetPos();
|
||||
string grenadeMessage = landLocation + "|" + (string)explosionForce;
|
||||
llRegionSay(explosionChannel, grenadeMessage); // Tell Nearby objects to react to explosion
|
||||
}
|
||||
if(counter == detonationTime)
|
||||
{
|
||||
llDie(); // Destroy Grenade
|
||||
counter = 0.0; // Reset Counter... just in case
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
Author: Steven Thompson, copyright 2015
|
||||
|
||||
DISCLAIMER:
|
||||
|
||||
INSTRUCTIONS:
|
||||
Below is the Work Flow for constructing the Destructible Wall and Grenade:
|
||||
There are a number of primitive objects that will need to be created in order to complete fulfill this Work Flow.
|
||||
1. Brick
|
||||
2. Destructible Wall
|
||||
3. Deleter Button
|
||||
4. Set Wall Alpha Button
|
||||
5. Grenade
|
||||
6. Grenade Launcher Button
|
||||
|
||||
I. Brick
|
||||
1) Spawn a box-shaped primitive; this will be used as an individual brick of the destructible wall.
|
||||
2) Set the dimensions of the primitive to x = 0.5, y = 0.24, and z = 0.25.
|
||||
NOTE: These dimension values can be changed but they will also have to be changed in RezBricks.txt on line 23 where brickSize is specified.
|
||||
3) Apply the following scripts to this object:
|
||||
a. GetExploded.txt
|
||||
b. PrimDeleter.txt
|
||||
4) Name the primitive 'Brick'
|
||||
5) OPTIONAL: Change the texture and color of the brick
|
||||
a. Go to the Texture menu when editing the primitive
|
||||
b. Find the drop-down that says 'Texture (diffuse)' and change it to 'Bumpiness (normal)'
|
||||
c. Click 'Texture' and set it to 'None'
|
||||
d. Click on the drop-down labeled 'Bumpiness' and select 'concrete'
|
||||
6) Copy the primitive to your inventory
|
||||
|
||||
II. Destructible Wall:
|
||||
1) Spawn a box-shaped primitive, which will act as your destructible wall.
|
||||
a. Use ctrl-B to open 'Build' menu.
|
||||
b. Click the box icon.
|
||||
c. Move cursor over into environment and click where you want to place the primitive.
|
||||
2) Set the dimensions of the primitive to those desired.
|
||||
3) Name the primitive something meaningful; I named mine 'DestructibleWall'.
|
||||
4) Apply the following scripts to this object:
|
||||
a. RezBricks.txt
|
||||
b. SetWallAlpha.txt
|
||||
5) Place a copy of the 'Brick' primitive in the Destructible Wall's 'contents'
|
||||
|
||||
III. Deleter Button:
|
||||
1) Spawn a box-shaped primitive, which will act as a Delete Button in your HUD.
|
||||
2) Name the primitive something meaningful; I named mine 'DeleterButton'.
|
||||
3) Apply the following script to this object:
|
||||
a. DeletePrims_ButtonScript.txt
|
||||
4) Take a copy of the Deleter Button primitive.
|
||||
5) Apply it to your HUD:
|
||||
a. Go into your inventory.
|
||||
b. Right click the Deleter Button.
|
||||
c. Click 'Attach to HUD' and place where desired.
|
||||
d. Ensure that this button location does not intefere with other buttons.
|
||||
|
||||
IV. Set Wall Alpha Button:
|
||||
1) Spawn a box-shaped primitive, which will act as a Button that changes the wall's alpha in your HUD.
|
||||
2) Name the primitive something meaningful; I named mine 'SetWallAlphaButton'.
|
||||
3) Apply the following script to this object:
|
||||
a. SetWallAlpha_ButtonScript.txt
|
||||
4) Take a copy of the Set Wall Alpha Button primitive.
|
||||
5) Apply it to your HUD:
|
||||
a. Go into your inventory.
|
||||
b. Right click the Set Wall Alpha Button.
|
||||
c. Click 'Attach to HUD' and place where desired.
|
||||
d. Ensure that this button location does not intefere with other buttons.
|
||||
|
||||
V. Grenade:
|
||||
1) Spawn a circle-shaped primitive; it will act as your grenade object
|
||||
2) Edit the physical properties of the grenade:
|
||||
a. Set the size of the Grenade primitive to be more appropriately sized: try x=0.063, y=0.063, z=0.063; adjust as needed
|
||||
b. Go into 'Features' and set the following values:
|
||||
i. Gravity = 1.0
|
||||
ii. Friction = 0.60
|
||||
iii. Density = 1000.0
|
||||
iv. Bounciness = 0.50
|
||||
3) Apply the following scripts:
|
||||
a. GrenadeExploder.txt
|
||||
4) Take a copy of this primitive.
|
||||
|
||||
VI. Grenade Launcher Button:
|
||||
1) Spawn a box-shaped primitive, which will act as a Button that throws a grenade object.
|
||||
2) Name the primitive something meaningful; I named mine 'GrenadeLauncher'.
|
||||
3) Apply the following to this object:
|
||||
a. GrenadeThrower.txt
|
||||
b. Grenade primitive
|
||||
4) Take a copy of the Grenade Launcher Button primitive.
|
||||
5) Apply it to your HUD:
|
||||
a. Go into your inventory.
|
||||
b. Right click the Grenade Launcher Button.
|
||||
c. Click 'Attach to HUD' and place where desired.
|
||||
d. Ensure that this button location does not intefere with other buttons.
|
||||
|
||||
DIAGRAM:
|
||||
For More details about how these primtives and scripts go together, refer to the image, DestructibleWall.jpeg.
|
||||
@@ -0,0 +1,28 @@
|
||||
<Project name="Opensim exploding wall and grenade" guid="05b9cd54-840b-4be1-86f5-0daedb6752a0">
|
||||
<Object name="Grenade" guid="5bb8b2ff-d2ff-425a-928c-07c37c1007ae">
|
||||
<Script name="GrenadeExploder.lsl" guid="f6daea66-e945-4a78-996c-dc56e01c6299">
|
||||
</Script>
|
||||
</Object>
|
||||
<Object name="Brick" guid="2b5ef2e3-8021-4a4f-984c-38f98c60410e">
|
||||
<Script name="GetExploded.lsl" guid="8b6a9ae4-3199-4550-8156-f191ce89c6df">
|
||||
</Script>
|
||||
<Script name="PrimDeleter.lsl" guid="1128c10e-e2d1-4935-8006-17fdea47c484">
|
||||
</Script>
|
||||
</Object>
|
||||
<Object name="Button" guid="71f1c834-f6f8-4b0e-b55d-f66959c56a6e">
|
||||
<Script name="GenerateSmokeEffects.lsl" guid="3b396365-2af6-472d-bbc2-fda159d9f147">
|
||||
</Script>
|
||||
<Script name="GrenadeThrower.lsl" guid="f7af4fbf-3f05-4e01-9705-845396c967bd">
|
||||
</Script>
|
||||
</Object>
|
||||
<Object name="Wall" guid="8daa6c71-1f6f-4b8b-85e4-5854568abfde" active="true">
|
||||
<Script name="DeletePrims_ButtonScript.lsl" guid="d0bdef48-4ad7-4cec-911c-a134a0cd910e">
|
||||
</Script>
|
||||
<Script name="RezBricks.lsl" guid="f2baabc5-4825-40e0-a626-a72b30a9be42">
|
||||
</Script>
|
||||
<Script name="SetWallAlpha_ButtonScript.lsl" guid="5e8026b5-d56a-4e36-a718-8a4e6285f420">
|
||||
</Script>
|
||||
<Script name="SetWallAlpha.lsl" guid="af01c2d6-7b42-4147-a4e9-b1fbeb4a9eba">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
@@ -0,0 +1,40 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:05
|
||||
// :EDITED:2015-04-23 12:48:05
|
||||
// :ID:1076
|
||||
// :NUM:1747
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// This script will broadcast the message "Die Prims" across the region on the objectChannel = -9. This will cause any objects with the PrimDeleter script to get deleted.
|
||||
// Use: This should be applied to a button. I called mine DeleterButton.
|
||||
// :CODE:
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
integer objectChannel = -9;
|
||||
|
||||
default
|
||||
{
|
||||
touch_start(integer num)
|
||||
{
|
||||
llRegionSay(objectChannel, "Die Prims");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:05
|
||||
// :EDITED:2015-04-23 12:48:05
|
||||
// :ID:1076
|
||||
// :NUM:1748
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
|
||||
// This script spawns brick objects based off of the wall's location.
|
||||
// Use: Apply this script to a hollow, non-physical, phantom wall. When the wall is clicked and if the brick object is in the wall, then bricks will be spawned in a staggered pattern
|
||||
// NOTE: The dimensions of the wall aren't important. They act more as a place-holder within an environment.
|
||||
// :CODE:
|
||||
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
integer startParam = 0;
|
||||
vector rezPos;
|
||||
integer brickRowAmount = 5; // brickRowAmount / brickSize.z = number of bricks rows (round up)
|
||||
integer brickColumnAmount = 7; // brickColumnAmount / brickSize.x = number of brick columns (round up)
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
}
|
||||
touch_start(integer num_detected)
|
||||
{
|
||||
float i;
|
||||
float j;
|
||||
float k = 0.0;
|
||||
vector brickSize = <0.5,0.24,0.25>; // Dimensions of brick placed in wall: a mechanism to grab this data is currently being made
|
||||
vector wallSize = llGetScale(); // Get the wall location
|
||||
rotation wallRot = llGetRot(); // Get the wall rotation
|
||||
vector wallRotVector = llRot2Euler(wallRot); // Convert the wall rotation to vector so it can be applied the placement formula
|
||||
// NOTE: Getting the wall to spawn bricks once it's been rotated is currently not working. This mechanism is currently being worked on.
|
||||
// Below: loop for spawning bricks
|
||||
for(j=0;j<brickRowAmount;j+=brickSize.z){
|
||||
if(k == 0.0){ // Stagger the placement of the bricks every other row
|
||||
k = brickSize.x/2; // Stagger them by half length of the bricks
|
||||
} else {
|
||||
k =0.0;
|
||||
}
|
||||
for(i=0;i<=brickColumnAmount;i+=brickSize.x){
|
||||
rezPos = llGetPos() - <(wallSize.x/2 - brickSize.x/2 - (float)i + k), 0.0, (wallRotVector.z + wallSize.z/2 - brickSize.z/2 - (float)j)>; // Position Equation
|
||||
llRezObject("Brick", rezPos, <0.0,0.0,0.0>, wallRot, startParam); // Rez them bricks
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:07
|
||||
// :EDITED:2015-04-23 12:48:07
|
||||
// :ID:1076
|
||||
// :NUM:1750
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// This script is nice to have but not necessarily essential. It allows the destructible wall to switch from being visible to invisible at the press of a button, which is nice if you need to know where it is when it's not populated by bricks or when it is populated by bricks and you don't want users to see the wall.
|
||||
// Use: Apply the script to the destructible that spawns the bricks. It will be listening for the corresponding button press.
|
||||
|
||||
// :CODE:
|
||||
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
integer setWallAlphaButtonChannel = -88; // Channel for making the wall visible or transparent
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
integer listenHandle = llListen(setWallAlphaButtonChannel, "", "", ""); // Listen to SetWallAlpha Button
|
||||
}
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if(channel == setWallAlphaButtonChannel) { // Make sure the channel is correct
|
||||
if(llGetAlpha(ALL_SIDES) == 0.0){
|
||||
llSetAlpha(0.5, ALL_SIDES); // Make the wall half-way visible
|
||||
} else {
|
||||
llSetAlpha(0.0, ALL_SIDES); // Make the wall completely invisible
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Explosion
|
||||
// :NAME:Opensim exploding wall and grenade
|
||||
// :AUTHOR:Steven Thompson
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-04-23 13:48:06
|
||||
// :EDITED:2015-04-23 12:48:06
|
||||
// :ID:1076
|
||||
// :NUM:1749
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Allows the destructible wall's alpha to be changed via button click
|
||||
// Use: Apply this script to a button to change the wall's aplha; I called mine SetWallAlphaButton.
|
||||
// :CODE:
|
||||
|
||||
|
||||
// Copyright 2015 ARL
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
//
|
||||
//http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
integer setWallAlphaButtonChannel = -88;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
}
|
||||
touch_start(integer num_detected)
|
||||
{
|
||||
llRegionSay(setWallAlphaButtonChannel, ""); // Send an empty message to DestructibleWall_Brick that makes it change its alpha
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user