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

Difference between edict and entity?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 10-20-2010 , 18:17   Difference between edict and entity?
Reply With Quote #1

Hey.
Can someone of you explain the exact difference between edict and entity?
I tried to understand it and so I've looked into the SM API.
There are this functions:

CreateEntityByName
RemoveEdict

Edit: And why there is a CreateEdict function? I'm really confused :/

You see that there is no RemoveEntity. Why don't you call it RemoveEntity?

Thanks
Chrisber is offline
BAILOPAN
Join Date: Jan 2004
Old 10-23-2010 , 22:06   Re: Difference between edict and entity?
Reply With Quote #2

Edicts are bits of state sitting as a bridge between the game and the engine. For example they assist in networking.

The reason SourceMod has "RemoveEdict()" is because before 1.3 or so, we only supported edict-backed entities, which have canonical indices maintained in the engine. The game also maintains its own list, and these entities (for example, logical entities) are not maintained in the engine's edict list. So they're much harder to get at, the engine doesn't care and there's no API for them.

SourceMod supports these now (via a backwards-compatible index encoding - pRED knows the details), so RemoveEdict() may just be an archaic name.
__________________
egg
BAILOPAN is offline
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 10-23-2010 , 22:50   Re: Difference between edict and entity?
Reply With Quote #3

Hey.
Thanks for explanation.
Does it mean, that I can access nearly all entities (except the logic ones, starting with logic_) with an edict?

Thanks
Chrisber is offline
BAILOPAN
Join Date: Jan 2004
Old 10-23-2010 , 23:54   Re: Difference between edict and entity?
Reply With Quote #4

Yes. And a correction: the game's list has all entities. It's just that some of them are edictless. Arguably, those indices should be canonical, but it's such a pain to get at them ;)
__________________
egg
BAILOPAN is offline
pRED*
Join Date: Dec 2006
Old 10-24-2010 , 03:22   Re: Difference between edict and entity?
Reply With Quote #5

RemoveEdict wraps the engine function of the same name, and will fail if used to an entity without an edict.
pRED* 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:14.


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