To my knowledge there isn't any function like that, however you can use a custom one. This is a modified A_Blast function that also checks if the player is looking at the monsters:
Spoiler:
Code:
Action void A_DirectionalBlast(double fov = 90, int blastflags = 0, double strength = 255, double range = 255, double speed = 20, sound blastsound = "BlastRadius"){//This is copied directly from gzdoom.pk3:zscript/actors/hexen/blastradius.zsif (player && (blastflags & BF_USEAMMO) && invoker == player.ReadyWeapon && stateinfo != null && stateinfo.mStateType == STATE_Psprite){Weapon weapon = player.ReadyWeapon;if (weapon != null && !weapon.DepleteAmmo(weapon.bAltFire)){return;}}A_StartSound (blastsound, CHAN_AUTO);if (!(blastflags & BF_DONTWARN)){SoundAlert (self);}ThinkerIterator it = ThinkerIterator.Create("Actor");Actor mo;while ( (mo = Actor(it.Next ())) ){if (mo == self || (mo.bBoss && !(blastflags & BF_AFFECTBOSSES)) || mo.bDormant || mo.bDontBlast){ // Not a valid monster: originator, boss, dormant, or otherwise protectedcontinue;}if (mo.bIceCorpse || mo.bCanBlast){// Let these special cases go}else if (mo.bIsMonster && mo.health <= 0){continue;}else if (!mo.player && !mo.bMissile && !mo.bIsMonster && !mo.bCanBlast && !mo.bTouchy && !mo.bVulnerable){// Must be monster, player, missile, touchy or vulnerablecontinue;}if (Distance2D(mo) > range){ // Out of rangecontinue;}if (mo.CurSector.PortalGroup != CurSector.PortalGroup && !CheckSight(mo)){// in another region and cannot be seen.continue;}if ((blastflags & BF_ONLYVISIBLETHINGS) && !isVisible(mo, true)) {//only blast if target can bee seen by calling actorcontinue;}//This code is added for directional detectionActor oldtarg = mo.target;mo.target=self;If(mo.CheckIfInTargetLOS(fov)){//BlastActor is private so we couldn't use it hereIf(!mo.SpecialBlastHandling(self,strength)){Return;}mo.vel.xy = AngleToVector(AngleTo(mo),speed);If(mo.bMISSILE){If(!mo.bFLOORHUGGER&&!mo.bCEILINGHUGGER){mo.vel.z=8;}}Else{mo.vel.z=1000./mo.mass;}If(mo.player){}Else If(!(blastflags&BF_NOIMPACTDAMAGE)){mo.bBLASTED=true;}If(mo.bTOUCHY){mo.bARMED=false;mo.DamageMobj(self,self,mo.health,"Melee",DMG_FORCED|DMG_EXPLOSION);}}mo.target=oldtarg;}}
You can also use this function in DECORATE. Create a new class in ZScript depending on how you want to use it, for example a Weapon:
Code:
Class NewWeapon : Weapon{Action void A_DirectionalBlast(....)}
Then in DECORATE you can inherit your weapons from NewWeapon and freely use this function.
Statistics: Posted by Jarewill — Tue Jan 16, 2024 6:05 am