Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [SSGM 4.0 Plugin] NoC4DefuseOnLeave
[SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #467862] Thu, 24 May 2012 01:03 Go to next message
iRANian is currently offline  iRANian
Messages: 4298
Registered: April 2011
Karma: 0
General (4 Stars)
This plugin will change the way Proxy C4 work so they don't get defused after their owner/planter leaves the game. It does this by setting the PlayerDataClass member variable of C4GameObj to NULL after a Proxy C4 has been created and setting the owner to NULL after he left the server. Info about Proxy C4 and their owner is kept and when a player rejoins, their ownership of a Proxy C4 will be restored. Whitedragon and I did some research on changing ownership of mines and Whitedragon also give me crucial help and feedback to get this plugin working.

It's important to check if any server-side mods you're running checks for NULL C4 ownership and a NULL PlayerDataClass member viariable of C4GameObjs, if they access these member variables. I'm also not sure if there are any unusual side-effects caused by this plugin, during testing nothing weird was noticed. This plugin breaks C4GameObj::Restore_Owner() for Proxy C4 so it implements its own version of it. (The function will update the GameObject that owns the Proxy C4 by checking the PlayerDataClass member variable after the owner dies, but because this plugin sets that PlayerDataClass member variable to NULL that doesn't work.)

To install place 'NoC4DefuseOnLeave.dll' in your FDS' root folder and add an entry for it under the [Plugins] section of ssgm.ini.

Thanks to:
Whitedragon - figured out how to change C4 ownership together and gave me important help with writing this plugin.
jonwil - Helped me with a design issue that was bugging me a lot.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491983 is a reply to message #467862] Fri, 10 February 2017 10:26 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Quick convert as dragonade gamefeture add EnableNoC4DefuseOnLeave=1 to any ini read by dragonade.

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491984 is a reply to message #467862] Fri, 10 February 2017 13:44 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3555
Registered: February 2003
Karma: 0
General (3 Stars)

Nice plugin. One thing though, you dont need (and for various reasons shouldn't be using) that ASM block in there. Just do C4->Owner = obj; (or whatever) and the scripts code will do the rest thanks to our implementation of ReferencerClass::operator=


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491985 is a reply to message #467862] Sat, 11 February 2017 00:57 Go to previous messageGo to next message
dblaney1 is currently offline  dblaney1
Messages: 358
Registered: March 2014
Location: United States
Karma: 0
Commander
I removed the cloned c4gameobj stuff and redid it without the asm code as well. To use this though you are gonna need to modify dac4beacon.cpp a tiny bit or it will crash when a proximity mine detonates. This occurs on both the asm and the redone version. Its because references a null pointer. Just replace this one function with this tweaked one that uses Get_Player_Name(get_owner()) to get the name of the player instead of playerdata. This needs to be fixed in a few different spots.

void DAC4BeaconManager::C4_Detonate_Event(C4GameObj *C4) {
	if (C4->Get_Owner()) {
		DALogManager::Write_Log("_C4","%ls %s has detonated (Attached to: %s)",Make_Possessive((StringClass)Get_Player_Name(C4->Get_Owner())),DATranslationManager::Translate(C4),C4->Get_Stuck_Object()?DATranslationManager::Translate(C4->Get_Stuck_Object()):"None");
	}
}


I also attached the fixed da_c4beacon.cpp. It fixes all the issues regarding beacons and c4 with no playerdata.

[Updated on: Sat, 11 February 2017 18:27]

Report message to a moderator

Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491986 is a reply to message #467862] Sat, 11 February 2017 13:00 Go to previous messageGo to next message
dblaney1 is currently offline  dblaney1
Messages: 358
Registered: March 2014
Location: United States
Karma: 0
Commander
Theres a few other spots in that file (DAC4Beacon.cpp) that also need to be fixed. I uploaded the fixed file to the post above this one.

[Updated on: Sat, 11 February 2017 13:19]

Report message to a moderator

Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491987 is a reply to message #467862] Sat, 11 February 2017 13:25 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4298
Registered: April 2011
Karma: 0
General (4 Stars)
r u running it on your test server

And we did the ASM thing back then because the function wasn't exported in TT 4.0. so it was a quick hack, but as jonwil said it's the improper way to do it.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491988 is a reply to message #491987] Sat, 11 February 2017 15:59 Go to previous messageGo to next message
dblaney1 is currently offline  dblaney1
Messages: 358
Registered: March 2014
Location: United States
Karma: 0
Commander
iRANian wrote on Sat, 11 February 2017 13:25

r u running it on your test server

And we did the ASM thing back then because the function wasn't exported in TT 4.0. so it was a quick hack, but as jonwil said it's the improper way to do it.


Yup its on my test server. Its also on my other server ImperialAge AOW. The version I posted has all the hacky parts removed and replaced with the proper TT functions.

[Updated on: Sat, 11 February 2017 15:59]

Report message to a moderator

Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491989 is a reply to message #467862] Sat, 11 February 2017 17:07 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Its on my test server as well. Soon to be on RC.

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #491990 is a reply to message #467862] Sat, 11 February 2017 17:47 Go to previous messageGo to next message
dblaney1 is currently offline  dblaney1
Messages: 358
Registered: March 2014
Location: United States
Karma: 0
Commander
Fixed a few more things in regarding restoring c4 to a player when the server reuses a previous players Player ID. Also fixed some of the logging stuff in dac4beacon.cpp that wasn't working correctly in the last one I posted. The names needed to be WideStringClass not StringClass.

You can download the updated ones here.

http://www.renegadeforums.com/index.php?t=msg&goto=491990&#msg_num_4

[Updated on: Sat, 11 February 2017 17:50]

Report message to a moderator

Re: [SSGM 4.0 Plugin] NoC4DefuseOnLeave [message #492361 is a reply to message #467862] Mon, 08 May 2017 01:34 Go to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
added DisarmTime disarm unowned proxy's after 10 minutes if the c4 has not been claimed or the player returns.

added the ability for players to disarm unowned proxy's or obtain ownership of that proxy. As well as allowing players to disarm their own proxy.

Settings
; Enable No C4 Defuse on Leave
EnableNoC4DefuseOnLeave = 1
; Enable Disarm Time on Leave
Disarm = 1
; Time in seconds to disarm unowned proxys; Default 10 minutes
DisarmTime = 600.0
; Obtain Ownership when you press E on unowned proxy
PokeOwnership = 1
; Disarm when you press E on unowned proxy
PokeDisarm = 0
; Obtain Ownership when you repair an unowned proxy
AttackOwnership = 1
; Disarm when you repair an unowned proxy
AttackDisarm = 0
; Allow players to disarm their own proxy when pressing E or repairing
OwnerProxyDisarm = 1




http://s18.postimage.org/jc6qbn4k9/bricks3.png
Previous Topic: [CODE]Server frame time checker (Thanks to jonwil!)
Next Topic: [SSGM Plugin] EvacPlugin
Goto Forum:
  


Current Time: Thu Mar 28 13:26:27 MST 2024

Total time taken to generate the page: 0.01206 seconds