New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTT: Added some useful things #1272

Merged
merged 4 commits into from Nov 29, 2016

Conversation

Projects
None yet
7 participants
@markusmarkusz
Contributor

markusmarkusz commented Nov 6, 2016

A small overview of the changes and some informations about them:

  • I changed the ConCommand that requires sv_cheats 1. Now the Flag FCVAR_CHEAT is used because this is a bit better because it tells the client that the command requires sv_cheats 1.
  • Added a hook to prevent using a traitor button. (Could be useful for some addons.)
    Hook Name: TTTCanUseTraitorButton
    Arguments: ttt_traitor_button-Entity; Player that used the Button (self, ply)
    Return: Return false to prevent using it. You can also return a message that is shown up if you aren't allowed to use the button. (Example: return false, "Not allowed.")
  • Added a second argument to TTTEndRound (Serverside only) that gives the information if the round end was triggered by the map.
    (Could be useful for some addons.)
  • Added a hook that is triggered when a user toggles his disguiser.
    Hook Name: TTTCanToggleDisguiser
    Arguments: player that toggles the disguiser; boolean that tells to which state the disguiser would be changed.
    Return: Return false to prevent toggling the disguiser.
    (This is very useful for addons like the PowerRound-Addon or the TTTDamagelog-Addon.)

@markusmarkusz markusmarkusz changed the title from TTT: Added lots of useful things to TTT: Added some useful things Nov 6, 2016

@robotboy655 robotboy655 added the TTT label Nov 6, 2016

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 6, 2016

Shit. I see that I've made a lot of things wrong with the hooks. :c
I'll correct them on saturday. Ignore this until I've made the changes. Thanks.

@mcNuggets1

This comment has been minimized.

Contributor

mcNuggets1 commented Nov 7, 2016

Add C4 hooks :D

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 7, 2016

I could do this, but not yet. I'm not at home this week.

Am 07.11.2016 12:59 nachm. schrieb "mcNuggets1" notifications@github.com:

Add C4 hooks :D


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1272 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHmRED8yTqNTvy-OgTtaQY4iNzx5vfMDks5q7xKjgaJpZM4Kqo3K
.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 12, 2016

First I changed TTTCanToggleDisguiser to TTTToggleDisguiser. And from now on it can be used to just check who switched the disguiser to which state. It only blocks disguising if you return false.
I also removed the MapWin argument from TTTEndRound-Hook again. This way would never work.
These are possible other ways:

  • GAMEMODE.MapWin is set to true if the end was triggered by the map.
  • a new custom GAMEMODE-Var is added and set to true if the end was triggered by the map.
  • GAMEMODE.MapWin isn't set to WIN_NONE after TTTCheckForWin knows if the map triggers round end.
  • We leave it as it is.
    Chose the way you like.
@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 12, 2016

@mcNuggets1

Add C4 hooks :D

For which events? (Disarm, Arm, Destroy, Pickup, Explode?)
Also what about TTTDamagelogs?
Should the hooks have the same names like the one from TTTDamagelogs? The functions are overwritten so it shouldn't be the biggest problem. Mainly because Tommy's Damagelog breaks some C4 functions..

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 20, 2016

I hope the way I calculate everything is correct.

end
concommand.Add("ttt_debug_testhat", TestHat)
concommand.Add("ttt_debug_testhat", TestHat, nil, nil, FCVAR_CHEAT)

This comment has been minimized.

@bmwalters

bmwalters Nov 20, 2016

Contributor

Should this function even exist?

This comment has been minimized.

@markusmarkusz

markusmarkusz Nov 20, 2016

Contributor

This may be useful for model creators.
They can test if the hat fits to the models head.

@@ -308,4 +308,4 @@ function PANEL:DoRightClick()
menu:Open()
end
vgui.Register( "TTTScorePlayerRow", PANEL, "Button" )
vgui.Register( "TTTScorePlayerRow", PANEL, "DButton" )

This comment has been minimized.

@bmwalters

bmwalters Nov 20, 2016

Contributor

What's the point of this change?

This comment has been minimized.

@markusmarkusz

