Author Topic: [Weapon] Laser Trip-mine - Update: BETA RAMP FUNCTIONALITY (2.0.0)  (Read 12778 times)

This is really cool! Can't wait to see what happens in future updates!

New Update
Updated link is in the OP



Changes:
- You can now place mines on ramped surfaces
- The defuse tool has been switched to the Pipe Wrench instead of the default wrench.
- Placing mines on invalid surfaces will yield an error sound.
- Trip-mines will de-spawn when you reset the minigame (can be disabled via RTB pref)
- You can set the trip-mines to last permanently by typing -1 into the despawn time RTB pref

I have tested this update extensively but there may still be many bugs. It has the ability to calculate pretty complicated ramps, so long as the brick maker did their normals correctly. Things tend to get pretty forgety on wedged surfaces, so avoid those for now (it usually just simply wont let you place them on wedges). If your build is very custom-brick/wedge heavy and it's causing problems, you can set it to only use flat surfaces again via an RTB pref.

If I've totally broken everything by mistake, I've left the previous version in the OP under 'stable'
« Last Edit: July 30, 2016, 07:09:47 AM by Rally »

This is incredible. I love the model.

Your radius search code is broken, it will only check every second object.

while(containerSearchNext() != 0)
{
   %search = containerSearchNext();



Use this instead:

while((%search = containerSearchNext()) != 0)
{



Instead of the weird raycast loop you should also use a trigger. Just have to position them and they'll detect all players.

Thanks for the tip. Do you think you could point me to a tutorial or some documentation on triggers? Never used them before.

Basically.
Make your trigger datablock
Code: [Select]
datablock TriggerData(MyAwesomeTriggerData)
{
tickPeriodMS = 150; // Used with ::onTickTrigger.
};

Then make your trigger.
Code: [Select]
%trig = new Trigger()
{
datablock = MyAwesomeTriggerData;
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
polyhedron = "0 0 0 1 0 0 0 -1 0 0 0 1"; // This determines the shape of the trigger.
};

missionCleanup.add(%trig);

And then
Code: [Select]
function MyAwesomeTriggerData::onEnterTrigger(%data, %trigger, %obj)
{
// This method is called whenever an object enters the %trigger
// area, the object is passed as %obj.
}

function MyAwesomeTriggerData::onLeaveTrigger(%data, %trigger, %obj)
{
// This method is called whenever an object leaves the %trigger
// area, the object is passed as %obj.
}

function MyAwesomeTriggerData::onTickTrigger(%data, %trigger)
{
// This method is called every tickPerioMS, as long as any
// objects intersect the trigger.

// You can iterate through the objects in the list by using these
// methods:
//    %trigger.getNumObjects();
//    %trigger.getObject(n);
}

>no floor and ceiling


  Maybe add costum skins? Also. Remove the blue line so other peep can't see it :3

  Maybe add costum skins? Also. Remove the blue line so other peep can't see it :3
ehm they are not magic mines u know



Thank you for this. I'll play around with it and see if I can get it working.

  Maybe add costum skins? Also. Remove the blue line so other peep can't see it :3

If you have RTB installed you can adjust the width of the beam, or turn it off completely using the server settings.
Typing this in the console should disable the beam:
Code: [Select]
$LaserTripminePref::BeamWidth = 0.0;

After like a month I finally figured out how to get a rotation axis out of a normal vector. The new formula supports rounds, wedges, wedge ramps, basically everything except for brick packs with incorrect collision



I'll release it in an update when I get triggers working

After like a month I finally figured out how to get a rotation axis out of a normal vector.

Is it not just this?

vectorCross("0 0 1", %normal) SPC mAcos(vectorDot("0 0 1", %normal));

I've got triggers working pretty well, and I've eliminated all schedule loops from the script. I was able to place around 6,000 tripmines without the server losing performance lol. Well, I mean, with the exception of looking directly at 12,000 static shapes

Is it not just this?

vectorCross("0 0 1", %normal) SPC mAcos(vectorDot("0 0 1", %normal));

I'm not very good at vector math lol. I'll see if I can adapt this to my code. Thank you.

Lookin' pretty good!

  • Beam width: If you want your beams to be thicc you can make them bigger.
this made me laugh

I'm kind of surprised no one's made this before, though.

I'm kind of surprised no one's made this before, though.

I'm fairly certain Jookia/Pandan had a working tripmine in ~2008? I can't remember if they didn't release it because of some beef or because it was just #cool to have private add-ons and not release them back then.