#983 closed task (fixed)
[PATCH] Add AI metadata and rawEntity to destroy events
Reported by: | Jonathan Waller | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 8 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description
Currently when an entity is destroyed the metadata is lost with no way for the AI to access it. This means when an entity is destroyed an AI can find out nothing about it unless it has cached the detail somewhere else. Forcing AI's to make a secondary metadata cache is not good so this patch puts the metadata into the event object.
The metadata is added to an array so player 2's metadata is in metadata[2] etc. This is because the events object is shared between AI's.
Attachments (2)
Change History (8)
by , 13 years ago
Attachment: | add_metadata_to_events.patch added |
---|
by , 13 years ago
Attachment: | add_metadata_and_rawEntity.patch added |
---|
follow-up: 2 comment:1 by , 13 years ago
Summary: | [PATCH] Add AI metadata to destroy events → [PATCH] Add AI metadata and rawEntity to destroy events |
---|
comment:2 by , 13 years ago
Replying to quantumstate:
Thinking a bit more I thought it would be nice to know more about the destroyed entity so I have added this to the patch.
A question about lines 116-117 in your patch, do evt.msg.metadata
and evt.msg.rawEntity
ever exist in the destroy event? If not, it should be safe to simply assign them without checking against undefined.
comment:3 by , 13 years ago
Oh, I think I see how it works, the event occurs for each AI player, so you're combining the data separately.
comment:4 by , 13 years ago
Yes, the code runs once for every player so that all of the metadata gets deleted. So the second time the code is called this._rawEntities[evt.msg.entity] has already been deleted so the check is vital.
comment:5 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 13 years ago
Keywords: | review removed |
---|---|
Milestone: | Backlog → Alpha 8 |
Thinking a bit more I thought it would be nice to know more about the destroyed entity so I have added this to the patch.