Skip to content
76 changes: 76 additions & 0 deletions GLBA-Slim.lsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
integer hp;
integer maxhp = 100;
integer link = 0;
integer listenId;
key me;
integer num_hits_without_update=0;
string rev = "3.0";
handlehp()//Updates your HP text. The only thing you should really dick with is the text display.
{
if(hp<=0) {
llDie();
}
if(num_hits_without_update < 20) {
num_hits_without_update++;
llSetTimerEvent(0.15);
} else {
string info="LBA.v.L."+rev+","+(string)hp+","+(string)maxhp;
num_hits_without_update = 0;
llSetLinkPrimitiveParamsFast(link,[
PRIM_TEXT,"[LBA Slim] \n AP: " + (string)(hp) + "/" +(string)(maxhp),<0.0,1.0,0.0>,1.0,
PRIM_LINK_TARGET, LINK_THIS,
PRIM_DESC, info
]);
}
}
init(integer s)
{
if(s <= maxhp && s > 0) hp = s;
else hp = maxhp;
me = llGetKey();
integer hex = (integer)("0x" + llGetSubString(llMD5String((string)me,0), 0, 3));
llListenRemove(listenId);
listenId = llListen(hex, "","","");
handlehp();
}
default
{
state_entry()
{
init(0);
}
on_rez(integer sp)
{
init(sp);
}
timer()
{
num_hits_without_update = 0;
llSetLinkPrimitiveParamsFast(link,[
PRIM_TEXT,"[LBA Slim] \n AP: " + (string)(hp) + "/" +(string)(maxhp),<0.0,1.0,0.0>,1.0,
PRIM_LINK_TARGET, LINK_THIS,
PRIM_DESC, "LBA.v.L.GLBA.1.3," + (string)hp + "," + (string)maxhp
]);
llSetTimerEvent(0);
}
collision_start(integer n)
{
while(n--)
{
if(llVecMag(llDetectedVel(n)) > 25 && llDetectedType(n) != 3)--hp;
}
handlehp();
}
listen(integer i, string n, key k, string m)
{
list l = llCSV2List(m);
key target = llList2Key(l,0);
integer dmg = llList2Integer(l,1);
if(target == me)
{
hp -= dmg;
if(hp > maxhp) hp = maxhp;
handlehp();
}
}
}
65 changes: 65 additions & 0 deletions GLBA-Vehicles.lsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
integer hp=50;//Current AP
integer hpmax=1000;//Max AP
integer link=0;//Text Display Link
integer hex;
key me;

//ensure that we eventually have an update, say we're under a lot of fire and we never hit the timer.
integer num_hits_without_update=0;
updateAP(){
if(hp<1) {
llDie();
}
if(num_hits_without_update < 20) {
num_hits_without_update++;
llSetTimerEvent(0.15);
} else {
num_hits_without_update = 0;
llSetLinkPrimitiveParamsFast(link,[
PRIM_TEXT,"[GLBA-V] \n AP: " + (string)(hp) + "/" +(string)(hpmax),<0.0,1.0,0.0>,1.0,
PRIM_LINK_TARGET, LINK_THIS,
PRIM_DESC, "LBA.v.GLBA.1.3," + (string)hp + "," + (string)hpmax
]);
}
}
default{
on_rez(integer n){
hp = hpmax;
llSetObjectDesc("LBA.v.GLBA.1.3");
me=llGetKey();
hex=(integer)("0x" + llGetSubString(llMD5String((string)me,0), 0, 3));
llListen(hex, "","","");
updateAP();
}
timer() {
num_hits_without_update = 0;
llSetLinkPrimitiveParamsFast(link,[
PRIM_TEXT,"[GLBA-V] \n AP: " + (string)(hp) + "/" +(string)(hpmax),<0.0,1.0,0.0>,1.0,
PRIM_LINK_TARGET, LINK_THIS,
PRIM_DESC, "LBA.v.GLBA.1.3," + (string)hp + "," + (string)hpmax
]);
llSetTimerEvent(0);
}

collision_start(integer n){
while(n--){
if(llVecMag(llDetectedVel(n)) > 25)
{
--hp;
}
}
updateAP();
}
listen(integer i, string s, key k, string m){
list l = llParseString2List(m,[","],[]);
string prefix = llList2String(l,0);
string suffix = llList2String(l,1);
if(i==hex){
if (prefix==(string)me){
hp-=(integer)suffix;
if(hp > hpmax) hp = hpmax;
updateAP();
}
}
}
}
87 changes: 62 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,80 @@
# SLMCLBA
Listen based armour for the Secondlife Military Community
# Listen Based Armor (LBA)
Performant listen based armour for the Secondlife Military Community.

