adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] User interface open items


From: Kai Sterker
Subject: Re: [Adonthell-devel] User interface open items
Date: Thu, 9 Feb 2012 10:41:00 +0100

On Thu, Feb 9, 2012 at 1:34 AM, StyxD <address@hidden> wrote:

> I'm having some more issues with the event architecture. I can't
> decide whether I should change my approach or if it's worthy to extend
> the event module.

Couldn't you do the following? Create a time event with a small
interval, then set repeat to a finite number, so that interval *
repeat equals the lifetime of the bubble.
Then use the simple factory::register_event method to hook up the
update_position() method of your bubble object. In there you can then
check the repeat count of the passed event structure and once it
reaches 0, destroy the bubble.

That would allow you to work with a single time event and you will not
have to re-register events every time.

The one issue I see is that in listener_python::raise_event, the
triggering event is passed to the callback, not the one you
registered. So you will not get at the recent repeat count. So the
triggering event would have to be updated with the current repeat
count before executing the callback. But this would be the only change
to the event module required.

Would that work for you?


> I also wonder, whether there should be some kind of character action
> event. Like "on character's movement" or "character reached point x,y
> on map". Or is it handled by schedules?

Don't think you'd need this with the approach above, but generally
there needs to be a move event for characters. The idea would be that
the move event structure contains start and end coordinates of the
move and the id of the character performing the move. This could be
triggered in moving::update().

The event structure would also have the two fields leaving and
entering that could be set to the name of a zone. The
move_event_handler could then check based on start and end coordinates
if this move took the character in or out of the given zone.

Of course a move callback could be registered with

* just a character id,
* just an entering zone id
* just a leaving zone id
* character id + entering zone id
* character id + leaving zone id

So your bubble could register the character it belongs to. A sensitive
area on the map (trap or pressure plate, etc.) could register for any
character entering or leaving its area.

So if you wanted to spent the extra effort, you could work with a move
event to update bubble position (which would be more efficient than
the repeating timer) and a one-time timer to destroy the bubble.

Maybe I could work on the move event implementation. Hadn't given it
that much thought before, and was unsure how to properly handle the
entering and leaving of zones. But it seems this is pretty simple if
the event contains both start and end of the move.


Let me know what you think and how you would like to proceed.

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]