[Not needed] Make DropInventory virtual

Moderator: GZDoom Developers

Make DropInventory virtual

Postby Martha Pusslecheck » Thu Jun 20, 2019 3:46 am

Talking about this: https://github.com/coelckers/gzdoom/blo ... il.zs#L290

It'd be nice and useful if you could control how an item is dropped. For a very basic example, one may want to instantly place a dropped item in front of the player instead of what it does now. The only workaround to this is to spawn an entirely new item using A_SpawnItemEx and remove the one in the inventory, which could probably work for simpler items, but sometimes they may have variables that should not be lost, and transferring all those adds more complexity to the workaround.
Martha Pusslecheck

Re: Make DropInventory virtual

Postby Blue Shadow » Thu Jun 20, 2019 4:33 am

What prevents you from overriding OnDrop?
User avatar
Blue Shadow
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Make DropInventory virtual

Postby Martha Pusslecheck » Thu Jun 20, 2019 4:48 am

Nothing, really. Now that I look at it, OnDrop is called by DropInventory, so I could definitely override the item's movement in that. Looks good to me! Thanks, Blue Shadow! I can't think of another reason to override DropInventory at the moment.
Martha Pusslecheck

Re: Make DropInventory virtual

Postby Graf Zahl » Thu Jun 20, 2019 5:19 am

The reason this was never made virtual is that DropInventory is a member of the player class, normally you want to alter drop behavior based on the item, not the dropper. And there OnDrop makes more sense.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
Joined: 19 Jul 2003
Location: Germany

Re: Make DropInventory virtual

Postby Matt » Thu Jun 20, 2019 3:00 pm


I've been doing crazy crap with CreateTossable overrides this whole time for nothin' lol

Thanks to the OP for asking this, maybe I can clean up some of this code now (later)...
User avatar
Putting the XD into *xdeath since 2007
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Make DropInventory virtual

Postby Nash » Thu Jun 20, 2019 3:02 pm

Same, been doing it via CreateTossable for the longest time. Heh, time to go back and edit a lot of stuff...
User avatar
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 3 guests