Skip to content

Commit

Permalink
Merge pull request #5541 from ARF-SS13/stealf-gaymeplay
Browse files Browse the repository at this point in the history
Stealthboy Overhaul
  • Loading branch information
Tk420634 authored Nov 9, 2024
2 parents 8817d75 + afe3994 commit 74e703a
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 90 deletions.
272 changes: 187 additions & 85 deletions code/game/objects/items/stealthboy.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/stealthboy
name = "Stealth Boy"
desc = "The RobCo Stealth Boy 3001 is a personal stealth device, this one is designed to be worn on your belt and the battery can be taken out if you can find an ALTERNATIVE way to CLICK the back open and take the battery out. (alt click to take the battery out and recharge it)"
name = "Stealth Module"
desc = "Something that looks suspiciously like a datapal, but works to hide you from critters. It takes a few seconds to turn on, and will recharge while its off. ALT+click to activate!"
icon = 'icons/obj/pda.dmi' //Placeholder till ones sprited
icon_state = "pda" //Placeholder till ones sprited
item_flags = NOBLUDGEON
Expand All @@ -9,113 +9,215 @@
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
var/obj/item/stock_parts/cell/cell = /obj/item/stock_parts/cell/high
var/use_per_tick = 400 // normal cell has 10000 charge, 200 charge/second = 50 seconds of stealth
var/on = FALSE
var/obj/item/stock_parts/cell/cell = /obj/item/stock_parts/cell/high/slime
var/use_per_tick = 1000 // normal cell has 10000 charge, 200 charge/second = 50 seconds of stealth //if the previous comment is correct this is 25 seconds of stealth
actions_types = list(/datum/action/item_action/stealthboy_cloak)

/obj/item/stealthboy/Initialize()
. = ..()
if(ispath(cell))
cell = new cell(src)
var/mybar
var/mob/applying_to
var/do_boop = FALSE
var/do_warn = TRUE
var/on = FALSE
var/warn_time = 5 SECONDS
var/max_time_left = 20 SECONDS
var/time_left = 20 SECONDS
var/min_time_left = 15 SECONDS
var/last_tick = 0
var/list/factionlist = list(
"supermutant",
"raider",
"china",
"enclave",
"wastebot",
"ghoul",
"cazador",
"bs",
"vault",
"city",
"tribe",
"Legion",
"NCR",
"gecko",
"rat",
"ant",
"radscorpion",
"crabs",
"trog",
"plants",
"tunneller",
"wolf",
"hostile",
"russian",
"yaoguai",
"carp",
"duck",
"spooky",
"faithless",
"vines",
)

/obj/item/stealthboy/Destroy()
Deactivate()
. = ..()
var/mob/living/carbon/human/user = loc
if(ishuman(user))
user.alpha = initial(user.alpha)

/obj/item/stealthboy/ui_action_click(mob/user)
if(!ishuman(user))
return
if(user.get_item_by_slot(SLOT_BELT) == src)
on = !on
Toggle(user)

// /obj/item/stealthboy/item_action_slot_check(slot, mob/user)
// if(slot == SLOT_BELT)
// return 1

/obj/item/stealthboy/examine(mob/user)
. = ..()
. += span_notice("The meter thingy says that it has around [round(time_left / 10)] seconds of charge left.")
if(time_left < min_time_left)
if(on)
Activate(user)
. += span_alert("The low battery thingy is flashing red! If deactivated, it won't have enough charge to activate!")
else
Deactivate(user)
return

/obj/item/stealthboy/AltClick(mob/living/user)
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
return ..()
eject_cell(user)
return

/obj/item/stealthboy/proc/eject_cell(mob/living/user)
if(!cell)
to_chat(user, span_warning("[src] has no cell installed."))
. += span_alert("The low battery thingy is flashing red! It doesn't have enough charge to activate!")

/obj/item/stealthboy/AltClick(mob/user)
. = ..()
Toggle(user)

/obj/item/stealthboy/proc/Toggle(mob/living/carbon/human/user)
if(on)
Deactivate(user)
return
if(on && user.get_item_by_slot(SLOT_BELT) == src)
if(HAS_TRAIT(user, "stealthinvis"))
Deactivate(user)
cell.add_fingerprint(user)
user.put_in_hands(cell)
user.show_message(span_notice("You remove [cell]."))
cell = null

