Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#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)

add_metadata_to_events.patch (480 bytes ) - added by Jonathan Waller 13 years ago.
add_metadata_and_rawEntity.patch (567 bytes ) - added by Jonathan Waller 13 years ago.

Download all attachments as: .zip

Change History (8)

by Jonathan Waller, 13 years ago

by Jonathan Waller, 13 years ago

comment:1 by Jonathan Waller, 13 years ago

Summary: [PATCH] Add AI metadata to destroy events[PATCH] Add AI metadata and rawEntity to destroy events

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.

in reply to:  1 comment:2 by historic_bruno, 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 historic_bruno, 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 Jonathan Waller, 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 ben, 13 years ago

Resolution: fixed
Status: newclosed

(In [10413]) Changes AI entity destroy events to maintain some data about the entity, based on patch by quantumstate. Fixes #983.

comment:6 by historic_bruno, 13 years ago

Keywords: review removed
Milestone: BacklogAlpha 8
Note: See TracTickets for help on using tickets.