Bug in "frugable" Decorations

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Bug in "frugable" Decorations

Post by Barbie »

All stock classes derived from class'Decoration' that call function Frag() or function SkinnedFrag() and don't have bOnlyTriggerable==True, have a bug: if an Event is set, it is raised twice. Namely they are: Barrel, Cannon, Chair, Chest, Fan2, Table, Urn, Vase, WoodenBox.

Reason: all above decorations have an active function TakeDamage() and call function Frag() or function SkinnedFrag() in it. These functions raise the Event, if given and bOnlyTriggerable==False:

Code: Select all

class Decoration extends Actor abstract native;
...
simulated function Frag(class<fragment> FragType, vector Momentum, float DSize, int NumFrags)  {
	local int i;
	local actor A, Toucher;
	local Fragment s;

	if ( bOnlyTriggerable )
		return; 
	if (Event!='')
		foreach AllActors( class 'Actor', A, Event )
			A.Trigger( Toucher, pawn(Toucher) );
...
Later Decoration.Destroyed() raises the Event also, if given.

Sophisticated test map attached; that SpecialEvent also writes the message to the log file.
Attachments
TestWoodenBox.unr.7z
(27.48 KiB) Downloaded 36 times
TestWoodenBox.jpg
TestWoodenBox.jpg (20.89 KiB) Viewed 972 times
Last edited by Barbie on Wed Dec 20, 2017 5:43 pm, edited 1 time in total.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Bug in "frugable" Decorations

Post by sektor2111 »

I'm currently counting bugs from Engine.u file. Someday I will privately spread a better one regarding to consequences - I'm getting tired of that garbage file which is called Engine. If that is an Engine then I'm Optimus Prime from Cybetron.
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Bug in "frugable" Decorations

Post by Higor »

Not really a bug.
Look at the parameters of all 'Trigger' calls.

If you don't want something happening twice, identify the 'triggerer' or set bTriggerOnceOnly on the destination.
Try not to 'always' know better than the game's creator, stuff can be very intentional.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Bug in "frugable" Decorations

Post by sektor2111 »

True, I do this with movers triggered by... anything - ONCE ONLY if it's not a plain door.
Edit:
Because I recall a previous post about these, after SkinnedFrag, decoration will be destroyed. In destroyed event there is another triggering iterator called which means still two iterators and one of them for sure is pointless. I think I have already removed one in previous session of conforming stock into a better version and I did not see any issue so far at this point.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Bug in "frugable" Decorations

Post by Barbie »

Higor wrote:Try not to 'always' know better than the game's creator, stuff can be very intentional.
Yes, I'm convinced. A mapper sets an Event for a decoration and it is called twice if the deco is destroyed. That's the way it should be.

PS: forgotten to set ironic tags...
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Post Reply