[modular] wirebrush (#6521)

* [modular] wirebrush

* code cleanup and better
This commit is contained in:
jjpark-kb
2021-06-30 22:05:54 +02:00
committed by GitHub
parent 778a589555
commit 4f87b970f4
8 changed files with 188 additions and 0 deletions
@@ -162,6 +162,7 @@
"bowl",
"drinking_glass",
"shot_glass",
"wirebrush",
//SKYRAT EDIT END - RESEARCH DESIGNS
)
@@ -1225,6 +1226,10 @@
"light_replacer",
"paint_remover",
"spraybottle",
//SKYRAT EDIT START - RESEARCH DESIGNS
"wirebrush_adv",
//SKYRAT EDIT END - RESEARCH DESIGNS
)
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 4000)
discount_experiments = list(/datum/experiment/scanning/random/janitor_trash = 3000) //75% discount for scanning some trash, seems fair right?
@@ -0,0 +1,39 @@
/obj/item/wirebrush
name = "wirebrush"
desc = "A tool that is used to scrub the rust thoroughly off walls. Not for hair or fur!"
icon = 'modular_skyrat/modules/wirebrush_rust/icons/obj/wirebrush.dmi'
icon_state = "wirebrush"
///variable that determines how long it takes to "clean" (read: replace(?)) rusted walls.
var/clean_speed = 30 //3 seconds
/obj/item/wirebrush/proc/attempt_clean(c_target, c_user, c_path)
var/turf/rustedTurf = c_target
if(!do_after(c_user, clean_speed, target = rustedTurf))
to_chat(c_user, span_warning("You stop cleaning, leaving the [rustedTurf] still rusty!"))
return
rustedTurf.ChangeTurf(c_path)
playsound(c_user, 'modular_skyrat/modules/wirebrush_rust/sound/items/wirebrush.ogg', 100, TRUE)
to_chat(c_user, span_notice("You clean \the [rustedTurf]."))
return
/obj/item/wirebrush/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
. = ..()
if(get_dist(target, user) > 1)
return
if(!isturf(target))
return
if(istype(target, /turf/open/floor/plating/rust))
attempt_clean(target, user, /turf/open/floor/plating)
else if(istype(target, /turf/closed/wall/rust))
attempt_clean(target, user, /turf/closed/wall)
else if(istype(target, /turf/closed/wall/r_wall/rust))
attempt_clean(target, user, /turf/closed/wall/r_wall)
else
to_chat(user, span_warning("You may only use this tool on walls or floors with rust!"))
/obj/item/wirebrush/advanced
name = "advanced wirebrush"
desc = "A tool that is slightly better than its basic version; cleans much faster. Not for hair or fur!"
icon_state = "wirebrush_adv"
clean_speed = 0 //no wait time essentially
@@ -0,0 +1,99 @@
/obj/machinery/microwave/attackby(obj/item/O, mob/living/user, params)
if(operating)
return
if(default_deconstruction_crowbar(O))
return
if(dirty < 100)
if(default_deconstruction_screwdriver(user, icon_state, icon_state, O) || default_unfasten_wrench(user, O))
update_appearance()
return
if(panel_open && is_wire_tool(O))
wires.interact(user)
return TRUE
if(broken > 0)
if(broken == 2 && O.tool_behaviour == TOOL_WIRECUTTER) // If it's broken and they're using a screwdriver
user.visible_message(span_notice("[user] starts to fix part of \the [src]."), span_notice("You start to fix part of \the [src]..."))
if(O.use_tool(src, user, 20))
user.visible_message(span_notice("[user] fixes part of \the [src]."), span_notice("You fix part of \the [src]."))
broken = 1 // Fix it a bit
else if(broken == 1 && O.tool_behaviour == TOOL_WELDER) // If it's broken and they're doing the wrench
user.visible_message(span_notice("[user] starts to fix part of \the [src]."), span_notice("You start to fix part of \the [src]..."))
if(O.use_tool(src, user, 20))
user.visible_message(span_notice("[user] fixes \the [src]."), span_notice("You fix \the [src]."))
broken = 0
update_appearance()
return FALSE //to use some fuel
else
to_chat(user, span_warning("It's broken!"))
return TRUE
return
if(istype(O, /obj/item/reagent_containers/spray))
var/obj/item/reagent_containers/spray/clean_spray = O
if(clean_spray.reagents.has_reagent(/datum/reagent/space_cleaner, clean_spray.amount_per_transfer_from_this))
clean_spray.reagents.remove_reagent(/datum/reagent/space_cleaner, clean_spray.amount_per_transfer_from_this,1)
playsound(loc, 'sound/effects/spray3.ogg', 50, TRUE, -6)
user.visible_message(span_notice("[user] cleans \the [src]."), span_notice("You clean \the [src]."))
dirty = 0
update_appearance()
else
to_chat(user, span_warning("You need more space cleaner!"))
return TRUE
if(istype(O, /obj/item/soap) || istype(O, /obj/item/reagent_containers/glass/rag))
var/cleanspeed = 50
if(istype(O, /obj/item/soap))
var/obj/item/soap/used_soap = O
cleanspeed = used_soap.cleanspeed
user.visible_message(span_notice("[user] starts to clean \the [src]."), span_notice("You start to clean \the [src]..."))
if(do_after(user, cleanspeed, target = src))
user.visible_message(span_notice("[user] cleans \the [src]."), span_notice("You clean \the [src]."))
dirty = 0
update_appearance()
return TRUE
if(istype(O, /obj/item/wirebrush))
var/obj/item/wirebrush/usedObj = O
user.visible_message(span_notice("[user] starts to clean \the [src]."), span_notice("You start to clean \the [src]..."))
if(do_after(user, usedObj.clean_speed, target = src))
user.visible_message(span_notice("[user] cleans \the [src]."), span_notice("You clean \the [src]."))
dirty = 0
update_appearance()
return TRUE
if(dirty == 100) // The microwave is all dirty so can't be used!
to_chat(user, span_warning("\The [src] is dirty!"))
return TRUE
if(istype(O, /obj/item/storage/bag/tray))
var/obj/item/storage/T = O
var/loaded = 0
for(var/obj/S in T.contents)
if(!IS_EDIBLE(S))
continue
if(ingredients.len >= max_n_of_items)
to_chat(user, span_warning("\The [src] is full, you can't put anything in!"))
return TRUE
if(SEND_SIGNAL(T, COMSIG_TRY_STORAGE_TAKE, S, src))
loaded++
ingredients += S
if(loaded)
to_chat(user, span_notice("You insert [loaded] items into \the [src]."))
return
if(O.w_class <= WEIGHT_CLASS_NORMAL && !istype(O, /obj/item/storage) && !user.combat_mode)
if(ingredients.len >= max_n_of_items)
to_chat(user, span_warning("\The [src] is full, you can't put anything in!"))
return TRUE
if(!user.transferItemToLoc(O, src))
to_chat(user, span_warning("\The [O] is stuck to your hand!"))
return FALSE
ingredients += O
user.visible_message(span_notice("[user] adds \a [O] to \the [src]."), span_notice("You add [O] to \the [src]."))
return
..()
@@ -0,0 +1,23 @@
/////////////////////////////////////////
////////////Janitor Designs//////////////
/////////////////////////////////////////
/datum/design/wirebrush
name = "Wirebrush"
desc = "A tool to start removing rust from walls."
id = "wirebrush"
build_type = PROTOLATHE | AWAY_LATHE
materials = list(/datum/material/iron = 200, /datum/material/glass = 200)
build_path = /obj/item/wirebrush
category = list("Equipment")
departmental_flags = DEPARTMENTAL_FLAG_SERVICE
/datum/design/wirebrush_adv
name = "Advanced Wirebrush"
desc = "An advanced tool to start removing rust from walls."
id = "wirebrush_adv"
build_type = PROTOLATHE | AWAY_LATHE
materials = list(/datum/material/iron = 200, /datum/material/glass = 200, /datum/material/uranium = 200, /datum/material/plasma = 200)
build_path = /obj/item/wirebrush/advanced
category = list("Equipment")
departmental_flags = DEPARTMENTAL_FLAG_SERVICE
Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

@@ -0,0 +1,19 @@
## Title: Wirebrush for Rust
MODULE ID: WIREBRUSH_RUST
### Description:
Adds an item called the wirebrush. The wirebrush will "remove" (read: replace) walls with rust.
### TG Proc Changes:
### Defines:
### Included files:
N/A
### Credits:
Jake Park
+3
View File
@@ -4476,5 +4476,8 @@
#include "modular_skyrat\modules\verbs\code\modules\mob\say.dm"
#include "modular_skyrat\modules\verbs\code\modules\mob\subtle.dm"
#include "modular_skyrat\modules\veteran_players\code\veteran_players.dm"
#include "modular_skyrat\modules\wirebrush_rust\code\game\objects\items\wirebrush.dm"
#include "modular_skyrat\modules\wirebrush_rust\code\modules\food_and_drinks\kitchen_machinery\microwave.dm"
#include "modular_skyrat\modules\wirebrush_rust\code\modules\research\designs\misc_designs.dm"
#include "modular_skyrat\modules\xenomorph\code\xenomorph_balance.dm"
// END_INCLUDE