datalurkur / Mountainhome

A detailed and intricate worldsim borrowing from the Dungeon Keeper-style dungeon-building mechanic
You're lookin' at it.
6 stars 2 forks source link

Create an in-game console #74

Closed StLoch closed 14 years ago

StLoch commented 14 years ago

We need to decide if the console should be available everywhere or just in the game. If it's the former, it should definitely have its own state that can be pushed and popped at will. If it's the latter then, then we can go the state route again OR we can have it be another object (next to UIManager, World, etc...) in the game state that is deferred input by the EventTranslator. The state solution is probably the best, though.

datalurkur commented 14 years ago

Yeah, it would be nice to be able to get at the ruby scripts during world generation, for example. I like the state idea, it seems reasonable.

StLoch commented 14 years ago

I'm thinking we should have the ruby console execute its code in whatever state it was pushed on top of. For example, if the console is opened in the MainMenuState, you'll be working in the MainMenuState's scope. If you were in GameState, it's executed in GameState, etc... Means the console will act differently in different places, but whatever.

datalurkur commented 14 years ago

Sounds like we need to swap out the proc in the console whenever we change states. That should be easy enough; we'll just need to create a method in Console to set the eval proc after object creation, as that's where it's specified currently.

StLoch commented 14 years ago

I'd say this is done.