/obj/item/stealthboy/proc/insert_cell(mob/living/user, obj/item/stock_parts/cell/new_cell)
if(cell)
eject_cell(user)
if(user.transferItemToLoc(new_cell, src))
cell = new_cell
to_chat(user, span_notice("You successfully install \the [cell] into [src]."))

/obj/item/stealthboy/attackby(obj/item/I, mob/living/carbon/human/user, params)
if(istype(I, /obj/item/stock_parts/cell))
insert_cell(user, I)
return
. = ..()
if(CanActivate(user, TRUE))
StartActivating(user)
else
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_cant.ogg', 75, FALSE)

/obj/item/stealthboy/item_action_slot_check(slot, mob/user)
if(slot == SLOT_BELT)
return 1
/obj/item/stealthboy/proc/CanActivate(mob/living/carbon/human/user, msg)
if(!user)
user = applying_to
if(!user)
return FALSE
if(time_left < min_time_left)
if(msg)
to_chat(user, span_alert("The [src] doesn't have enough charge left to activate!"))
return FALSE
if(user.stat != CONSCIOUS)
if(msg)
to_chat(user, span_alert("You're too messed up to activate \The [src]!"))
return FALSE
if(user.get_item_by_slot(SLOT_BELT) != src)
if(msg)
to_chat(user, span_alert("You need to be wearing \The [src] on your belt to activate it!"))
return FALSE
return TRUE

/obj/item/stealthboy/examine(mob/user)
. = ..()
if(istype(cell))
. += "The charge meter reads [round(cell.percent() )]%."
/obj/item/stealthboy/proc/CanRemainActive()
if(!applying_to)
return FALSE
if(!on)
return FALSE
if(time_left <= 0)
return FALSE
if(applying_to.stat != CONSCIOUS)
return FALSE
if(applying_to.get_item_by_slot(SLOT_BELT) != src)
return FALSE
return TRUE

/obj/item/stealthboy/proc/Activate(mob/living/carbon/human/user)
if(!user)
Deactivate(FALSE)
/obj/item/stealthboy/proc/StartActivating(mob/living/carbon/human/user)
if(on)
return
if(!istype(cell))
user.show_message(span_alert("There's no cell in [src]!"))
Deactivate(FALSE)
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_precum.ogg', 75, FALSE)
if(!do_after(user, 5 SECONDS, TRUE, src, TRUE, null, null, null, FALSE, TRUE, TRUE, FALSE, FALSE))
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_cant.ogg', 75, FALSE)
to_chat(user, span_alert("[src] failed to activate!"))
return
if(!cell.use(use_per_tick))
user.show_message(span_alert("There's not enough power in [src]'s [cell.name]!"))
Deactivate(FALSE)
if(CanActivate(user, TRUE))
Activate(user)

/obj/item/stealthboy/proc/Activate(mob/living/carbon/human/user)
if(on)
Deactivate(user)
return
to_chat(user, span_notice("You activate \The [src]."))
if(HAS_TRAIT(user, "stealthinvis"))
Deactivate(user)
return
if(applying_to)
if(applying_to != user)
Deactivate()
else
return
animate(user, alpha = 60, time = 3 SECONDS)
START_PROCESSING(SSobj, src)
ADD_TRAIT(user, "stealthinvis", src)
applying_to = user
to_chat(user, span_notice("You activate \The [src]."))
last_tick = world.time
user.faction += factionlist
START_PROCESSING(SSfastprocess, src)
on = TRUE
do_sparks(1, TRUE, get_turf(src), /datum/effect_system/spark_spread/quantum)
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_cum.ogg', 75, FALSE)

/obj/item/stealthboy/proc/Deactivate(mob/living/carbon/human/user)
if(!ishuman(user))
user = loc
if(!ishuman(user))
return
/obj/item/stealthboy/proc/Deactivate(mob/living/carbon/human/user, msg)
if(!user)
user = applying_to
if(!user)
CRASH("Deactivate called without a user or applying_to!")
animate(user, alpha = initial(user.alpha), time = 3 SECONDS)
to_chat(user, span_notice("You deactivate \The [src]."))
STOP_PROCESSING(SSobj, src)
to_chat(user, span_notice("\The [src] deactivates!"))
user.faction -= factionlist
REMOVE_TRAIT(user, "stealthinvis", src)
// applying_to = null
on = FALSE

