Change to better support multiple up/downs?

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Change to better support multiple up/downs?

#1 Post by yufra »

First off, the more I get into the T-Engine and ToME code the more I appreciate the great work you have done DG. Thanks!

I am working on the first chapter of my Viral Resistance RL (zombie-fallout-ish) and it is going to be set in a military hospital. Modern buildings have multiple staircases throughout the building, and trying to add multiple up/downs and have them link correctly between levels brought me to the following observation: the level.ups and level.downs only contain one position each, and adding additional stairs is not directly supported. This can be traced to engine.Generator.generate, which has the following return signature: startx, starty, endx, endy, spots. These are taken by engine.Zone and dropped into level.ups, level.downs, and level.spots. Is there any interest in having engine.Generator.generate directly return a table ups, a table downs, and a table spots?

Maybe engine.generators.Static could have two additional functions addUp and addDown to populate the tables and also accept the index of the corresponding exit on the connected level? I can try to submit a patch updating the example module first to test it out if you want, and if you like it port ToME over as well.

I believe this would help generalize the API to handle multiple up/downs. Of course, I could just be overlooking the obvious way to handle this. :)
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Change to better support multiple up/downs?

#2 Post by darkgod »

I kinda thought that spots would be used to store the additional stairs, since it allows to give a type and to force a connectivity check.
Then the module must know what to do with them but in any case that is needed.
And the Static generator knows how to add spots already.
But I am open to suggestions if you think your way is better try it and send a patch :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Change to better support multiple up/downs?

#3 Post by yufra »

darkgod wrote:I kinda thought that spots would be used to store the additional stairs, since it allows to give a type and to force a connectivity check.
Then the module must know what to do with them but in any case that is needed.
And the Static generator knows how to add spots already.
But I am open to suggestions if you think your way is better try it and send a patch :)
That makes sense, and the only reason I was looking at level.ups and level.downs was the plurality, thinking that you intended to have all of the stairs collected in those variables. Maybe a simple refactor of level.ups (and level.downs) to be a single table instead of a table of currently one table, and renaming the variable to level.up or level.main_up or level.default_up? I will attach a patch for level.default_up. You will have to edit the diff a bit since I did it using file.old versus file and cobbled the multiple files together into one file. Cheers!
Attachments
refactor.diff.gz
(825 Bytes) Downloaded 181 times
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Change to better support multiple up/downs?

#4 Post by darkgod »

Done :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply