Porting further material datum features and improvements.

This commit is contained in:
Ghommie
2020-06-24 20:45:17 +02:00
parent 07c7432f43
commit c5cbfa64e5
66 changed files with 945 additions and 234 deletions
+20 -43
View File
@@ -8,7 +8,7 @@
var/zone = BODY_ZONE_CHEST
var/slot
// DO NOT add slots with matching names to different zones - it will break internal_organs_slot list!
var/organ_flags = NONE
var/organ_flags = ORGAN_EDIBLE
var/maxHealth = STANDARD_ORGAN_THRESHOLD
var/damage = 0 //total damage this organ has sustained
///Healing factor and decay factor function on % of maxhealth, and do not work by applying a static number per tick
@@ -25,7 +25,23 @@
var/now_fixed
var/high_threshold_cleared
var/low_threshold_cleared
rad_flags = RAD_NO_CONTAMINATE
///When you take a bite you cant jam it in for surgery anymore.
var/useable = TRUE
var/list/food_reagents = list(/datum/reagent/consumable/nutriment = 5)
/obj/item/organ/Initialize()
. = ..()
if(organ_flags & ORGAN_EDIBLE)
AddComponent(/datum/component/edible, food_reagents, null, RAW | MEAT | GROSS, null, 10, null, null, null, CALLBACK(src, .proc/OnEatFrom))
START_PROCESSING(SSobj, src)
/obj/item/organ/Destroy()
if(owner)
// The special flag is important, because otherwise mobs can die
// while undergoing transformation into different mobs.
Remove(TRUE)
return ..()
/obj/item/organ/proc/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
if(!iscarbon(M) || owner == M)
@@ -157,47 +173,8 @@
if(damage > high_threshold)
. += "<span class='warning'>[src] is starting to look discolored.</span>"
/obj/item/organ/proc/prepare_eat()
var/obj/item/reagent_containers/food/snacks/organ/S = new
S.name = name
S.desc = desc
S.icon = icon
S.icon_state = icon_state
S.w_class = w_class
return S
/obj/item/reagent_containers/food/snacks/organ
name = "appendix"
icon_state = "appendix"
icon = 'icons/obj/surgery.dmi'
list_reagents = list(/datum/reagent/consumable/nutriment = 5)
foodtype = RAW | MEAT | GROSS
/obj/item/organ/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
/obj/item/organ/Destroy()
if(owner)
// The special flag is important, because otherwise mobs can die
// while undergoing transformation into different mobs.
Remove(TRUE)
return ..()
/obj/item/organ/attack(mob/living/carbon/M, mob/user)
if(M == user && ishuman(user))
var/mob/living/carbon/human/H = user
if(status == ORGAN_ORGANIC)
var/obj/item/reagent_containers/food/snacks/S = prepare_eat()
if(S)
qdel(src)
if(H.put_in_active_hand(S))
S.attack(H, H)
else
..()
/obj/item/organ/proc/OnEatFrom(eater, feeder)
useable = FALSE //You can't use it anymore after eating it you spaztic
/obj/item/organ/item_action_slot_check(slot,mob/user)
return //so we don't grant the organ's action to mobs who pick up the organ.