Make DropInventory virtual

Moderator: GZDoom Developers

Post Reply
Guest

Make DropInventory virtual

Post by Guest »

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.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Make DropInventory virtual

Post by Blue Shadow »

What prevents you from overriding [wiki]OnDrop[/wiki]?
Guest

Re: Make DropInventory virtual

Post by Guest »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Make DropInventory virtual

Post by Graf Zahl »

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
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Make DropInventory virtual

Post by Matt »

.......

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
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make DropInventory virtual

Post by Nash »

Same, been doing it via CreateTossable for the longest time. Heh, time to go back and edit a lot of stuff...
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”