[MIRROR] fix filtering clown/mime plasmaman air (#7303)

* fix filtering clown/mime plasmaman air (#60388)

* fix filtering clown/mime plasmaman air

* rclickj

* better way

* starting_filter_type

* fixes and changes

* fix filtering clown/mime plasmaman air

Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-08-01 23:18:58 +01:00
committed by GitHub
co-authored by Ghilker
parent d9858a74c6
commit deff2bcc8e
2 changed files with 31 additions and 10 deletions
+28 -7
View File
@@ -14,14 +14,17 @@
var/max_filters = 1
///List to keep track of each filter
var/list/gas_filters
///Type of filter that spawns on roundstart
var/starting_filter_type = /obj/item/gas_filter
/obj/item/clothing/mask/gas/Initialize()
. = ..()
if(!max_filters)
if(!max_filters || !starting_filter_type)
return
for(var/i in 1 to max_filters)
var/obj/item/gas_filter/filter = new(src)
LAZYADD(gas_filters, filter)
var/obj/item/gas_filter/inserted_filter = new starting_filter_type(src)
LAZYADD(gas_filters, inserted_filter)
has_filter = TRUE
/obj/item/clothing/mask/gas/Destroy()
@@ -35,17 +38,29 @@
if(LAZYLEN(gas_filters) > 0)
. += "<span class='notice'>Currently there [LAZYLEN(gas_filters) == 1 ? "is" : "are"] [LAZYLEN(gas_filters)] filter\s with [get_filter_durability()]% durability.</span>"
/obj/item/clothing/mask/gas/attackby(obj/item/filter, mob/user)
if(!istype(filter, /obj/item/gas_filter))
/obj/item/clothing/mask/gas/attackby(obj/item/tool, mob/user)
if(!istype(tool, /obj/item/gas_filter))
return ..()
if(LAZYLEN(gas_filters) >= max_filters)
return ..()
if(!user.transferItemToLoc(filter, src))
if(!user.transferItemToLoc(tool, src))
return ..()
LAZYADD(gas_filters, filter)
LAZYADD(gas_filters, tool)
has_filter = TRUE
return TRUE
/obj/item/clothing/mask/gas/attackby_secondary(obj/item/weapon, mob/user, params)
if(!has_filter || !max_filters)
return ..()
for(var/i in 1 to max_filters)
var/obj/item/gas_filter/filter = locate() in src
if(!filter)
continue
user.transferItemToLoc(filter, user.loc)
LAZYREMOVE(gas_filters, filter)
if(LAZYLEN(gas_filters) <= 0)
has_filter = FALSE
///Check _masks.dm for this one
/obj/item/clothing/mask/gas/consume_filter(datum/gas_mixture/breath)
if(LAZYLEN(gas_filters) <= 0 || max_filters == 0)
@@ -147,6 +162,9 @@
species_exception = list(/datum/species/golem/bananium)
var/list/clownmask_designs = list()
/obj/item/clothing/mask/gas/clown_hat/plasmaman
starting_filter_type = /obj/item/gas_filter/plasmaman
/obj/item/clothing/mask/gas/clown_hat/Initialize(mapload)
.=..()
clownmask_designs = list(
@@ -203,6 +221,9 @@
species_exception = list(/datum/species/golem)
var/list/mimemask_designs = list()
/obj/item/clothing/mask/gas/mime/plasmaman
starting_filter_type = /obj/item/gas_filter/plasmaman
/obj/item/clothing/mask/gas/mime/Initialize(mapload)
.=..()
mimemask_designs = list(
+3 -3
View File
@@ -167,7 +167,7 @@
uniform = /obj/item/clothing/under/plasmaman/mime
gloves = /obj/item/clothing/gloves/color/plasmaman/white
head = /obj/item/clothing/head/helmet/space/plasmaman/mime
mask = /obj/item/clothing/mask/gas/mime
mask = /obj/item/clothing/mask/gas/mime/plasmaman
/datum/outfit/plasmaman/clown
name = "Clown Plasmaman"
@@ -175,7 +175,7 @@
uniform = /obj/item/clothing/under/plasmaman/clown
gloves = /obj/item/clothing/gloves/color/plasmaman/clown
head = /obj/item/clothing/head/helmet/space/plasmaman/clown
mask = /obj/item/clothing/mask/gas/clown_hat
mask = /obj/item/clothing/mask/gas/clown_hat/plasmaman
/datum/outfit/plasmaman/captain
name = "Captain Plasmaman"
@@ -269,4 +269,4 @@
uniform = /obj/item/clothing/under/plasmaman/clown
gloves = /obj/item/clothing/gloves/color/plasmaman/clown
head = /obj/item/clothing/head/helmet/space/plasmaman/clown
mask = /obj/item/clothing/mask/gas/clown_hat
mask = /obj/item/clothing/mask/gas/clown_hat/plasmaman