Raised This Month: $12 Target: $400
 3% 

[L4D & L4D2] Left 4 DHooks Direct (1.144) [05-Mar-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-26-2020 , 23:02   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #181

Code:
1.23 (27-Sep-2020)
    - Update by "ProdigySim" to fix Addons Eclipse. Thank you!
Allow or Disallow addons via cvar (l4d2_addons_eclipse)/plugin/by SteamID working again!

Big thanks thanks to "ProdigySim" for figuring out the new offsets and testing on Windows/Linux.
__________________

Last edited by Silvers; 09-26-2020 at 23:35.
Silvers is offline
devilesk
Junior Member
Join Date: May 2019
Old 09-27-2020 , 00:47   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #182

There's an issue with a few functions like L4D2Direct_GetVSTankToSpawnThisRound because it's trying to look up the values by round rather than by team. For example, if you're trying to look up whether the tank will spawn in the current round by doing L4D2Direct_GetVSTankToSpawnThisRound(GameRule s_GetProp("m_bInSecondHalfOfRound")) you'll be looking up the wrong team's value if it's the first round and teams are flipped or if it's the second round and teams aren't flipped.

This is the fix I came up with for l4d2_direct which takes into account m_bInSecondHalfOfRound and m_bAreTeamsFlipped to convert the given round number argument to the correct team number to use in the lookup. https://github.com/devilesk/rl4d2l-p...95ef6b5b8db47f
devilesk is offline
Beatles
Senior Member
Join Date: Feb 2014
Old 09-27-2020 , 14:47   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #183

In left4dhooks.l4d1.txt need to add: TakeOverBot, SetHumanSpec, AddUpgrade, RemoveUpgrade, SetModel, CTerrorPlayer::GoAwayFromKeyboard, CTerrorPlayer::SpawnTimer, CDirector::VersusStartTimer, CTerrorWeapon::TrySwing, TrySwing_Offset, TrySwing_Count, CTerrorWeapon::TrySwing and more, much more.

Last edited by Beatles; 09-27-2020 at 15:01.
Beatles is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-27-2020 , 15:17   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #184

Quote:
Originally Posted by devilesk View Post
There's an issue with a few functions like L4D2Direct_GetVSTankToSpawnThisRound because it's trying to look up the values by round rather than by team. For example, if you're trying to look up whether the tank will spawn in the current round by doing L4D2Direct_GetVSTankToSpawnThisRound(GameRule s_GetProp("m_bInSecondHalfOfRound")) you'll be looking up the wrong team's value if it's the first round and teams are flipped or if it's the second round and teams aren't flipped.

This is the fix I came up with for l4d2_direct which takes into account m_bInSecondHalfOfRound and m_bAreTeamsFlipped to convert the given round number argument to the correct team number to use in the lookup. https://github.com/devilesk/rl4d2l-p...95ef6b5b8db47f
Looks like you've modified and used "include/l4d2_direct.inc". Left4Dhooks is based on that but has different code. So no changes will be made to this plugin.



Quote:
Originally Posted by Beatles View Post
In left4dhooks.l4d1.txt need to add: TakeOverBot, SetHumanSpec, AddUpgrade, RemoveUpgrade, SetModel, CTerrorPlayer::GoAwayFromKeyboard, CTerrorPlayer::SpawnTimer, CDirector::VersusStartTimer, CTerrorWeapon::TrySwing, TrySwing_Offset, TrySwing_Count, CTerrorWeapon::TrySwing and more, much more.
Go ahead and add, hardly any servers using L4D1 version and I have no interest in spending more time to add features for 1 person.
__________________
Silvers is offline
devilesk
Junior Member
Join Date: May 2019
Old 09-27-2020 , 16:16   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #185

Quote:
Originally Posted by Silvers View Post
Looks like you've modified and used "include/l4d2_direct.inc". Left4Dhooks is based on that but has different code. So no changes will be made to this plugin.
I looked at your code and although it's different it still suffers from the same problem.

left4dhooks
Quote:
return LoadFromAddress(view_as<Address>(VersusModePt r + m_bTankThisRound + round), NumberType_Int;
l4d2_direct
Quote:
return bool:LoadFromAddress( L4D2Direct_GeVSTankToSpawnAddr() + Address:roundNumber , NumberType_Int8 );
The problem in both is that it's just using the round number and not taking into account which half it is and if teams are flipped.

I've also tested it using left4dhooks and confirmed that it's an issue. https://imgur.com/a/fZiNPaI

Test code used:
Quote:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <left4dhooks>

public Plugin:myinfo = {
name = "Round Tank Test",
author = "devilesk",
description = "Test tank spawn check functions.",
version = "1.0.0",
};

public OnPluginStart() {
RegConsoleCmd("sm_testtank", Command_Test);
}

public Action:Command_Test(client, args) {
PrintToChat(client, "InSecondHalfOfRound: %i", GameRules_GetProp("m_bInSecondHalfOfRound"));
PrintToChat(client, "AreTeamsFlipped: %i", GameRules_GetProp("m_bAreTeamsFlipped"));
PrintToChat(client, "1st Round Tank: %i", L4D2Direct_GetVSTankToSpawnThisRound(0));
PrintToChat(client, "2nd Round Tank: %i", L4D2Direct_GetVSTankToSpawnThisRound(1));

return Plugin_Handled;
}
I posted my fix for l4d2_direct as an example of the same fix that could be applied to your plugin.

Last edited by devilesk; 09-27-2020 at 16:21.
devilesk is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-27-2020 , 16:53   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #186

The method used is reading/setting for the first or second round being played, regardless of which team started first/teams flipped. I don't see how this is wrong and the way it's handled is correct. What you're doing is totally changing the way these functions are used by making it change witch/tank based on team and not the round. Otherwise you've completely lost me.
__________________
Silvers is offline
devilesk
Junior Member
Join Date: May 2019
Old 09-27-2020 , 19:07   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #187

Quote:
Originally Posted by Silvers View Post
The method used is reading/setting for the first or second round being played, regardless of which team started first/teams flipped. I don't see how this is wrong and the way it's handled is correct. What you're doing is totally changing the way these functions are used by making it change witch/tank based on team and not the round. Otherwise you've completely lost me.
It's wrong because the game is updating the values by team. Treating it as if you're looking up values by round will give you the wrong values when the game updates them in the following two cases:
is second half = 0 AND teams flipped = 1
is second half = 1 AND teams flipped = 0

Let me describe in detail a test I've run using the current left4dhooks and the results. Suppose the starting team for a map has been flipped, i.e. a map has been played and the second round survivors outscored the first round survivors. That falls under the first case where in the next map it will be the first round and teams are flipped.

Case 1: If you call L4D2Direct_GetVSTankToSpawnThisRound(0) and L4D2Direct_GetVSTankToSpawnThisRound(1) before any tanks have spawned both will return 1 as expected. Then if the survivors spawn the tank, L4D2Direct_GetVSTankToSpawnThisRound(0) still returns 1 yet L4D2Direct_GetVSTankToSpawnThisRound(1) now returns 0. It should be the other way around, because the first round tank has spawned.

Case 2: Now if you proceed to the next round, it becomes case 2, second half and teams not flipped. The values returned by L4D2Direct_GetVSTankToSpawnThisRound(0) and L4D2Direct_GetVSTankToSpawnThisRound(1) will still return 1 and 0 respectively, the opposite of what we expect. Then if survivors spawn the tank, L4D2Direct_GetVSTankToSpawnThisRound(0) will return 0 even though it's the second round tank that has spawned.

Here's a table showing all the different cases. https://i.imgur.com/sCZJlHv.png Round input is what is passed to L4D2Direct_GetVSTankToSpawnThisRound and the last column is the conversion of round to team. The first two columns are the "is second half" and "teams flipped" states of the game.
You can see how using the round input directly differs from converting it to a team. Round input is the same as team for the first four cases, but the values are flipped in the last four cases, which fixes the problem I described above.

Quote:
LoadFromAddress(view_as<Address>(VersusModePt r + m_bTankThisRound + round), NumberType_Int
In other words, this "round" offset you've added to the address, you've just assumed to be a round. What I've found through testing is that it's supposed to be a team.

Last edited by devilesk; 09-27-2020 at 19:15.
devilesk is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-27-2020 , 19:32   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #188

Ok thanks, I'll take your word for it and make the change.

Code:
1.24 (27-Sep-2020)
    - Reverted change: native "L4D_GetTeamScore" now accepts values 1 and 2 again.
    - Changed natives:
        "L4D2Direct_GetVSTankFlowPercent", "L4D2Direct_SetVSTankFlowPercent", "L4D2Direct_GetVSTankToSpawnThisRound",
        "L4D2Direct_SetVSTankToSpawnThisRound", "L4D2Direct_GetVSWitchFlowPercent", "L4D2Direct_SetVSWitchFlowPercent",
        "L4D2Direct_GetVSWitchToSpawnThisRound" and "L4D2Direct_SetVSWitchToSpawnThisRound".
    - Corrected natives "roundNumber" to consider "m_bAreTeamsFlipped" and "m_bInSecondHalfOfRound".
    - Thanks to "devilesk" for native value clarification.
__________________

Last edited by Silvers; 09-27-2020 at 20:08.
Silvers is offline
Beatles
Senior Member
Join Date: Feb 2014
Old 09-27-2020 , 21:17   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #189

Quote:
Originally Posted by Silvers View Post
Go ahead and add, hardly any servers using L4D1 version and I have no interest in spending more time to add features for 1 person.
What are you talking about? In today's registry we have 1346 active servers, which is more than half the number of servers that L4D2 has, when you started this I thought it would be a solution to the forgotten obsolete "Left4Downtown" that was of no use to us, but boy, was I wrong, it is yet another project that is still obsolete for our L4D1 servers.
Beatles is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-27-2020 , 21:56   Re: [L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]
Reply With Quote #190

Quote:
Originally Posted by Beatles View Post
What are you talking about? In today's registry we have 1346 active servers, which is more than half the number of servers that L4D2 has, when you started this I thought it would be a solution to the forgotten obsolete "Left4Downtown" that was of no use to us, but boy, was I wrong, it is yet another project that is still obsolete for our L4D1 servers.
http://www.sourcemod.net/stats.php?m...&addon_id=3169
Code:
Addon 	Game Mod 	Servers 	% of Mod
[L4D & L4D2] Left 4 DHooks Direct (1.13) [05-May-2020] 	Left 4 Dead 2 	317 	1.10%
[L4D & L4D2] Left 4 DHooks Direct (1.13) [05-May-2020] 	Left 4 Dead 	16 	0.35%
I already added lots more for L4D1 which next existed in the extension, lots of natives and forwards.

What plugins are using those functions you requested or what plugins need them? There are hundreds of game functions where do we draw the line? Bunch of the ones you mentioned are not used by Left4DHooks in L4D2 either.

I've seen some of those functions used by plugins but they provide their own gamedata. I don't see what the difference would be either than making me support more signatures and have to spend more time on stuff that already exists. I just don't see them being used much if at all and I don't have time these days to add so much more stuff. That's why I said if you want to find the signatures or add it in, go ahead and I'll add to Left4DHooks. Can't expect me to always do everything forever, the community needs to help support also.
__________________
Silvers is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode