[No] Multiple extends

Moderator: GZDoom Developers

Re: Multiple extends

Postby Gez » Thu Jan 03, 2019 1:10 pm

But things like, say, giving cacodemons blue blood without replacing them will be possible? Or changing the maxamount property of an ammo type?
Gez
 
 
 
Joined: 06 Jul 2007

Re: Multiple extends

Postby Graf Zahl » Thu Jan 03, 2019 1:34 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Multiple extends

Postby Matt » Thu Jan 03, 2019 1:47 pm

So basically something like this would work?
Code: Select allExpand view
extend class Actor{
   virtual void A_CustomChase(vector3 goalpos,statelabel meleestate,...
      ...
}
class CustomZed:Zombieman replaces Zombieman{
   ...
   see:
      POSS ABCD 5 A_CustomChase(...
}
User avatar
Matt
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: Multiple extends

Postby Major Cooke » Thu Jan 03, 2019 1:54 pm

@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
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Multiple extends

Postby Graf Zahl » Thu Jan 03, 2019 2:02 pm

Yes, that would work.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Multiple extends

Postby Major Cooke » Sat Jan 05, 2019 5:10 pm

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
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Multiple extends

Postby Graf Zahl » Sat Jan 05, 2019 6:34 pm

It is called 'extension', not 'modification'. I think that says it all.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Previous

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest