GiveDefaultInventory() always gives another BasicArmor

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: GiveDefaultInventory() always gives another BasicArmor

Re: GiveDefaultInventory() always gives another BasicArmor

by _mental_ » Fri Jun 14, 2019 1:08 am

In my opinion, these lines

Code: Select all

let barmor = BasicArmor(Spawn('BasicArmor'));
barmor.BecomeItem ();
AddInventory (barmor);
should be replaced with

Code: Select all

GiveInventoryType('BasicArmor');
It's the same thing that already works for Hexen armor.

Re: GiveDefaultInventory() always gives another BasicArmor

by Fishytza » Fri Jun 14, 2019 1:06 am

Hmm. In that case maybe change ClearInventory() to DestroyAllInventory() here?
[EDIT]Nevermind. I think mental has the right approach.[/EDIT]

Again, I found out about this without any custom PlayerPawn actors.

Re: GiveDefaultInventory() always gives another BasicArmor

by Graf Zahl » Fri Jun 14, 2019 12:56 am

This function was actually never meant to be called on a PlayerPawn with an initialized inventory. It really should clear the entire inventory before doing its stuff.

GiveDefaultInventory() always gives another BasicArmor

by Fishytza » Fri Jun 14, 2019 12:39 am

IE it gives another one without checking if the player already has one.
https://github.com/coelckers/gzdoom/blo ... r.zs#L1837

I only noticed this while playing a mapset that utilizes ResetInventory in its MAPINFO by typing printinv right after finishing a map (was testing stuff) and seeing multiple BasicArmors being listed.

As I understand it, there should be only one "BasicArmor" in the inventory chain at any time.

Quick edit: was testing in 4.1.3

Top