In this Github, You will find all of the up to date scripts for LBA Armour, as well as documentation on how it works and how to damage it.
In the event that Hadet or Dread disappears forever due to death or prison or something else, this will serve as a way to allow others to
fork and distribute future standardized versions of LBA.
This repository contains the most up-to-date and lag-free scripts for LBA, as well as the documentation provided by upstream.

## Contributing
# Migrating from Legacy LBA
The version of LBA that is currently distributed is no longer maintained.

[FOLLOW GITHUB'S HELLO WORLD!](https://guides.github.com/activities/hello-world/)
Simply delete your old LBA scripts, and follow the instructions below under "Usage."

[Fork The Repo](https://guides.github.com/activities/forking/)
The GLBA scripts to use as a replacement for the legacy scripts is as follows:

Clone Your Fork:
| Legacy Script Name | GLBA Script |
|--------------------|-------------|
|LBA-Light-Deployable-vX.XX.lsl|Use GLBA-Slim|
|LBA-Light-vX.XX.lsl|Use GLBA-Slim|
|LBA-Slim-v.X.XX.lsl|Use GLBA-Slim|
|LBA-v.2.32.lsl|Use GLBA-Vehicles|
|LBA-D-v2.32-rc3.lsl|Directional GLBA has not yet been released, continue using legacy|

`git clone git@github.com:yourusername/SLMCLBA`
## Compatibility
GLBA is fully compatible with **all** LBA-compliant weaponry, vehicles, and deployables.

Set Remote Origin for Rebasing:
# Usage

`git remote add upstream https://github.com/Krutchen/SLMCLBA`
## GLBA-Slim.lsl: Deployable Objects

Create a new Branch before making changes:
Create a new script in your deployable and copy/paste the LSL code in `GLBA-Slim.lsl` into it, and hit "Save".

```
git pull --rebase upstream master
git checkout -b descriptive-name
```
Take the deployable into your inventory and deploy it as needed.

Once you have edited files, you need to stage them for commit. If you're not using a text editor with Git Integration, you can do this like so:
## GLBA-Vehicles.lsl: Vehicles

`git add $file(s)`
GLBA-Vehicles is meant to be used for vehicles that are meant to be driven, such as tanks, gunships, air ships, boats, cars, golf carts, etc.

Provide a commit message for what's changed:
Create a new script in your deployable and copy/paste the LSL code in `GLBA-Vehicles.lsl` into it, and hit "Save".

`git commit -m "I hate Dread Hudson"`
Take the vehicle into your inventory and rez it where you want.

Push your changes:
# Contributing

`git push`
## Basics
For those new to git, or the open source GitHub experience, I highly recommend you complete the basic [GitHub "Hello World" Tutorial](https://guides.github.com/activities/hello-world/) before contributing.

Pull Request:
Once or if you understand the essentials of git and/or GitHub, follow this tutorial to fork this repository:

Return to this Page, there will be a button that says **CREATE PULL REQUEST!** It is Green, click it and submit.
["Forking" a Repository](https://guides.github.com/activities/forking/)

Once you have created a fork, and modified it, you can submit a pull request by going to [uncertain-string/SLMCA/pulls](https://github.com/uncertain-string/SLMCLBA/pulls) and hitting "New pull request."

GitHub has provided this tutorial on [How to Collaborate using Pull Requests from a Fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)

If you need help, contact `frick.teardrop`.

## Help
If you have any further questions, contact `frick.teardrop` in Second Life. Frick is always happy to help anybody understand open source projects, and how git (and collaborating within GitHub) works.


# Performance Results

The numbers represented in these tables are script time, the average number of seconds (over around a 30 minute window) that each script performs work during a simulator frame.

The results are sorted by the difference between idle and active states. The lowest difference between states wins, as the difference is the _actual_ amount of active script time that the script uses per frame during combat.

Idle state is after rezzing and waiting 10 minutes for script time to settle.

Active state is after being hit with 5,000 collisions & listen events over 5 minutes.

You will notice that homesteads have higher script time. This is because there is 1/4th of the CPU time normally available per frame as they are homesteads. Thanks to optimizations from the mono project, the realized difference in performance is minimal between homesteads and full sims.

## Full Sim Hybrid RC Statistics

![image](https://user-images.githubusercontent.com/28276562/148669447-ed65f290-3571-46c6-9d1b-6e28d6a8462b.png)

## Homestead Hybrid RC Statistics

![image](https://user-images.githubusercontent.com/28276562/148669457-07c7ced3-ba6f-4fd0-bf9d-f4077c0c75b1.png)

## Notes
You will notice that full sims report a higher script time average, this is because full sims have 4 times the capacity of a homestead, so they schedule far more script executions per frame, and allocate far more CPU time for scripts per frame than homesteads.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading