[MIRROR] Unlucky trait (#11775)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-10-04 00:52:24 -07:00
committed by GitHub
parent 6eab8c8408
commit b8fe8fa68d
44 changed files with 1162 additions and 181 deletions

View File

@@ -911,13 +911,13 @@ About the new airlock wires panel:
adjustBruteLoss(crush_damage)
return FALSE
/obj/machinery/door/airlock/close(var/forced=0)
/obj/machinery/door/airlock/close(var/forced= FALSE, var/ignore_safties = FALSE, var/crush_damage = DOOR_CRUSH_DAMAGE)
if(!can_close(forced))
return FALSE
hold_open = null //if it passes the can close check, always make sure to clear hold open
if(safe)
if(safe && !ignore_safties)
for(var/turf/turf in locs)
for(var/atom/movable/AM in turf)
if(AM.blocks_airlock())
@@ -929,8 +929,8 @@ About the new airlock wires panel:
for(var/turf/turf in locs)
for(var/atom/movable/AM in turf)
if(AM.airlock_crush(DOOR_CRUSH_DAMAGE))
take_damage(DOOR_CRUSH_DAMAGE)
if(AM.airlock_crush(crush_damage))
take_damage(crush_damage)
use_power(360) //360 W seems much more appropriate for an actuator moving an industrial door capable of crushing people
has_beeped = 0

View File

@@ -128,9 +128,9 @@
if(!surpress_send) send_status()
/obj/machinery/door/airlock/close(surpress_send)
/obj/machinery/door/airlock/close(var/forced= FALSE, var/ignore_safties = FALSE, var/crush_damage = DOOR_CRUSH_DAMAGE)
. = ..()
if(!surpress_send) send_status()
if(!forced) send_status()
/obj/machinery/door/airlock/Bumped(atom/AM)

View File

@@ -527,7 +527,7 @@
open_speed = 15
return (normalspeed ? open_speed : 5)
/obj/machinery/door/proc/close(var/forced = 0)
/obj/machinery/door/proc/close(var/forced = 0, var/ignore_safties = FALSE, var/crush_damage = DOOR_CRUSH_DAMAGE)
if(!can_close(forced))
return
operating = 1

View File

@@ -115,6 +115,50 @@
return
//CHOMPEdit End
// Checks to make sure he's not in space doing it, and that the area got proper power.
if(!powered())
to_chat(user, span_warning("\The [src] blinks red as you try to insert [G]!"))
return
if(istype(G, /obj/item/gun/energy))
var/obj/item/gun/energy/E = G
if(E.self_recharge)
to_chat(user, span_notice("\The [E] has no recharge port."))
return
if(istype(G, /obj/item/modular_computer))
var/obj/item/modular_computer/C = G
if(!C.battery_module)
to_chat(user, span_notice("\The [C] does not have a battery installed. "))
return
if(istype(G, /obj/item/flash))
var/obj/item/flash/F = G
if(F.use_external_power)
to_chat(user, span_notice("\The [F] has no recharge port."))
return
if(istype(G, /obj/item/weldingtool/electric))
var/obj/item/weldingtool/electric/EW = G
if(EW.use_external_power)
to_chat(user, span_notice("\The [EW] has no recharge port."))
return
if(!G.get_cell() && !istype(G, /obj/item/ammo_casing/microbattery) && !istype(G, /obj/item/paicard)) //VOREStation Edit: NSFW charging
to_chat(user, "\The [G] does not have a battery installed.")
return
if(istype(G, /obj/item/paicard))
var/obj/item/paicard/ourcard = G
if(ourcard.panel_open)
to_chat(user, span_warning("\The [ourcard] won't fit in the recharger with its panel open."))
return
if(ourcard.pai)
if(ourcard.pai.stat == CONSCIOUS)
to_chat(user, span_warning("\The [ourcard] boops... it doesn't need to be recharged!"))
return
else
to_chat(user, span_warning("\The [ourcard] doesn't have a personality!"))
return
if(HAS_TRAIT(user, TRAIT_UNLUCKY) && prob(10))
user.visible_message("[user] inserts [charging] into [src] backwards!", "You insert [charging] into [src] backwards!")
user.drop_item()
G.loc = get_turf(src)
return
user.drop_item()
G.loc = src
charging = G

View File

@@ -1,3 +1,13 @@
#define EMPTY_OPEN 1
#define EMPTY_CLOSED 2
#define FULL_OPEN 3
#define FULL_CLOSED 4
#define RUNNING 5
#define BLOODY_OPEN 6 //Not actually used...
#define BLOODY_CLOSED 7
#define BLOODY_RUNNING 8
/obj/machinery/washing_machine
name = "Washing Machine"
desc = "Not a hiding place. Unfit for pets."
@@ -9,19 +19,9 @@
clickvol = 40
circuit = /obj/item/circuitboard/washing
var/state = 1
//1 = empty, open door
//2 = empty, closed door
//3 = full, open door
//4 = full, closed door
//5 = running
//6 = blood, open door
//7 = blood, closed door
//8 = blood, running
var/hacked = 1 //Bleh, screw hacking, let's have it hacked by default.
//0 = not hacked
//1 = hacked
var/gibs_ready = 0
var/state = EMPTY_OPEN
var/hacked = TRUE //Bleh, screw hacking, let's have it hacked by default.
var/gibs_ready = FALSE
var/obj/crayon
var/list/washing = list()
var/list/disallowed_types = list(
@@ -34,6 +34,14 @@
default_apply_parts()
AddElement(/datum/element/climbable)
/obj/machinery/washing_machine/Destroy()
for(var/atom/movable/washed_items in contents)
washed_items.forceMove(get_turf(src))
washing.Cut()
crayon = null
. = ..()
/obj/machinery/washing_machine/AltClick()
start()
@@ -43,26 +51,27 @@
set src in oview(1)
start()
/obj/machinery/washing_machine/proc/start()
/obj/machinery/washing_machine/proc/start(force, damage_modifier)
if(!isliving(usr)) //ew ew ew usr, but it's the only way to check.
if(!isliving(usr) && !force) //ew ew ew usr, but it's the only way to check.
return
if(state != 4)
to_chat(usr, "The washing machine cannot run in this state.")
if(!damage_modifier)
damage_modifier = 0.5
if(state != FULL_CLOSED)
visible_message("The washing machine buzzes - it can not run in this state!")
return
if(locate(/mob,washing))
state = 8
state = BLOODY_RUNNING
else
state = 5
state = RUNNING
update_icon()
to_chat(usr, "The washing machine starts a cycle.")
visible_message("The washing machine starts a cycle.")
playsound(src, 'sound/items/washingmachine.ogg', 50, 1, 1)
addtimer(CALLBACK(src, PROC_REF(finish_wash)), 2 SECONDS)
addtimer(CALLBACK(src, PROC_REF(finish_wash), damage_modifier), 2 SECONDS)
/obj/machinery/washing_machine/proc/finish_wash()
/obj/machinery/washing_machine/proc/finish_wash(damage_modifier)
for(var/atom/A in washing)
A.wash(CLEAN_ALL)
@@ -74,21 +83,49 @@
HH.use(HH.get_amount())
washing += WL
var/has_mobs = FALSE
for(var/mob/living/mobs in washing)
has_mobs = TRUE
if(ishuman(mobs))
var/mob/living/carbon/human/our_human = mobs
var/max_health_coefficient = (our_human.maxHealth * 0.09) //9 for 100% hp human, 4.5 for 50% hp human (teshari), etc.
for(var/i=0,i<10,i++)
our_human.apply_damage(max_health_coefficient*damage_modifier, BRUTE, used_weapon = "spin cycle") //Let's randomly do damage across the body. One limb might get hurt more than the others. At 100% damge mod, does 90% of max hp in damage.
continue
mobs.stat = DEAD //Kill them so they can't interact anymore.
if(locate(/mob,washing))
state = 7
gibs_ready = 1
if(has_mobs)
state = BLOODY_CLOSED
gibs_ready = TRUE
else
state = 4
state = FULL_CLOSED
update_icon()
/obj/machinery/washing_machine/verb/climb_out()
set name = "Climb out"
set category = "Object"
set src in usr.loc
user_climb_out(usr)
if((state in list(1,3,6)) && do_after(usr, 2 SECONDS, target = src))
usr.loc = src.loc
/obj/machinery/washing_machine/proc/user_climb_out(mob/user)
if(user.loc != src) //Have to be in it to climb out of it.
return
if(state in list(EMPTY_OPEN, FULL_OPEN, BLOODY_OPEN)) //Door is open, we can climb out easily.
visible_message("[user] begins to climb out of the [src]!")
if(do_after(user, 2 SECONDS, target = src))
if(!(state in list(EMPTY_CLOSED, FULL_CLOSED, BLOODY_CLOSED))) //Someone shut the door while we were trying to climb out!
user.forceMove(get_turf(src))
visible_message("[user] climbs out of the [src]!")
else
to_chat(user, "Someone shut the door on you!")
else if(state in list(EMPTY_CLOSED, FULL_CLOSED, BLOODY_CLOSED)) //Door is shut.
visible_message("[src] begins to rattle and shake!")
if(do_after(user, 60 SECONDS, target = src))
visible_message("[user] climbs out of the [src]!")
attack_hand(user, force = TRUE)
/obj/machinery/washing_machine/container_resist(mob/living/escapee)
user_climb_out(escapee)
/obj/machinery/washing_machine/update_icon()
cut_overlays()
@@ -97,7 +134,7 @@
add_overlay("panel")
/obj/machinery/washing_machine/attackby(obj/item/W as obj, mob/user as mob)
if(state == 2 && washing.len < 1)
if(state == EMPTY_CLOSED && washing.len < 1)
if(default_deconstruction_screwdriver(user, W))
return
if(default_deconstruction_crowbar(user, W))
@@ -108,22 +145,30 @@
panel = !panel
to_chat(user, span_notice("You [panel ? "open" : "close"] the [src]'s maintenance panel"))*/
if(istype(W,/obj/item/pen/crayon) || istype(W,/obj/item/stamp))
if(state in list( 1, 3, 6))
if(state in list (EMPTY_OPEN, FULL_OPEN, BLOODY_OPEN))
if(!crayon)
user.drop_item()
crayon = W
crayon.forceMove(src)
crayon.loc = src
else
..()
else
..()
else if(istype(W,/obj/item/grab))
if((state == 1) && hacked)
if((state == EMPTY_OPEN) && hacked)
var/obj/item/grab/G = W
if(ishuman(G.assailant) && iscorgi(G.affecting))
G.affecting.loc = src
qdel(G)
state = 3
if(ishuman(G.assailant) && (iscorgi(G.affecting) || ishuman(G.affecting)))
user.visible_message("[user] begins stuffing [G.affecting] into the [src]!", "You begin stuffing [G.affecting] into the [src]!")
if(do_after(user, 5 SECONDS, target = src))
if(state == EMPTY_OPEN) //Checking to make sure nobody closed it before we shoved em in it.
user.visible_message("[user] stuffs [G.affecting] into the [src] and shuts the door!", "You stuff [G.affecting] into the [src] and shut the door!")
G.affecting.forceMove(src)
washing += G.affecting
qdel(G)
state = FULL_CLOSED
else
to_chat(user, "You can't shove [G.affecting] in unless the washer is empty and open!")
else
..()
@@ -133,11 +178,11 @@
else if(istype(W, /obj/item/clothing) || istype(W, /obj/item/bedsheet) || istype(W, /obj/item/stack/hairlesshide))
if(washing.len < 5)
if(state in list(1, 3))
if(state in list(EMPTY_OPEN, FULL_OPEN))
user.drop_item()
W.loc = src
W.forceMove(src)
washing += W
state = 3
state = FULL_OPEN
else
to_chat(user, span_notice("You can't put the item in right now."))
else
@@ -146,38 +191,50 @@
..()
update_icon()
/obj/machinery/washing_machine/attack_hand(mob/user as mob)
/obj/machinery/washing_machine/attack_hand(mob/user, force)
if(user.loc == src && !force)
return //No interacting with it from the inside!
switch(state)
if(1)
state = 2
if(2)
state = 1
if(EMPTY_OPEN)
state = EMPTY_CLOSED
if(EMPTY_CLOSED)
state = EMPTY_OPEN
for(var/atom/movable/O in washing)
O.loc = src.loc
O.forceMove(get_turf(src))
washing.Cut()
if(3)
state = 4
if(4)
state = 3
if(FULL_OPEN)
state = FULL_CLOSED
if(FULL_CLOSED)
for(var/atom/movable/O in washing)
O.loc = src.loc
O.forceMove(get_turf(src))
crayon = null
washing.Cut()
state = 1
if(5)
to_chat(user, span_warning("The [src] is busy."))
if(6)
state = 7
if(7)
state = EMPTY_OPEN
if(RUNNING)
if(user)
to_chat(user, span_warning("The [src] is busy."))
if(BLOODY_OPEN)
state = BLOODY_CLOSED
if(BLOODY_CLOSED)
if(gibs_ready)
gibs_ready = 0
if(locate(/mob,washing))
var/mob/M = locate(/mob,washing)
M.gib()
gibs_ready = FALSE
for(var/mob/living/mobs in washing)
if(ishuman(mobs)) //Humans have special handling.
continue
mobs.gib()
for(var/atom/movable/O in washing)
O.loc = src.loc
O.forceMove(get_turf(src))
crayon = null
state = 1
state = EMPTY_OPEN
washing.Cut()
update_icon()
#undef EMPTY_OPEN
#undef EMPTY_CLOSED
#undef FULL_OPEN
#undef FULL_CLOSED
#undef RUNNING
#undef BLOODY_OPEN
#undef BLOODY_CLOSED
#undef BLOODY_RUNNING