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

Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-25-2016 , 18:22   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #91

If 'npc.PressE(player);' is the start of your stacktrace how are you setting 'g_Entity[iEnt]'?
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-27-2016 , 04:32   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #92

I've implemented persistent Dynamic objects that wont be disposed by the garbage collector if the owner plugin crashes.

The can be set like so:

PHP Code:
// Set persistence from initialiser
Dynamic someobject Dynamic(__true);

// Set persistence from property
someobject.Persistent true

// You can also check if an object is persistent
if (someobject.Persistent)
{


__________________
Neuro Toxin is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 07-27-2016 , 20:40   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #93

Quote:
Originally Posted by Neuro Toxin View Post
I've implemented persistent Dynamic objects that wont be disposed by the garbage collector if the owner plugin crashes.

The can be set like so:

PHP Code:
// Set persistence from initialiser
Dynamic someobject Dynamic(__true);

// Set persistence from property
someobject.Persistent true

// You can also check if an object is persistent
if (someobject.Persistent)
{


Does this mean that they will be by default? If so, good.
__________________

Last edited by ThatOneGuy; 07-27-2016 at 20:41.
ThatOneGuy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-27-2016 , 22:25   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #94

By default Dynamic objects are `NOT` persistent.

This means you need to set persistence as per my post.

I could add a #define like dynamic_persistent so you can easily toogle a plugin to be persistent to avoid setting persistence on each Dynamic object a plugin initialises.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-27-2016 , 22:54   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #95

I've just added an dynamic_persistent compiler directive.

The usage should be (haven't tested):

PHP Code:
#define dynamic_persistent
#include <dynamic> 
Note: The define MUST be set before including <dynamic>

This should result in all Dynamic objects initialised by the plugin to be persistent without you having to set persistence per object.

Edit: I will mention that persistence hasn't been tested at all, nor have the main .smx files been updated. I will test these over the weekend and push a new version release if everything is all good!
__________________

Last edited by Neuro Toxin; 07-27-2016 at 23:05.
Neuro Toxin is offline
dubbeh
Senior Member
Join Date: Jul 2007
Old 08-03-2016 , 05:31   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #96

Hey Neuro, Found a small problem updating to the latest version with dynamic-collection. Just missing a semicolon.

Added a note on GitHub: https://github.com/ntoxin66/Dynamic/...61037eb0999b42

Keep up the awesome work
__________________
SM Plugins - dubbeh.net - Plugin requests are welcome

Last edited by dubbeh; 08-03-2016 at 05:35.
dubbeh is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-03-2016 , 06:17   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #97

Thanks dubbeh!
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-16-2016 , 09:59   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #98

Some new updates have been pushed onto GitHub

- Only create forward handles when required
The handles used to manage the private forwards for .HookChanges() are created on demand now. This saves 1 handle per Dynamic instance until you create a hook. When all hooks are removed the handle is freed again.
- Rewrite of ReadKeyValues
This is a new implementation using SourceMod's standard KeyValues library. This includes a new hook that allows plugins to block certain keys from loading so you don't waist memory because you don't have a choice.
__________________
Neuro Toxin is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-19-2016 , 11:37   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #99

Quote:
Originally Posted by Neuro Toxin View Post
I've implemented persistent Dynamic objects that wont be disposed by the garbage collector if the owner plugin crashes.

The can be set like so:

PHP Code:
// Set persistence from initialiser
Dynamic someobject Dynamic(__true);

// Set persistence from property
someobject.Persistent true

// You can also check if an object is persistent
if (someobject.Persistent)
{


So basically if I don't set them to persistent, I can safely just not dispose them in OnPluginEnd?
__________________
retired
shavit is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-19-2016 , 19:57   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #100

Correct.

Do be aware that garbage collection occurs on map end, as there isnt a hook to catch a plugin stopping.
__________________
Neuro Toxin is offline
Reply



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 20:13.


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