Code Monkey home page Code Monkey logo

ttt-gravity-gun's People

Contributors

06000208 avatar mechabubba avatar

Watchers

 avatar  avatar

Forkers

mechabubba

ttt-gravity-gun's Issues

Lua location?

There's actually two methods for creating a custom ttt weapon regarding your lua file's name and path, with this addon currently using the first:

  • lua/weapons/weapon_ttt_gravitygun/shared.lua
  • gamemodes/terrortown/entities/weapons/weapon_ttt_gravitygun.lua

The latter is described in ttt's custom weapon guide while I don't remember where I learned the other.

I'm unsure if there would be any advantage to switching, if either is preferred over the other, etc.

Aesthetic Overhaul

Some of this stuff is already partially in the code, although commented out.

  • Punting is the act of applying force to your prop via left click, held or not
  • Pulling is pulling something towards you using right click
  • Grabbing is the act of picking something up using right click
  • Holding is when you have something held after grabbing using the gravity gun
  • The "tongs" are the bits of metal on the front of the gravity gun

Visual

  • The vibrant orange glow
  • Increased glow when you attempt to grab but aren't looking at anything grabbable
  • Increased glow and "tong" lights when holding
  • Muzzle flash on end of the gun & sparks at punted location when punting
  • Beam of orange electricity when punting
  • Animated gauge when punting or grabbing (but not pulling)
  • Animated tongs: Open when looking at something grabbable or while holding, other wise closed.
  • Make tongs more visible in the shop icon
  • Add the weapon's orange glow to the shop icon to make it slightly brighter (maybe)

Sounds

  • Left click when not looking at anything puntable (unable to punt)
  • Right click when not looking at anything grabbable (unable to grab)
  • When you look at something grabbable (tongs open)
  • When you look away from something grabbable (tongs close)
  • When grabbing something (grab)
  • While holding something (holding)
  • When dropping something (drop)
  • When punting something (punt)

Ammo mechanics overhaul

Rather than a certain amount of uses, ammo should be reflected as "energy" or "charge", where punting consumes a certain percentage and pulling/holding are gradual drains, all three determined by the weight of the prop being acted upon

Lua Error: Tried to use a null entity

15:47:55 [ERROR] addons/ttt_gravity_gun/lua/weapons/weapon_ttt_gravitygun/shared.lua:644: Tried to use a NULL entity!
           1. SetPos - [C]:-1
            2. Visual - addons/ttt_gravity_gun/lua/weapons/weapon_ttt_gravitygun/shared.lua:644
             3. unknown - addons/ttt_gravity_gun/lua/weapons/weapon_ttt_gravitygun/shared.lua:449

Weapon is nonfunctional after recent (?) gmod updates

Right click (pulling props or entities) is nonfunctional. Left click (pushing) outputs a serverside error;

Lua Error: [TTT Gravity Gun] lua/weapons/weapon_ttt_gravitygun/shared.lua:644: Tried to use a NULL entity!
1. SetParent - [C]:-1
2. Visual - lua/weapons/weapon_ttt_gravitygun/shared.lua:644
3. oldprimary - lua/weapons/weapon_ttt_gravitygun/shared.lua:453
4. unknown - addons/tttdamagelogs_3.1.0/lua/damagelogs/server/damageinfos.lua:55

Code segment in question;

    if (SERVER) then
        if !self.Muzzle then
            self.Muzzle = ents.Create("PhyscannonMuzzle")
            self.Muzzle:SetPos( self.Owner:GetShootPos() )
            self.Muzzle:Spawn()
        end

        self.Muzzle:SetParent(self.Owner) -- L644
        self.Muzzle:SetOwner(self.Owner)

        timer.Simple( 0.12, function()
            self:RemoveMuzzle()
        end )
    end

This has something to do with setting the owner of the weapon to a muzzle flash. This is probably self.Muzzle equalling the NULL entity, but its been a while so that may be me reading the error wrongly. Possible fix would be to change the !self.Muzzle to not IsValid(self.Muzzle).

Edit: switched right and left around.

Prop weight interactions

  • Heavy props (such as cars) should reflect their weight when held, such as a slight decrease to movement speed along with a noticable "drag"
  • Ideally it would also be much harder to flick them, abusing the physics engine, but that's also a fun part of the weapon

IDE Extensions & Build/test/release workflow

Revisiting addon and lua development after programming in other languages, I find myself wanting real IDE features for it, and a better workflow for building addons, testing them, and releasing to the workshop/on github. I'll be using this issue to document my findings in various editors and what I think works best

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.