Skip to content

Commit

Permalink
[MIRROR] Slime type datum, and cleans up slime related code [MDB IGNO…
Browse files Browse the repository at this point in the history
…RE] (#25250)

* Slime type datum, and cleans up slime related code

* Resolves Conflict, Preserves SR Edit

* Update code/game/objects/items/devices/scanners/slime_scanner.dm

Co-authored-by: Bloop <[email protected]>

---------

Co-authored-by: Profakos <[email protected]>
Co-authored-by: Bloop <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
  • Loading branch information
4 people authored and FFMirrorBot committed Nov 26, 2023
1 parent fb6a74f commit b6d3741
Show file tree
Hide file tree
Showing 30 changed files with 1,049 additions and 840 deletions.
16 changes: 8 additions & 8 deletions _maps/RandomRuins/SpaceRuins/hilbertresearchfacility.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
"jC" = (
/mob/living/simple_animal/slime{
colour = "bluespace";
rabid = 1
rabid = 1;
slime_type = /datum/slime_type/bluespace
},
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/mineral/titanium/tiled/purple,
Expand Down Expand Up @@ -899,8 +899,8 @@
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
"wY" = (
/mob/living/simple_animal/slime{
colour = "bluespace";
rabid = 1
rabid = 1;
slime_type = /datum/slime_type/bluespace
},
/turf/open/floor/mineral/plastitanium,
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
Expand Down Expand Up @@ -2186,8 +2186,8 @@
},
/obj/effect/decal/cleanable/dirt,
/mob/living/simple_animal/slime{
colour = "bluespace";
rabid = 1
rabid = 1;
slime_type = /datum/slime_type/bluespace
},
/turf/open/floor/mineral/titanium/tiled/purple,
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
Expand Down Expand Up @@ -2312,8 +2312,8 @@
/area/ruin/space/has_grav/powered/hilbertresearchfacility)
"Ze" = (
/mob/living/simple_animal/slime{
colour = "bluespace";
rabid = 1
rabid = 1;
slime_type = /datum/slime_type/bluespace
},
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/mineral/plastitanium,
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/syndicatebomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
reactants += G.reagents

for(var/obj/item/slime_extract/S in beakers)
if(S.Uses)
if(S.extract_uses)
for(var/obj/item/reagent_containers/cup/G in beakers)
G.reagents.trans_to(S, G.reagents.total_volume)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if(istype(tile))
tile.atmos_spawn_air("[GAS_O2]=500;[GAS_PLASMA]=500;[TURF_TEMPERATURE(1000)]") //Make it hot and burny for the new slime

var/new_colour = pick("red", "orange")
var/new_colour = pick(/datum/slime_type/red, /datum/slime_type/orange)
var/mob/living/simple_animal/slime/pyro = new(tile, new_colour)
pyro.rabid = TRUE
pyro.amount_grown = SLIME_EVOLUTION_THRESHOLD
Expand Down
63 changes: 33 additions & 30 deletions code/game/objects/items/devices/scanners/slime_scanner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,44 @@
throw_range = 7
custom_materials = list(/datum/material/iron=SMALL_MATERIAL_AMOUNT*0.30, /datum/material/glass=SMALL_MATERIAL_AMOUNT * 0.20)

/obj/item/slime_scanner/attack(mob/living/M, mob/living/user)
if(user.stat || !user.can_read(src)) //SKYRAT EDIT: Blind People Can Analyze Again
/obj/item/slime_scanner/attack(mob/living/living_mob, mob/living/user)
if(user.stat || !user.can_read(src)) //SKYRAT EDIT CHANGE - Blind People Can Analyze Again - ORIGINAL : if(user.stat || !user.can_read(src) || user.is_blind())
return
if (!isslime(M))
if (!isslime(living_mob))
to_chat(user, span_warning("This device can only scan slimes!"))
return
var/mob/living/simple_animal/slime/T = M
slime_scan(T, user)
var/mob/living/simple_animal/slime/scanned_slime = living_mob
slime_scan(scanned_slime, user)

/proc/slime_scan(mob/living/simple_animal/slime/T, mob/living/user)
/proc/slime_scan(mob/living/simple_animal/slime/scanned_slime, mob/living/user)
var/to_render = "<b>Slime scan results:</b>\
\n[span_notice("[T.colour] [T.is_adult ? "adult" : "baby"] slime")]\
\nNutrition: [T.nutrition]/[T.get_max_nutrition()]"
if (T.nutrition < T.get_starve_nutrition())
\n[span_notice("[scanned_slime.slime_type.colour] [scanned_slime.is_adult ? "adult" : "baby"] slime")]\
\nNutrition: [scanned_slime.nutrition]/[scanned_slime.get_max_nutrition()]"

if (scanned_slime.nutrition < scanned_slime.get_starve_nutrition())
to_render += "\n[span_warning("Warning: slime is starving!")]"
else if (T.nutrition < T.get_hunger_nutrition())
else if (scanned_slime.nutrition < scanned_slime.get_hunger_nutrition())
to_render += "\n[span_warning("Warning: slime is hungry")]"
to_render += "\nElectric change strength: [T.powerlevel]\nHealth: [round(T.health/T.maxHealth,0.01)*100]%"
if (T.slime_mutation[4] == T.colour)
to_render += "\nThis slime does not evolve any further."
else
if (T.slime_mutation[3] == T.slime_mutation[4])
if (T.slime_mutation[2] == T.slime_mutation[1])
to_render += "\nPossible mutation: [T.slime_mutation[3]]\
\nGenetic destability: [T.mutation_chance/2] % chance of mutation on splitting"
else
to_render += "\nPossible mutations: [T.slime_mutation[1]], [T.slime_mutation[2]], [T.slime_mutation[3]] (x2)\
\nGenetic destability: [T.mutation_chance] % chance of mutation on splitting"
else
to_render += "\nPossible mutations: [T.slime_mutation[1]], [T.slime_mutation[2]], [T.slime_mutation[3]], [T.slime_mutation[4]]\
\nGenetic destability: [T.mutation_chance] % chance of mutation on splitting"
if (T.cores > 1)

to_render += "\nElectric charge strength: [scanned_slime.powerlevel]\nHealth: [round(scanned_slime.health/scanned_slime.maxHealth,0.01)*100]%"

to_render += "\nPossible mutation[scanned_slime.slime_type.mutations.len > 1 ? "s" : ""]: "
var/list/mutation_text = list()
for(var/datum/slime_type/key as anything in scanned_slime.slime_type.mutations)
mutation_text += initial(key.colour)

if(!mutation_text.len)
to_render += " None detected."

to_render += "[mutation_text.Join(", ")]"
to_render += "\nGenetic instability: [scanned_slime.mutation_chance] % chance of mutation attempt on splitting."

if (scanned_slime.cores > 1)
to_render += "\nMultiple cores detected"
to_render += "\nGrowth progress: [T.amount_grown]/[SLIME_EVOLUTION_THRESHOLD]"
if(T.effectmod)
to_render += "\n[span_notice("Core mutation in progress: [T.effectmod]")]\
\n[span_notice("Progress in core mutation: [T.applied] / [SLIME_EXTRACT_CROSSING_REQUIRED]")]"
to_chat(user, examine_block(to_render))
to_render += "\nGrowth progress: [scanned_slime.amount_grown]/[SLIME_EVOLUTION_THRESHOLD]"

if(scanned_slime.crossbreed_modification)
to_render += "\n[span_notice("Core mutation in progress: [scanned_slime.crossbreed_modification]")]\
\n[span_notice("Progress in core mutation: [scanned_slime.applied_crossbreed_amount] / [SLIME_EXTRACT_CROSSING_REQUIRED]")]"

to_chat(user, examine_block(jointext(to_render,"")))
2 changes: 1 addition & 1 deletion code/game/objects/items/grenades/chem_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@

if(istype(thing, /obj/item/slime_extract))
var/obj/item/slime_extract/extract = thing
if(!extract.Uses)
if(!extract.extract_uses)
continue

extract_total_volume += extract.reagents.total_volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
to_chat(owner, span_warning("You feel nauseated!"))
owner.vomit(VOMIT_CATEGORY_DEFAULT, lost_nutrition = 20)

var/mob/living/simple_animal/slime/Slime = new(get_turf(owner), "grey")
var/mob/living/simple_animal/slime/Slime = new(get_turf(owner), /datum/slime_type/grey)
Slime.set_friends(list(owner))
Slime.set_leader(owner)
4 changes: 2 additions & 2 deletions code/modules/food_and_drinks/machinery/processor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@
return
var/core_count = processed_slime.cores
for(var/i in 1 to (core_count+rating_amount-1))
var/atom/movable/item = new processed_slime.coretype(drop_location())
var/atom/movable/item = new processed_slime.slime_type.core_type(drop_location())
adjust_item_drop_location(item)
SSblackbox.record_feedback("tally", "slime_core_harvested", 1, processed_slime.colour)
SSblackbox.record_feedback("tally", "slime_core_harvested", 1, processed_slime.slime_type.colour)
return ..()

#undef PROCESSOR_SELECT_RECIPE
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@

else
var/obj/item/slime_extract/to_integrate = human_owner.get_active_held_item()
if(!istype(to_integrate) || to_integrate.Uses <= 0)
if(!istype(to_integrate) || to_integrate.extract_uses <= 0)
human_owner.balloon_alert(human_owner, "need an unused slime extract!")
return
if(!human_owner.temporarilyRemoveItemFromInventory(to_integrate))
Expand Down
24 changes: 12 additions & 12 deletions code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -297,25 +297,25 @@
return TRUE


/mob/living/attack_slime(mob/living/simple_animal/slime/M, list/modifiers)
if(M.buckled)
if(M in buckled_mobs)
M.Feedstop()
/mob/living/attack_slime(mob/living/simple_animal/slime/attacking_slime, list/modifiers)
if(attacking_slime.buckled)
if(attacking_slime in buckled_mobs)
attacking_slime.stop_feeding()
return // can't attack while eating!

if(HAS_TRAIT(src, TRAIT_PACIFISM))
to_chat(M, span_warning("You don't want to hurt anyone!"))
if(HAS_TRAIT(attacking_slime, TRAIT_PACIFISM))
to_chat(attacking_slime, span_warning("You don't want to hurt anyone!"))
return FALSE

if(check_block(src, M.melee_damage_upper, "[M]'s glomp", MELEE_ATTACK, M.armour_penetration, M.melee_damage_type))
if(check_block(src, attacking_slime.melee_damage_upper, "[attacking_slime]'s glomp", MELEE_ATTACK, attacking_slime.armour_penetration, attacking_slime.melee_damage_type))
return FALSE

if (stat != DEAD)
log_combat(M, src, "attacked")
M.do_attack_animation(src)
visible_message(span_danger("\The [M.name] glomps [src]!"), \
span_userdanger("\The [M.name] glomps you!"), span_hear("You hear a sickening sound of flesh hitting flesh!"), COMBAT_MESSAGE_RANGE, M)
to_chat(M, span_danger("You glomp [src]!"))
log_combat(attacking_slime, src, "attacked")
attacking_slime.do_attack_animation(src)
visible_message(span_danger("\The [attacking_slime.name] glomps [src]!"), \
span_userdanger("\The [attacking_slime.name] glomps you!"), span_hear("You hear a sickening sound of flesh hitting flesh!"), COMBAT_MESSAGE_RANGE, attacking_slime)
to_chat(attacking_slime, span_danger("You glomp [src]!"))
return TRUE

return FALSE
Expand Down
16 changes: 8 additions & 8 deletions code/modules/mob/living/simple_animal/slime/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
return
if(!gibbed)
if(is_adult)
var/mob/living/simple_animal/slime/M = new(drop_location(), colour)
M.rabid = TRUE
M.regenerate_icons()
var/mob/living/simple_animal/slime/new_slime = new(drop_location(), slime_type.type)
new_slime.rabid = TRUE
new_slime.regenerate_icons()

is_adult = FALSE
maxHealth = 150
for(var/datum/action/innate/slime/reproduce/R in actions)
R.Remove(src)
var/datum/action/innate/slime/evolve/E = new
E.Grant(src)
for(var/datum/action/innate/slime/reproduce/reproduce_action in actions)
reproduce_action.Remove(src)
var/datum/action/innate/slime/evolve/evolve_action = new
evolve_action.Grant(src)
revive(HEAL_ALL)
regenerate_icons()
update_name()
return

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

cut_overlays()

Expand Down
Loading

0 comments on commit b6d3741

Please sign in to comment.