capturetheflag icon indicating copy to clipboard operation
capturetheflag copied to clipboard

[NO SQUASH] Prevent initial stuff being dropped upon player death

Open magnetar47 opened this issue 3 years ago • 0 comments

Closes #1041.

I've also added a method ctf_modebase.player.get_initial_stuff(player). I can think of more use-cases where this information is necessary, apart from this PR.

How it werks

In dropondie, the invlist to be dropped as items is first removed of all initial_stuff for that player. The initial_stuff is moved to a new invlist of equal size, and the indices of these initial items are preserved from the original invlist. What remains in the original invlist is then dropped.

The second part of the PR (which is currently WIP) is to not keep giving the initial stuff on every respawn, as they're preserved across deaths now.

Proposed changes

  • [x] Add method ctf_modebase.player.get_initial_stuff(player) - includes initial items from both map and class.
    • returns { itemstack, itemstack2, itemstack3 }
  • [x] Don't drop initial stuff upon death
  • [ ] Prevent initial stuff from being given every respawn
  • [ ] Testing. More testing. MOAR testing

Testing procedure

  1. Launch CTF. singleplayer should be fine.
  2. Run the following commands: 2.1. /grantme ctf_admin 2.2. /ctf_next -f mode:classes caverns
  3. Arrange your inventory in your own preferred way OR in any random bizzare way.
  4. Die. Just die; how you die doesn't matter - no one cares about you. :P
  5. Once you respawn, make sure you have the default items in the same slots as you had left them. Make sure you have exactly 20 torches and 5 sticks.
  6. Try these different scenarios after each respawn: 6.1. Throw out 10 torches, so that you're left with only 10 torches. 6.2. Collect more torches so that you have more than 20 cobble. 6.3. Don't add or remove any torches in your inventory, but split the existing torches into multiple stacks.
  7. Go to step 3. Keep dying until you're either satisfied with the PR or fed up with life.

Werk-in-progress. Don't start testing right now - I'll let you know when the PR is ready.

magnetar47 avatar Aug 17 '22 09:08 magnetar47