Multiple extends

Moderator: GZDoom Developers

Gez
 
 
Posts: 17831
Joined: Fri Jul 06, 2007 3:22 pm

Re: Multiple extends

Post by Gez »

But things like, say, giving cacodemons blue blood without replacing them will be possible? Or changing the maxamount property of an ammo type?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Multiple extends

Post by Graf Zahl »

No. There can only be one defaults block. This isn't for altering actors but for injecting common code and related data into the base class.
Like, you want some special death state that requires common data and functions. You can now place that stuff in Actor and then inherit from the single monsters and add the new state using that common stuff.
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: Multiple extends

Post by Matt »

So basically something like this would work?

Code: Select all

extend class Actor{
	virtual void A_CustomChase(vector3 goalpos,statelabel meleestate,...
		...
}
class CustomZed:Zombieman replaces Zombieman{
	...
	see:
		POSS ABCD 5 A_CustomChase(...
}
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Multiple extends

Post by Major Cooke »

@Graf: Ah well. Thanks to CheckReplacement in event handlers, it somewhat makes state label overrides a novelty idea at any rate that's entirely unneeded.

@Matt: Yep, pretty much. Also variables.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Multiple extends

Post by Graf Zahl »

Yes, that would work.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Multiple extends

Post by Major Cooke »

Is it safe to assume that that same restrictions will apply, i.e. you cannot perform an override on the actor functions in the base class when extending it? Just making sure, I figured it would be.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Multiple extends

Post by Graf Zahl »

It is called 'extension', not 'modification'. I think that says it all.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”