/obj/item/stealthboy/dropped(mob/user)
..()
Deactivate(user)

/obj/item/stealthboy/equipped(mob/user, slot)
. = ..()
if(user?.get_item_by_slot(SLOT_BELT) != src)
Deactivate(user)
applying_to = null
do_sparks(4, TRUE, get_turf(src), /datum/effect_system/spark_spread/quantum)
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_muc.ogg', 75, FALSE)

/obj/item/stealthboy/process()
var/mob/living/carbon/human/user = loc
if(!ishuman(user) || user.get_item_by_slot(SLOT_BELT) != src)
if(!on)
ChargeTick()
else
StealthTick()
UpdateProgBar()

/obj/item/stealthboy/proc/StealthTick()
if(!last_tick)
last_tick = world.time
return
if(!CanRemainActive())
Deactivate()
return
if((!istype(cell) || !cell?.use(use_per_tick)))
Deactivate(user)
var/delta = world.time - last_tick
last_tick = world.time
time_left -= delta
if(time_left <= min_time_left)
do_boop = TRUE
if(time_left <= warn_time && do_warn)
var/mob/user = loc
if(ismob(user))
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_nearly_muc.ogg', 75, FALSE)
do_warn = FALSE
if(time_left <= 0)
Deactivate()

/obj/item/stealthboy/proc/ChargeTick()
if(!last_tick)
last_tick = world.time
return
var/delta = world.time - last_tick
last_tick = world.time
time_left += (delta * 0.75)
if(do_boop && time_left > min_time_left)
var/mob/user = loc
if(ismob(user))
user.playsound_local(get_turf(src), 'sound/effects/stealthcock_can_work_now.ogg', 75, FALSE)
do_boop = FALSE
if(time_left > warn_time && !do_warn)
do_warn = TRUE
if(time_left > max_time_left)
time_left = max_time_left

/obj/item/stealthboy/proc/UpdateProgBar()
if(!mybar)
mybar = SSprogress_bars.add_bar(src, list(), max_time_left, FALSE, FALSE)
SSprogress_bars.update_bar(mybar, time_left)

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
icon_state = "mirelurk"
icon_living = "mirelurk"
icon_dead = "mirelurk_d"
faction = "crabs"
speed = 1
can_ghost_into = TRUE
move_to_delay = 3
Expand Down
10 changes: 5 additions & 5 deletions code/modules/supplykit/supplykit_items/supplykit_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
item = /obj/item/binoculars
cost = 5

/datum/supplykit_item/misc/stealthboy
name = "Stealthboy"
desc = "A device worn on your belt that makes you almost impossible to see for a time. does not currently work for simpleminded creatures."
item = /obj/item/stealthboy
cost = 40
// /datum/supplykit_item/misc/stealthboy
// name = "Stealthboy"
// desc = "A device worn on your belt that makes you almost impossible to see for a time. does not currently work for simpleminded creatures."
// item = /obj/item/stealthboy
// cost = 40

// /datum/supplykit_item/misc/whetstone
// name = "Whetstone"
Expand Down
5 changes: 5 additions & 0 deletions modular_coyote/code/modules/znuguns/code/guns/zloadout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@
name = "Binoculars"
path = /obj/item/binoculars

/datum/gear/utility/tier4/stealthboy
name = "Stealth Module"
path = /obj/item/stealthboy


// TIER 1 STUFF //

/datum/gear/utility/tier1/mountgear
Expand Down
Binary file added sound/effects/stealthcock_can_work_now.ogg
Binary file not shown.
Binary file added sound/effects/stealthcock_cant.ogg
Binary file not shown.
Binary file added sound/effects/stealthcock_cum.ogg
Binary file not shown.
Binary file added sound/effects/stealthcock_muc.ogg
Binary file not shown.
Binary file added sound/effects/stealthcock_nearly_muc.ogg
Binary file not shown.
Binary file added sound/effects/stealthcock_precum.ogg
Binary file not shown.

0 comments on commit 74e703a

Please sign in to comment.