Coder Social home page Coder Social logo

dvdvideo1234 / laserstool Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 3.0 33.19 MB

Official repository of the Laser STool for Garry's mod

License: GNU General Public License v3.0

Lua 100.00%
laser realism addon garrysmod-addon garrysmod reflector crystal optics trace reflection

laserstool's Introduction

LaserSTool

Description

This is the LaserSTool I've originally ported to Garry's mod 13 since then, I am constantly improving it. My goal is making it behave as similar to a real laser beam. The repository contains MadJawa's original SVN, but drastically changed to include a lot of added features, better user experience and improved beam physics behavior accuracy. This is by far the most bug free laser addon that is up to date and with active development.

Brief history

The original creator and huge credit goes to one and only MadJawa. His repository is located here. I cannot tell you that he will still and eventually support this repo in the future, but we can clearly see no commits are made since 2009. This has been quite a ride since January 2020 when I first started fixing this, but as the time flew by I got hooked on another projects IRL and this was kind of aside forgotten. I did not make a repository at the time, so I kept fixing it on my local machine at home, thinking that no one will eventually get interested in me reviving this gem, but here we are now and boy was I wrong! Last I decided to push it to github, so the code will not get lost again or something may happen to this marvel!

LaserSTool

Installation

Just clone this repo in your addons folder or subscribe in the workshop.

Features

The code base has been drastically changed now and does not correspond to the original 2.0 version anymore. This was the only way I could support the things I needed the most from the addon:

  1. Very stable crystal calculating routine and beam trace
  2. Reflect beam traces via hit surface material override
  3. Refract beam traces via hit surface material override
  4. Calculate full internal reflection according to medium boundary
  5. Code base and updates in tone with Garry's mod 13
  6. Supports wire and every element supports advanced duplicator 1 and 2
  7. Wire inputs override internals when connected
  8. Internal wire wrapper taking care of the wire interface
  9. Surface reflection and medium refraction power absorption
  10. Better model for the crystal entity not to get confused where beam comes out
  11. Material override can be saved and restored with advanced duplicator 1 and 2
  12. Editable entity support option for changing internals of the laser elements
  13. User customizable models for active entities and reflectors via convar tweak
  14. Absorption degradation and self sustain beam loop for crystal entities
  15. Wiremod API for retrieving beam source settings and make control feedback
  16. A bunch of different laser addon dedicated elements you can find here in the wiki page
  17. Coding effective wrapper for editable entity manipulation and adjustment
  18. You can combine the refraction with Shadowscion's primitive for using lenses

Workshop

I see many copies of this tool everywhere, but still, there is none that have crated official repository for community contribution, besides, I think the original author will not like that in general. If you want to try the tool go ahead and install it.

Versioning

Small modifications are pushed to the workshop when they are tested. Large modifications require a dedicated PR, which when gets tested and when merged is pushed to the workshop automatically.

Pull requests

I am a fan of this tool, so any help I get will be appreciated.

laserstool's People

Contributors

dvdvideo1234 avatar edotm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laserstool's Issues

Dupe and paste a laser emiter rises lua error

Reporter: https://steamcommunity.com/id/havocking92
Gmod branch: x86-64

  1. Install Laser tool from repo or workshop
  2. Install Advanced Dupicator 2
  3. Install Henry's animation tool
  4. Copy and paste a gmod_laser with AdvDupe2
  5. See the error is reproduced below:
[AdvDupe2NotifyPaste]	 Player: [Sk$Bh]Trick or treat KID! Pasted, 1 Entities and 0 Constraints.
[AdvDupe2Notify]	Pasting...
addons/laserstool/lua/entities/gmod_laser/shared.lua:305: attempt to perform arithmetic on local 'm' (a table value)[AdvDupe2Notify]	Finished Pasting!

[laserstool] addons/laserstool/lua/entities/gmod_laser/shared.lua:244: bad argument #1 to 'EmitSound' (string expected, got nil)
  1. EmitSound - [C]:-1
   2. DoSound - addons/laserstool/lua/entities/gmod_laser/shared.lua:244
    3. GetOn - addons/laserstool/lua/entities/gmod_laser/shared.lua:266
     4. unknown - addons/laserstool/lua/entities/gmod_laser/init.lua:145

Remove the additional overhead caused by `mtBeam:IsMemory(index, pos)`

Have to check on what conditions bent is actually needed

--[[
 * Checks for memory refraction start-refract
 * from the last medium stored in memory and
 * ignores the beam start entity. Checks when
 * the given position is inside the beam source
]]
function mtBeam:IsMemory(index, pos)
  local sent = self.BmSource
  local vmin = sent:OBBMins()
  local vmax = sent:OBBMaxs()
  local vpos = sent:WorldToLocal(pos)
  local bent = vpos:WithinAABox(vmax, vmin)
  return ((index ~= self.TrMedium.M[1][1]) and not bent)
end

Contribution Guidelines

About your contribution guidelines

Use two spaces instead of one tab for indentation
All new files must be lower case for linux support
Line endings must always be unix complaint LF
Trim the tailing space before you save

Just use a .editorconfig

root = true

[*]
end_of_line = lf
insert_final_newline = true


[*.{lua,md}]
charset = utf-8
indent_style = space

[*lua]
indent_size = 2

[*.md]
indent_size = 4

And since when does Linux require lower case filenames??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.