06000208 / ttt-gravity-gun Goto Github PK
View Code? Open in Web Editor NEWHalf Life's Gravity Gun for TTT
Home Page: https://steamcommunity.com/sharedfiles/filedetails/?id=1414206909
Half Life's Gravity Gun for TTT
Home Page: https://steamcommunity.com/sharedfiles/filedetails/?id=1414206909
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.
Some of this stuff is already partially in the code, although commented out.
SetDeploySpeed needs to be used in the initialize meta function for it to do anything
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
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
Particularly:
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
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.
As self.Weapon
is the same as just self
in SWEPs
Such as the seesaw on ttt_richland
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.