Taverns - implementation

Discuss coding questions, pull requests, and implementation details.
User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Taverns - implementation

Post by Hazelnut »

I'm most of the way though basic implementation of taverns.

Classic DF limits the number of days you can rent a room to 350, anyone have any idea why that limit is there. Like, are there issues with renting a tavern room for more than a year (360 days) that I don't know about?
At the moment I have it simply cap at 999 days. (i.e. you can enter 3 digits)

Also leaning towards leaving dressers etc as private property.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Taverns - implementation

Post by Interkarma »

It's probably just an arbitrary limit but 350 days feels a bit more "in world" like something an innkeeper might say, whereas 999 feels like something a computer programmer would say. I honestly don't mind either way, though. Go with what you feel is best. :)

Agree the dressers should stay private property. it doesn't make sense for player to store items in them permanently, and I'd rather they get the "private property" warning so they don't store items in these containers and lose them by accident.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Taverns - implementation

Post by Hazelnut »

I agree - will implement the limit and leave furniture in taverns private.

Need to allocate random rest marker next.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Feralwarlord
Posts: 117
Joined: Sat Jul 29, 2017 10:08 am

Re: Taverns - implementation

Post by Feralwarlord »

hmmm perhaps you could set the limit to 1 in game year and if someone tries to rent a room for longer than have have the inn keeper spout some line about a local law or a inn policy or something as a reason why you can rent a room for more than a year at a time

R.D.
Posts: 379
Joined: Fri Oct 07, 2016 10:41 am

Re: Taverns - implementation

Post by R.D. »

Yeah I agree with Interkarma it's probably just arbitrary but sounds more "real world" than a 999 day limit so I would go with it.

Great work, by the way! I'll try to help with anything I can.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Taverns - implementation

Post by Hazelnut »

Thanks, just finished up the tavern room renting system. Works great, I'm really happy with it. You can leave anything you like there while you have a rented room and they will actually stay even after rental expires, as long as you don't leave town, for you to pick them up. If you leave town then the tavern keeper sells it all and throws a party! :D

Going to tidy code up and submit PR.

Allofich: I've left a FormulaHelper.CalculateRoomCost() method for you to work your binary wizardy magic on!

I'll do the food and drink menu option soon.

One thing I noticed when I was doing the bed allocation and move to code was there are 'random flat' markers that don't appear to be converted to any normally rendered flat. What are these for, or are they not yet implemented?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Taverns - implementation

Post by Hazelnut »

Took a look at the issue with Daggerfall/The Rusty Ogre Lodge tavern called The White Goblin, and the PlayerGPS.IsPlayerInTown() method is returning false so you can rest without renting a room, and since you don't need to it doesn't put you in bed.

Only other place it's used is GivePc line 82, so I think that function will have the same issue. Or is it intended not to work in lodge type of towns?

Yep adding CurrentLocationType == DFRegion.LocationTypes.Tavern to the conditional works. Is that okay or does givePc have different needs to the resting system?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Taverns - implementation

Post by Interkarma »

Thank you for the info. There's an alignment issue with some single-block locations. I thought I had resolved all of those. I'll take a look at this when I can.

GivePc trigger has different needs. The main thing is you can work around the problem for now in room rentals.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Taverns - implementation

Post by Hazelnut »

Interkarma wrote:Thank you for the info. There's an alignment issue with some single-block locations. I thought I had resolved all of those. I'll take a look at this when I can.

GivePc trigger has different needs. The main thing is you can work around the problem for now in room rentals.
Not sure what alignment issue with single block locations means - could you explain?

GivePc shouldn't work in tavern/lodge locations then? Why is that? The class just says :

"require player to be within a town, outdoors, and during set hours for action to fire"
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Taverns - implementation

Post by Interkarma »

I've just misunderstood what you were saying, sorry.

Historically IsPlayerInTown() would fail due a problem where town was physically offset in the world and location rect was not where it needed to be. This one gave me a fair bit of grief, so my mind went straight to that when you mentioned town check was failing again. Now I understand you're just saying the location type isn't included in the check.

Yep, that's an easy fix and happy for the tavern location type to be added to the conditional. :)

Post Reply