Basically, I am trying to make a machine gun that can do suppressing fire: IE continually attack an area in front of the user.
Here is the proc I have made so far:
Suppressing(T as text)
usr.dir = get_dir(usr,src)
if (usr.dir == SOUTH)
if(src.loc==usr.x&usr.y-1)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-1)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-1)
T = "Yes"
else if(src.loc==usr.x&usr.y-2)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-2)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-2)
T = "Yes"
else if(src.loc==usr.x&usr.y-3)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-3)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-3)
T = "Yes"
else if(src.loc==usr.x&usr.y-4)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-4)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-4)
T = "Yes"
else if(src.loc==usr.x&usr.y-5)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-5)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-5)
T = "Yes"
else if(src.loc==usr.x&usr.y-6)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-6)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-6)
T = "Yes"
else if(src.loc==usr.x&usr.y-7)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-7)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-7)
T = "Yes"
else if(src.loc==usr.x&usr.y-8)
T = "Yes"
else if(src.loc==usr.x-1&usr.y-8)
T = "Yes"
else if(src.loc==usr.x+1&usr.y-8)
T = "Yes"
else
T = "No"
So, now I want to make the gun that has a suppressing fire option. When used, it will check src.Suppressing() to see if it is yes or no.
My questions are this:
First, will this code work as written so far?
Second, how should I write the code for the gun? I don't want it to create a target list. I just want it to hit anyone which Suppressing() returns a yes for.
And third, am I doing this the hard way?
Question two, depends on a lot of things.
Question three, yes, yes you are doing it the hard way.
I'll leave expanding the procedure to effect a 3 (or n) tile-wide strip up to you. Although I will give you a hint - try looping through all the turfs within 1 tiles of 'current', and adding any mobs in them to the return list. Being careful not to include the atom 'fire', and adjusting the range the gun shoots to accordingly.