markusmarkusz Nov 20, 2016

Contributor

Actually, this change doesn't really matter.
Button is deprecated. Changing this does not make a big difference. But I had the time and making a new PR for something like this doesn't really make sense.

@mcNuggets1

This comment has been minimized.

Contributor

mcNuggets1 commented Nov 21, 2016

TTT Damagelogs is an outdated addon with a lot of bugs, even without C4 changes.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 21, 2016

@mcNuggets1

TTT Damagelogs is an outdated addon with a lot of bugs, even without C4 changes

Yes, TTT Damagelogs is outdated. The same thing is with the SpecDM.
But I don't want to break a addon that is on almost every TTT server.
It would be nice if the addon is “officially“ continuted. Perhaps by someone else. But until that I really want to avoid breaking one of these two addons.

@mcNuggets1

This comment has been minimized.

Contributor

mcNuggets1 commented Nov 21, 2016

Progress is the future.

By the way I don't think adding a hook breaks TTTDamagelogs, it just makes the solution of TTTDamagelogs integrating C4 hooks useless.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 21, 2016

@mcNuggets1

Add C4 hooks

For which events? (Disarm, Arm, Destroy, Pickup, Explode?)
Also what about TTTDamagelogs?
Should the hooks have the same names like the one from TTTDamagelogs? The functions are overwritten so it shouldn't be the biggest problem. Mainly because Tommy's Damagelog breaks some C4 functions..

I asked how the hooks should be named.
I know that this shouldn't break anything.
But what if:
I add the hook “TTTPickupC4“.
I create an addon that uses this hook.
A server use this addon and the damagelog.
=> My addon is broken.
If I call the hook “TTTC4Pickup“ it wouldn't be broken.

My question was if I should name these hooks like the one from the Damagelog or if should give them other names.

@mcNuggets1

This comment has been minimized.

Contributor

mcNuggets1 commented Nov 21, 2016

Ask svdm.

It is not my gamemode.

However if the hooks would do the same it would not break anything either.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 21, 2016

I hate GitHub.
I'll fix this merge conflicts as soon as possible.

Edit:
I just hate GitHub. Can anyone tell me how I can edit the file without merge conflicts?

@MinIsMin

This comment has been minimized.

Contributor

MinIsMin commented Nov 22, 2016

@mcNuggets1

TTT Damagelogs is an outdated addon with a lot of bugs, even without C4 changes

Can you list these bugs (MySQL and C4 excluded)?
These C4 hooks are coming in handy.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 22, 2016

@MinIsMin
https://facepunch.com/showthread.php?t=1500900
Btw. I have a DamageLog that is 10 MB big.

I'll add these hooks when I know how to fix these annoying merge conflicts.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 28, 2016

@svdm
Would you accept this PR?
Any suggestions?

Should I create a seperate PR for the C4 Hooks? I really don't know how to fix these merge conflicts.

@svdm svdm merged commit 222de89 into Facepunch:master Nov 29, 2016

@svdm

This comment has been minimized.

Collaborator

svdm commented Nov 29, 2016

Sure, make a separate PR. I actually much prefer a PR to only make changes related to a single feature/bug, that makes it faster to review and merge.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 29, 2016

@svdm
Okay. Thanks for the hint. I will keep this in mind in the future.

local function SetDisguise(ply, cmd, args)
if not IsValid(ply) or not ply:IsActiveTraitor() then return end
if ply:HasEquipmentItem(EQUIP_DISGUISE) then
local state = #args == 1 and tobool(args[1])
if not hook.Run("TTTToggleDisguiser", ply, state) == false then return end

This comment has been minimized.

@markusmarkusz

markusmarkusz Dec 3, 2016

Contributor

Can it be that I have killed the disguiser? I have to test this again later.
(Because I'm checking if the hook returns anything other then false. So if it returns nil it wouldn't work, would it?)

This comment has been minimized.

@willox

willox Dec 3, 2016

Collaborator

returning nil will have the same effect as returning false there, which i think you don't want

@markusmarkusz markusmarkusz deleted the markusmarkusz:patch-2 branch Feb 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment