TTT: Death Faker

Nothing special.
Just a death faker for the famous gamemode Trouble in Terroristtown.

You can change the death reason by clicking the Reload-Key.
Primary Key and Secondary Key will throw the fake body.

This death faker works even if you are using addons like the Spectator Deathmatch or any other addon that modifies the scoreboard!
It should work with almost every addon.

Steam Workshop: http://steamcommunity.com/sharedfiles/filedetails/?id=785423990
GitHub Repository: https://github.com/markusmarkusz/ttt_death_faker

Some general feedback:

  • What are the benefits of your addon over Exho’s?
  • I see that you made a PR to change some PrintName variables to shared, yet in your own swep it’s clientside only?
  • Your addon structure should be such that a git clone from the addons folder should properly install it. To fix your structure, move the lua folder to the root directory of the repository.
  • I don’t know how I feel about the fact that your addon contains a workaround to addons which override the ScoreGroup function. Those addons should instead be fixed. If not, it might be wise to distribute that code as a separate addon or at least a separate file.
  • It might be cleaner organization-wise to move all the hooks and DeathFaker table stuff into a separate file.
  • You declare a “wait” global variable on line 87, which is not only bad practice but can cause problems if for example multiple players have a death faker. You should instead set a variable on the weapon itself, like self.wait
  • Additionally, the fact that you use a timer to clear the wait cooldown is bad practice (it may cause problems in predition). A better method would be something like:
    [lua]
    SWEP.DamageTypeChangeCooldown = 1

function SWEP:Reload()
local lastchange = self.LastDamageTypeChange
local cooldown = self.DamageTypeChangeCooldown
if (CurTime() - lastchange) < cooldown then return false end

-- whatever code

self.LastDamageTypeChange = CurTime()

return false

end
[/lua]

  • self.Owner is bad practice (it may even be labelled as deprecated); you should be using self:GetOwner()
  • Your random weapon code only considers weapons that directly inherit from weapon_tttbase, even though weapons from other bases can be valid TTT weapons.
  • I noticed you used a lot of code to create the ragdoll; I’m fairly sure that TTT exposes a function you can call to accomplish this (maybe not though)
  • Your Workshop item thumbnail is squashed and generally not very attractive. You could probably take a few minutes to Photoshop/Paint.NET/mspaint up a better one to attract more users.

That’s all I found from a quick glance. Nice job though.

This ScoreGroup Shit (it’s really like cancer for me) is done for users that don’t know how to fix issues with addons like Tommy’s Spectator Deathmatch.

I’m very bad in designing images. So I just made a screenshot for the workshop :3.

I’ll change the other things later (in some hours).

(And: Shit? I made wait to a global var. Oops.)
Thanks for feedback.

SWEP.PrintName is now shared.

Done.

As I said, this is for addons like the Spectator Deathmatch or the Dead Ringer. These addons aren’t up to date and they’re coded like shit.
So I decided to add this shit (this part of the code looks really like shit) to make it compatible with these addons. Not everyone knows how to fix issues with these addons and I want to have it working for everyone.

Done.

This was a mistake by me. I have changed it.

Changed.

Now only SpecDM weapons are filtered out.

I’ve made it shorter.

some benefits:

  • Works with almost every addon.
  • It’s more realistic (e.g. Steam Avatar is shown in the body instead of a question mark).
  • Bigger weapon selection if death reason is bullet damage.

Update.

Changelog:

  • Changed file structure (again)
  • Better Performance
  • Reworked many parts of the code
  • Death Faker can now be dropped
  • Fixed possible errors

GitHub Commit: https://github.com/markusmarkusz/ttt_death_faker/commit/ae7fb2a9fb552274c88cef3767821ba6da0c7f1e