![]() |
#1 |
Knight
Join Date: Jul 2009
Posts: 654
![]() |
Trying to figure out why gold is not always autopicked up
Okay, browsing through the game files, I have come to this conclusion:
Gold is free to pickup energywise based on game files Moving on top of =g items manually seems to autopickup those (energy free?) even if monsters are visible, based on just playing the game. Does it cost extra energy? Not quire sure what the code means with that ... Player disturb flushes cmd queue If running (moving with shift down for me) on top of a gold pile, and the character moving causes a disturbance (new monster, monster moves, yadda yadda), it will trigger a disturb to flush cmd queue However, this ALSO flushes the autopickup command from the cmd queue Hence, gold will stay on ground, causing me to backtrack and be annoyed with QoL gameplay issues I guess my question at this point is: Does autopickup for ammo for example cost extra energy when moving on them? If so, that is causing me extra risk sometimes, ouch If not, then I could just adjust the code to re-insert the autopickup cmd to the cmdqueue after the disturb in the disturb code? Also, the 'obvious things' isn't that obvious to me, lol. If I understand it correctly, if the autopickup picks up more than move energy cost / 10 items the move action costs 0.1x items picked up, otherwise normal move cost? So without +Steps items, and move energy cost of 100, any movement that picks up more than 10 autopickup items will cost more energy? Here is the code ... Does ammo calculate as 1/40 items per item? So a full stack is just 1 item? Gah ... Code:
/** * Pick up or look at objects on a square when the player steps onto it */ void do_cmd_autopickup(struct command *cmd) { /* Get the obvious things */ player->upkeep->energy_use = do_autopickup(player) * z_info->move_energy / 10; if (player->upkeep->energy_use > z_info->move_energy) player->upkeep->energy_use = z_info->move_energy; /* Look at or feel what's left */ event_signal(EVENT_SEEFLOOR); /* Redraw the object list using the upkeep flag so that the update can be * somewhat coalesced. Use event_signal(EVENT_ITEMLIST to force update. */ player->upkeep->redraw |= (PR_ITEMLIST); } |
![]() |
![]() |
![]() |
#2 |
Knight
Join Date: Jul 2009
Posts: 654
![]() |
No wait, that is the other way around in the code ...
Energy use would be items * move-energy / 10, maxed out at move-energy? But but but ... why the heck do we even then calculate this energy stuff on autopickup, since we already are moving and will be deducting the move-energy anyways? I am confused ... |
![]() |
![]() |
![]() |
#3 |
Swordsman
Join Date: Aug 2019
Posts: 296
![]() |
After a walk or a run moves the player, this is a streamlined version of what will happen:
For fixing the annoyance of gold not being automatically picked up in some situations, a call to player_pickup_gold() gold could be added (would have to make it a public function as well) when the autopickup command is added to the command queue. That would slightly change the timing for the pickup of the gold but would avoid disturbances preventing the gold from being picked up. |
![]() |
![]() |
![]() |
#4 |
Knight
Join Date: Jul 2009
Posts: 654
![]() |
Yeah that was one thing I was thinking, that might need to create the gold pickup into those function definition files outside of pickup file ... the energy cost lines confuse me a bit, are the -> things calling for checks or for actually reducing energy.
To be safer for doubledisturbance avoidance, I guess I need to make the gold pickup separate and have it called separately before checking for disturbances after a move. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can anyone help me figure out why I am -8 speed? | ehertlein | Vanilla | 16 | March 4, 2021 15:38 |
[4.2.1] How to figure out why am I slow? | Monk | Vanilla | 45 | July 14, 2020 16:22 |
Gold and no_selling | Sirridan | Vanilla | 120 | January 19, 2011 21:48 |
Squelching for gold | Nick | Vanilla | 31 | August 14, 2009 16:14 |
V3.0.9 Negative gold? | Dragonboneman | Vanilla | 7 | February 2, 2008 14:10 |