Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coding advice please
- To: crossfire (at) ifi.uio.no
- Subject: Re: coding advice please
- From: Frank Tore Johansen <frankj>
- Date: Fri, 4 Mar 1994 09:07:47 +0100 (MET)
- In-Reply-To: <> from "Peter Mardahl" at Mar 3, 94 10:01:05 pm
Peter wrote:
> About my rune code. I really feel it is done is somewhat
> non-optimally. Right now, the rune checks the square it is in every time
> it moves (speed 1) to check and see if someone or something is stepping
> on it.
>
> It also uses it's move to decide whether it is going to be visible
> this turn or not.
>
> Runes right now 'blink' on and off according to their charisma,
> at random. They are visible 2/charisma of the time, at random.
> This was the best I could think of to conceal them without making
> them totally invisible.
This sounds better than using animation, since animation goes into
archetype, thus can't be changed for any individual object.
> I've thought about using autoapply on runes, but I'm not sure if
> that works for monsters--monsters must also detonate runes if they
> step on one. Can someone who knows a little about autoapply advise me
> a bit? I'd rather not hack the code to figure it out!
There are a couple of flags, "walk_on" and "fly_on" that causes an object
to be applied by the object on top (fly_on triggers flying objects, naturally).
"walk_on" is what causes a button to be pressed if you shoot an arrow
so it lands upon it, so it should fit your need.
> It isn't TOO bad right now. It only checks to see if there's anything
> in the square, so it is not as expensive as a monster.
That's quite fast, compared to the central timing routines...
> Should I worry about this or continue on with other projects and
> worry about efficiency later, or do other experienced coders feel
> this is good enough anyway?
I wouldn't worry all that much about it, though it's easy to add that
"walk_on" flag. All objects; monsters, players and items; would cause
the rune to be applied (just add a hook in apply()).
With this flag, you could also work on the speed; just set speed_left
to a random amount (depending on charisma) for when the rune will blink
again.
-Frank.