Scrap Mechanic

Scrap Mechanic

90 ratings
Laser Tools
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
24.328 MB
2 Aug, 2022 @ 1:38pm
9 Jul @ 6:48am
35 Change Notes ( view )

Subscribe to download
Laser Tools

Description
This mod adds 4 new items which use lasers to unleash total annihilation!
All of these items use Plasma Batteries as a power source, which can be crafted in the craftbot.

Thanks to Questionable Mark's Modded Craftbot Recipes, they're also craftable in survival!

Credits
  • Vajdani - Scripting, animation
  • Dart Frog - Handheld Laser Cutter model, thumbnail help
  • DriVer - Laser Pistol model
147 Comments
Vajdani  [author] 9 Jul @ 10:51am 
I've thought of an easier way of doing it.
At the top of the file, there is a table that defines what collision types instantly kill the laser.

ProjectileManager.killTypes = {
terrainSurface = true,
terrainAsset = true,
limiter = true
}

A clean and simple way of disabling block damage is to add body collisions to it as well.

ProjectileManager.killTypes = {
terrainSurface = true,
terrainAsset = true,
limiter = true,
body = true
}

Now, the projectiles will destroy themselves when colliding with blocks and parts, without harming them.
Time_pug 9 Jul @ 10:40am 
which line in ProjectileManager.lua should I edit to disable block destruction? So far every attempt has just completely disabled the lasers.
Vajdani  [author] 9 Jul @ 10:24am 
There are no damage values, the script just deletes them outright. Do a search for the functions I mentioned earlier( destroyBlock , destroyShape ).
Time_pug 9 Jul @ 10:19am 
I've checked and changed every damage value I could find in all the json files and still the laser will infinitely destroy anything it touches. Having a comment for each function would help a lot with understanding them.
Time_pug 9 Jul @ 10:06am 
where can I find the damage value for placeable items (blocks, electronics etc)
Vajdani  [author] 9 Jul @ 7:24am 
I didn't make any really substantial additions, just a few small ones.
Time_pug 9 Jul @ 7:17am 
I've made multiple backups of my edit so I still have all the original values so nothing will be lost
Time_pug 9 Jul @ 7:11am 
are the other functions still the same so I can just port over my settings to the new one?
Vajdani  [author] 9 Jul @ 6:53am 
Hi, I had a few changes piled up on my end, so I pushed an update just now. It might override some of your changes, sorry about that.

Search for usages of the destroyBlock and destroyShape functions, I used them for destroying blocks and parts.
Time_pug 9 Jul @ 5:59am 
All I could find that could be related to the issue is spherecast and update pos. Literally learning Lua on the spot just to disable block destruction.