ID:162329
 
I need help to make it so if you DblClick it again the sheild/icon with desity of 1(byakublade) will be deleted also if you can show me how to improve this peoce of coding e.g. how to use less vars


obj
icon = 'CPU.dmi'
icon_state="CPU"
density = 1
name="CPU"
DblClick(obj in oview(1))
if(src in oview(1))
src.on=0
var/obj/byakublade/A = new/obj/byakublade
A.loc=locate(usr.x+2,usr.y-6,usr.z)
var/obj/byakublade/B = new/obj/byakublade
B.loc=locate(usr.x+3,usr.y-6,usr.z)
var/obj/byakublade/C = new/obj/byakublade
C.loc=locate(usr.x+4,usr.y-6,usr.z)
var/obj/byakublade/D = new/obj/byakublade
D.loc=locate(usr.x+5,usr.y-6,usr.z)
var/obj/byakublade/E = new/obj/byakublade
E.loc=locate(usr.x+6,usr.y-6,usr.z)
Dont know what type of game your making or what the purpose of the thing is... But my advice is to add the created objs to a list attached to the mob. So then the delete code would look like this:
for(var/obj/byakublade/b in usr.byaklist)
del(b)
In response to Saucepan Man
Hmm this system creates a barrier at the door when u click it so people cant get in then u click it again and the barrier should close or be deleted
In response to Chrislee123
-bump-