Skip to content

Commit

Permalink
Merge pull request #1132 from ariaworld/monkey-harddels
Browse files Browse the repository at this point in the history
[NON-MODULAR] [PORT] Port a few monkey and slime hard-del fixes
  • Loading branch information
MosleyTheMalO authored Apr 6, 2024
2 parents 7ea53b1 + f27731d commit d37a60d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
3 changes: 1 addition & 2 deletions code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,7 @@ GENETICS SCANNER
if (!isslime(M))
to_chat(user, "<span class='warning'>This device can only scan slimes!</span>")
return
var/mob/living/simple_animal/slime/T = M
slime_scan(T, user)
slime_scan(M, user)

/proc/slime_scan(mob/living/simple_animal/slime/T, mob/living/user)
var/output = "<b>Slime scan results:</b>"
Expand Down
11 changes: 11 additions & 0 deletions code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers)
. = ..()
if (mapload)
GLOB.monkey_recyclers += src
locate_camera_console()

/obj/machinery/monkey_recycler/Destroy()
GLOB.monkey_recyclers -= src
Expand All @@ -28,6 +29,15 @@ GLOBAL_LIST_EMPTY(monkey_recyclers)
connected.Cut()
return ..()

/obj/machinery/monkey_recycler/proc/locate_camera_console()
if(length(connected))
return // we're already connected!
for(var/obj/machinery/computer/camera_advanced/xenobio/xeno_camera in GLOB.machines)
if(get_area(xeno_camera) == get_area(loc))
xeno_camera.connected_recycler = src
connected |= xeno_camera
break

/obj/machinery/monkey_recycler/RefreshParts() //Ranges from 0.2 to 0.8 per monkey recycled
cube_production = 0
for(var/obj/item/stock_parts/manipulator/B in component_parts)
Expand Down Expand Up @@ -75,6 +85,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers)
to_chat(user, "<span class='warning'>The monkey is attached to something.</span>")
return
qdel(target)
target = null //we sleep in this proc, clear reference NOW
to_chat(user, "<span class='notice'>You stuff the monkey into the machine.</span>")
playsound(src.loc, 'sound/machines/juicer.ogg', 50, 1)
var/offset = prob(50) ? -2 : 2
Expand Down
7 changes: 4 additions & 3 deletions code/modules/mob/living/simple_animal/slime/death.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/mob/living/simple_animal/slime/death(gibbed)
if(stat == DEAD)
return

if(buckled)
Feedstop(silent = TRUE) //releases ourselves from the mob we fed on.

if(!gibbed)
if(is_adult)
var/mob/living/simple_animal/slime/M = new(loc, colour)
Expand All @@ -18,9 +22,6 @@
update_name()
return

if(buckled)
Feedstop(silent = TRUE) //releases ourselves from the mob we fed on.

stat = DEAD
cut_overlays()

Expand Down
5 changes: 4 additions & 1 deletion code/modules/mob/living/simple_animal/slime/powers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
to_chat(src, "<i>I must be conscious to do this...</i>")
return

if(istype(loc, /obj/machinery/computer/camera_advanced/xenobio))
return //no you cannot split while you're in the matrix (this prevents GC issues and slimes disappearing)

var/list/babies = list()
var/new_nutrition = round(nutrition * 0.9)
var/new_powerlevel = round(powerlevel / 4)
Expand All @@ -187,7 +190,7 @@
M.set_nutrition(new_nutrition) //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature!
M.powerlevel = new_powerlevel
if(i != 1)
step_away(M,src)
step_away(M, get_turf(src))
M.Friends = Friends.Copy()
babies += M
M.mutation_chance = clamp(mutation_chance+(rand(5,-5)),0,100)
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/simple_animal/slime/slime.dm
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@
++Friends[user]
else
Friends[user] = 1
RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(clear_friend))
to_chat(user, "<span class='notice'>You feed the slime the plasma. It chirps happily.</span>")
var/obj/item/stack/sheet/mineral/plasma/S = W
S.use(1)
Expand Down Expand Up @@ -416,6 +417,10 @@
visible_message("<span class='warning'>The mutated core shudders, and collapses into a puddle, unable to maintain its form.</span>")
qdel(src)

/mob/living/simple_animal/slime/proc/clear_friend(mob/living/friend)
UnregisterSignal(friend, COMSIG_PARENT_QDELETING)
Friends -= friend

/mob/living/simple_animal/slime/proc/apply_water()
adjustBruteLoss(rand(15,20))
if(!client)
Expand Down

0 comments on commit d37a60d

Please sign in to comment.