spacing and fixes the spam-self-attack exploit with the picker

This commit is contained in:
FreeStylaLT
2019-08-02 18:19:56 +03:00
parent 7153552297
commit 2a0a0769b0
3 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -397,5 +397,5 @@
//Engine types
#define ENGTYPE_SING "Singularity"
#define ENGTYPE_SM "Supermatter"
#define ENGTYPE_SM "Supermatter"
#define ENGTYPE_TESLA "Tesla"
+1 -1
View File
@@ -49,4 +49,4 @@ GLOBAL_LIST_EMPTY(mob_spawners) // All mob_spawn objects
GLOBAL_LIST_EMPTY(explosive_walls)
GLOBAL_LIST_INIT(engine_beacon_list, list())
GLOBAL_LIST_EMPTY(engine_beacon_list)
@@ -12,15 +12,25 @@
icon_state = "enginepicker"
var/list/list_enginebeacons = list()
var/isactive = FALSE
/obj/item/enginepicker/attack_self(mob/living/carbon/user)
if(usr.stat || !usr.canmove || usr.restrained())
return
if(!isactive)
isactive = TRUE //Self-attack spam exploit prevention
else
return
locatebeacons()
var/default = null
var/E = input("Select the station's Engine:", "[src]", default) as null|anything in list_enginebeacons
if(E)
processchoice(E, user)
else
isactive = FALSE
return
//This proc finds all of the '/obj/item/radio/beacon/engine' in the world and assigns them to a list
/obj/item/enginepicker/proc/locatebeacons()
@@ -42,6 +52,7 @@
engname = E
issuccessful = TRUE
else
isactive = FALSE
return
if(!engname)
engname = DEFAULTPICK(choice.enginetype, null) //This should(?) account for a possibly scrambled list with a single entry
@@ -68,6 +79,7 @@
qdel(src) //Self-destructs to prevent crew from spawning multiple engines.
else
visible_message("<span class='notice'>\The [src] buzzes! No beacon found or selected!</span>")
isactive = FALSE
return
//Deletes objects and mobs from the beacon's turf.