(fixed) Monsters not found on center tile

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

(fixed) Monsters not found on center tile

Post by Remy »

I noticed that the search_for_monster function (base\methods.lua:262) doesn't check the center tile position, and so monsters standing there are never found, which means alot of attacks miss them. This code added at around line 280 seems to fix it (I'm not yet fully caffienated, so I'm not sure if it's in the proper place):

Code: Select all

monster_id = search_for_type(lev, monx, mony, CENTER, "MONSTER")
if (monster_id) then
     return monster_id
end
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

I put in the check for CENTER a little above where you did (at around line 276), because I thought it'd make more sense to check the center before it checked a back tile.

In normal cases, this wouldn't matter, as they're supposedly mutually exclusive, but this way it's logical just in case someone is doing some kind of 5-monsters-on-a-tile hack-- and I know for a fact someone is ;)
Post Reply