Light sources (in-game)

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

Re: Light sources (in-game)

Post by Hazelnut » Fri Nov 02, 2018 11:23 am

DFU candles give out as much light as a lantern, but don't last very long. That's the trade off, also made them lighter along with oil.

Unfortunately there's a bug with buying stacks of oil where one of the stack is moved from basket to player items when selecting from the shelf. Basically get a free bottle just for selecting. It works fine when I single step the code, and I am stumped.

EDIT: Found it, it's the auto-stack split when equipping items. The way it works is it calls to equip with any item, and just fails for non-equippable items. The auto-split is happening even if the item is non-equippable and is also assuming that the item is in the player items collection, which in this case it isn't. This is going to need a change... I think when selecting stacks in trade window, it will not attempt to auto-equip one. That should fix this specific edge case. Pango, there is a bug here. Use equip on a stack of ingredients... it de-stacks 1 per attempt. I've moved the de-stack to after the slot check to fix this.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Light sources (in-game)

Post by Hazelnut » Fri Nov 02, 2018 12:29 pm

I have it set so mundane light sources have only 80% the range of the light spell so there's still advantages to the spell regarding range and weight cost.

Also enabled holy candles as light sources. Are there any items Ive missed?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Jay_H
Posts: 3145
Joined: Tue Aug 25, 2015 1:54 am

Re: Light sources (in-game)

Post by Jay_H » Fri Nov 02, 2018 1:08 pm

I've wavered a bit on the proper length, but I believe 32 is preferable to 16. Players will have to spend a bunch of oil each time they enter a dungeon, and there's going to be the shopping factor to find more oil likewise. Tedium is going to have to be an important factor here while not invalidating the point of this addition.

On a more positive note, there's the future thought, "I have to find this thing now or I'm gonna run out of light and be stuck down here!", which to me is an exciting aspect of adventuring :) The choice of risking another 3 minutes in the depths or playing it safe and running to a nearby town to refuel is a pleasant one to me.
Come join Lysandus' Tomb, a Daggerfall Unity fan Discord.
See the Daggerfall Unity Wiki on the UESP.

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

Re: Light sources (in-game)

Post by Hazelnut » Fri Nov 02, 2018 1:25 pm

Each oil bottle provides now 8 minutes real-time (1.5 hours in-game time) of light. So a stack of 20 bottles (5kg, 10gp) plus a full lantern should be sufficient to explore a dungeon if it takes you 3 hours of playing and you have the lantern lit constantly.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
pango
Posts: 2172
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Light sources (in-game)

Post by pango » Fri Nov 02, 2018 3:49 pm

Hazelnut wrote:
Fri Nov 02, 2018 11:23 am
DFU candles give out as much light as a lantern, but don't last very long. That's the trade of
There's a trade off indeed, and I was trying to defend another one, so that adventurers are less likely to be totally out of light source, but make the fallback really feel like a fallback. Say, with a candle, even in the darkest dungeon you can still see corridor walls left and right of you, and can avoid falling into pits if you walk carefully, but nothing more.
Hazelnut wrote:
Fri Nov 02, 2018 11:23 am
EDIT: Found it, it's the auto-stack split when equipping items. The way it works is it calls to equip with any item, and just fails for non-equippable items. The auto-split is happening even if the item is non-equippable and is also assuming that the item is in the player items collection, which in this case it isn't. This is going to need a change... I think when selecting stacks in trade window, it will not attempt to auto-equip one. That should fix this specific edge case. Pango, there is a bug here. Use equip on a stack of ingredients... it de-stacks 1 per attempt. I've moved the de-stack to after the slot check to fix this.
Damn, I thought stack splitting was done late enough in the list of checks that it would only happen on equippable items. And the concept of basket list is still not entirely clear to me.
Are there still pending issues after your fix?
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

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

Re: Light sources (in-game)

Post by Hazelnut » Fri Nov 02, 2018 4:04 pm

I don't think so, I think it's sorted now, but there might be.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
pango
Posts: 2172
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Light sources (in-game)

Post by pango » Fri Nov 02, 2018 4:51 pm

@Hazelnut: ok, here's a fix for the issues you described, I can't really test it without your own changes so feel free to merge it into your light sources branch if it looks ok
https://github.com/Interkarma/daggerfal ... -split-fix

PS Oh wait, I could fetch your branch :oops:
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

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

Re: Light sources (in-game)

Post by Hazelnut » Fri Nov 02, 2018 5:26 pm

I already fixed it in my PR, sorry if I was not clear.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
pango
Posts: 2172
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Light sources (in-game)

Post by pango » Fri Nov 02, 2018 5:36 pm

It was clear, but I delayed stack splitting even more compared to your test, and added a check that we're only attempting a stack split on stacks that are in player's inventory. I guess we could allow stack splitting inside basket list... would be nicer, I'm not sure if it's worth it)
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

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

Re: Light sources (in-game)

Post by Hazelnut » Fri Nov 02, 2018 6:06 pm

I don't think we should either. when buying stuff it auto-equips, but that is not desirable for any stacked items thinking about it. It would only really work for some gems I think, and it's confusing enough with just one item, let alone a stack having one split off and equipped. I'm happy to leave it restricted to just items in player items unless you find any issues with my fix the extra delay and check are unnecessary. Otherwise it's adding complexity for no useful gain. It was not obvious that trade window did things a bit differently and was causing this issue, and I wrote it so understandable you missed that edge case. I was very confused for a while there. :?

Thanks for looking at it though, but I think it's fine without your extra changes. I definitely appreciate you adding all this stack handling though. I'd meant to get to it for a while, but never quite got around to it... i.e. the motivation didn't come. :)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply