Conversation
| SWEP.Instructions = | ||
| "Left click to attack | Right click to leap | Reload to heal | While holding the sword you don't take fall damage" | ||
| SWEP.Purpose = "To Become a cool swordsman that can fly" | ||
| SWEP.Contact = "Don't Contact me i dont like people" |
There was a problem hiding this comment.
You can just omit the contact property
| SWEP.Category = TASWeapons.Category | ||
| SWEP.Spawnable = true | ||
| SWEP.AdminOnly = false | ||
| SWEP.BounceWeaponIcon = false |
There was a problem hiding this comment.
What was the reason for explicitly disabling this? It looks like most weapons leave it enabled
| SWEP.ViewModel = "models/weapons/v_dmascus.mdl" | ||
| SWEP.WorldModel = "models/weapons/w_damascus_sword.mdl" |
There was a problem hiding this comment.
I think this model was part of M9K specialties which we removed (for a number of reasons, including numerous client-side Lua errors).
We can either bundle these assets into this repo (not ideal) or I'll try to get the TF2 sword viewmodel working at some point in the next couple days
| SWEP.HitAnim = ACT_VM_HITCENTER | ||
| SWEP.MissAnim = ACT_VM_MISSCENTER |
There was a problem hiding this comment.
These properties don't seem to exist on the SWEP struct: https://wiki.facepunch.com/gmod/Structures/SWEP
| SWEP.PrimaryDamage = 50 | ||
| SWEP.PrimaryDelay = 0.38 | ||
| SWEP.PrimaryRange = 70 | ||
|
|
||
| SWEP.HitSound = Sound("weapons/blades/swordchop.mp3") | ||
| SWEP.SwingSound = Sound("weapons/blades/woosh.mp3") | ||
| SWEP.HitWallSound = Sound("weapons/blades/hitwall.mp3") |
There was a problem hiding this comment.
Similar to above, these properties are not part of the SWEP struct.
If you need these variables defined for code below, then you can just do local PRIMARY_DAMAGE = 50 etc.
⬆️ SHOUTY_SNAKE_CASE is what we generally use for constants in TAS repos
|
|
||
| if trace.Hit then | ||
| if trace.Entity:IsPlayer() or trace.Entity:IsNPC() then | ||
| self:SetNextPrimaryFire(CurTime() + self.PrimaryDelay) |
There was a problem hiding this comment.
You're already setting the next primary fire time on line 76 above
| local tr = {} | ||
| tr.start = self:GetOwner():GetShootPos() | ||
| tr.endpos = self:GetOwner():GetShootPos() + (self:GetOwner():GetAimVector() * self.PrimaryRange) | ||
| tr.filter = self:GetOwner() | ||
| tr.mask = MASK_SHOT_HULL | ||
| local trace = util.TraceLine(tr) |
There was a problem hiding this comment.
nit: Can you rename the tr variable to traceData and trace to traceResult so this is a little clearer please?
You could also drop the tr variable entirely and just define the table in the call to TraceLine
| function SWEP:SecondaryAttack() | ||
| self:SetNextSecondaryFire(CurTime() + 2) | ||
| local owner = self:GetOwner() | ||
| if IsValid(owner) and owner:IsOnGround() then |
There was a problem hiding this comment.
Given you're applying the velocity in the direction that the player is looking, it might be cool to allow dashing while mid-air too
Not a review comment, just a gameplay suggestion
There was a problem hiding this comment.
i kept it on the ground to make it fair cause if added a double dash then that will be less fair i would say, i can try to make the dash be powerful on how long you hold the secondaryattack button
| local looking = owner:GetAimVector() | ||
| local velocity = looking * 1000 | ||
|
|
||
| owner:SetVelocity(velocity) |
There was a problem hiding this comment.
Instead of overriding the player's velocity, it might be better to apply force instead to make the dash less jarring
| end | ||
| end | ||
|
|
||
| hook.Add("EntityTakeDamage", "PreventFallDamage", function(target, dmginfo) |
There was a problem hiding this comment.
It looks like the GetFallDamage hook would be the better choice here
Changes
Added a sword that lets you leap heal and --kill--
Impact
Fun weapon to mess with
Testing
Leaping attacking the icons are correct the functions word as intended
Helpful Links
Discord