Skip to content

Commit

Permalink
still mastering the concept of early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
blackdragonTOW committed Jun 19, 2024
1 parent 4ee08a6 commit d703ba4
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions code/game/machinery/nuclearbomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -632,22 +632,18 @@ GLOBAL_VAR_INIT(bomb_set, FALSE)

/obj/structure/machinery/nuclearbomb/tech/attackby(obj/item/nuke_disk as obj, mob/user as mob)
var/reduction_multiplier = 0.7 //30% reduction
if(istype(nuke_disk, /obj/item/disk/nuclear))
if(!istype(nuke_disk, /obj/item/disk/nuclear))
attack_hand(user)
if(decrypting)
if (decryption_time > 0)
decryption_end_time = LERP(world.time, decryption_end_time, reduction_multiplier)
decryption_time = decryption_end_time - world.time
to_chat(user, SPAN_WARNING("The decryption process begins using the disk's data..."))
announce_to_players() //Let everyone know the new time
qdel(nuke_disk)
return
else
to_chat(user, SPAN_WARNING("Decryption is already complete..."))
return
else
to_chat(user, SPAN_WARNING("It needs to be decrypting first!"))
return
else
to_chat(user, SPAN_WARNING("You probably shouldn't hit it with \the [src]..."))
return
if(!decrypting)
to_chat(user, SPAN_WARNING("It needs to be decrypting first!"))
return
if(decryption_time <= 0)
to_chat(user, SPAN_WARNING("Decryption is already complete..."))
return
decryption_end_time = LERP(world.time, decryption_end_time, reduction_multiplier)
decryption_time = decryption_end_time - world.time
to_chat(user, SPAN_WARNING("The decryption process begins using the disk's data..."))
announce_to_players() //Let everyone know the new time
qdel(nuke_disk)

0 comments on commit d703ba4

Please sign in to comment.