Fresh Meat, Leatherworking

This commit is contained in:
Mechoid
2020-11-07 15:08:04 -05:00
committed by VirgoBot
parent 4c7053ad44
commit 019926cbc7
38 changed files with 633 additions and 197 deletions
+66
View File
@@ -0,0 +1,66 @@
/mob/living
var/meat_amount = 0 // How much meat to drop from this mob when butchered
var/obj/meat_type // The meat object to drop
var/gib_on_butchery = FALSE
var/list/butchery_loot // Associated list, path = number.
// Harvest an animal's delicious byproducts
/mob/living/proc/harvest(var/mob/user, var/obj/item/I)
if(meat_type && meat_amount>0 && (stat == DEAD))
while(meat_amount > 0 && do_after(user, 0.5 SECONDS * (mob_size / 10), src))
var/obj/item/meat = new meat_type(get_turf(src))
meat.name = "[src.name] [meat.name]"
new /obj/effect/decal/cleanable/blood/splatter(get_turf(src))
meat_amount--
if(!meat_amount)
handle_butcher(user, I)
/mob/living/proc/can_butcher(var/mob/user, var/obj/item/I) // Override for special butchering checks.
if(((meat_type && meat_amount) || LAZYLEN(butchery_loot)) && stat == DEAD)
return TRUE
return FALSE
/mob/living/proc/handle_butcher(var/mob/user, var/obj/item/I)
if(!user || do_after(user, 2 SECONDS * mob_size / 10, src))
if(LAZYLEN(butchery_loot))
if(LAZYLEN(butchery_loot))
for(var/path in butchery_loot)
while(butchery_loot[path])
butchery_loot[path] -= 1
var/obj/item/loot = new path(get_turf(src))
loot.pixel_x = rand(-12, 12)
loot.pixel_y = rand(-12, 12)
butchery_loot.Cut()
butchery_loot = null
if(LAZYLEN(organs))
organs_by_name.Cut()
for(var/obj/item/organ/OR in organs)
OR.removed()
organs -= OR
if(LAZYLEN(internal_organs))
internal_organs_by_name.Cut()
for(var/obj/item/organ/OR in internal_organs)
OR.removed()
internal_organs -= OR
if(!ckey)
if(issmall(src))
user?.visible_message("<span class='danger'>[user] chops up \the [src]!</span>")
new /obj/effect/decal/cleanable/blood/splatter(get_turf(src))
if(gib_on_butchery)
qdel(src)
else
user?.visible_message("<span class='danger'>[user] butchers \the [src] messily!</span>")
if(gib_on_butchery)
gib()
@@ -1,4 +1,4 @@
/mob/living/carbon/
/mob/living/carbon
gender = MALE
var/datum/species/species //Contains icon generation and language information, set during New().
var/list/stomach_contents = list()
@@ -288,7 +288,7 @@
oxyloss = 0
else
..()
/mob/living/carbon/human/adjustHalLoss(var/amount)
if(species.flags & NO_PAIN)
halloss = 0
@@ -439,13 +439,14 @@ This function restores all organs.
return 0
return
/*
/mob/living/carbon/human/proc/get_organ(var/zone)
if(!zone)
zone = BP_TORSO
else if (zone in list( O_EYES, O_MOUTH ))
zone = BP_HEAD
return organs_by_name[zone]
*/
/mob/living/carbon/human/apply_damage(var/damage = 0, var/damagetype = BRUTE, var/def_zone = null, var/blocked = 0, var/soaked = 0, var/sharp = 0, var/edge = 0, var/obj/used_weapon = null)
if(Debug2)
@@ -44,7 +44,11 @@
var/age = 30 //Player's age (pure fluff)
var/b_type = "A+" //Player's bloodtype
<<<<<<< HEAD
var/datum/robolimb/synthetic //If they are a synthetic (aka synthetic torso)
=======
var/datum/robolimb/synthetic //If they are a synthetic (aka synthetic torso). Also holds the datum for the type of robolimb.
>>>>>>> 68b370b... Fresh Meat, Leatherworking (#7629)
var/list/all_underwear = list()
var/list/all_underwear_metadata = list()
@@ -85,7 +89,6 @@
var/special_voice = "" // For changing our voice. Used by a symptom.
var/last_dam = -1 //Used for determining if we need to process all organs or just some or even none.
var/list/bad_external_organs = list()// organs we check until they are good.
var/xylophone = 0 //For the spoooooooky xylophone cooldown
@@ -116,5 +119,9 @@
var/mob/living/carbon/human/vr_link = null
var/obj/machinery/machine_visual //machine that is currently applying visual effects to this mob. Only used for camera monitors currently.
<<<<<<< HEAD
inventory_panel_type = /datum/inventory_panel/human
=======
butchery_loot = list(/obj/item/stack/animalhide/human = 1)
>>>>>>> 68b370b... Fresh Meat, Leatherworking (#7629)
@@ -5,6 +5,7 @@
update_icons_body() //Body handles eyes
update_eyes() //For floating eyes only
/*
/mob/living/carbon/var/list/internal_organs = list()
/mob/living/carbon/human/var/list/organs = list()
/mob/living/carbon/human/var/list/organs_by_name = list() // map organ names to organs
@@ -13,6 +14,7 @@
/mob/living/carbon/human/proc/get_bodypart_name(var/zone)
var/obj/item/organ/external/E = get_organ(zone)
if(E) . = E.name
*/
/mob/living/carbon/human/proc/recheck_bad_external_organs()
var/damage_this_tick = getToxLoss()
+19
View File
@@ -31,9 +31,28 @@
nest = null
if(buckled)
buckled.unbuckle_mob(src, TRUE)
qdel(selected_image)
<<<<<<< HEAD
QDEL_NULL(vorePanel) //VOREStation Add
QDEL_LIST_NULL(vore_organs) //VOREStation Add
=======
if(LAZYLEN(organs))
organs_by_name.Cut()
while(organs.len)
var/obj/item/OR = organs[1]
organs -= OR
qdel(OR)
if(LAZYLEN(internal_organs))
internal_organs_by_name.Cut()
while(internal_organs.len)
var/obj/item/OR = internal_organs[1]
internal_organs -= OR
qdel(OR)
>>>>>>> 68b370b... Fresh Meat, Leatherworking (#7629)
return ..()
//mob verbs are faster than object verbs. See mob/verb/examine.
+5 -1
View File
@@ -70,8 +70,12 @@
var/makes_dirt = TRUE //FALSE if the mob shouldn't be making dirt on the ground when it walks
var/looking_elsewhere = FALSE //If the mob's view has been relocated to somewhere else, like via a camera or with binocs
<<<<<<< HEAD
var/image/selected_image = null // Used for buildmode AI control stuff.
var/inventory_panel_type = /datum/inventory_panel
var/datum/inventory_panel/inventory_panel
var/datum/inventory_panel/inventory_panel
=======
var/image/selected_image = null // Used for buildmode AI control stuff.
>>>>>>> 68b370b... Fresh Meat, Leatherworking (#7629)
+28
View File
@@ -0,0 +1,28 @@
/mob/living
var/list/internal_organs = list()
var/list/organs = list()
var/list/organs_by_name = list() // map organ names to organs
var/list/internal_organs_by_name = list() // so internal organs have less ickiness too
var/list/bad_external_organs = list()// organs we check until they are good.
/mob/living/proc/get_bodypart_name(var/zone)
var/obj/item/organ/external/E = get_organ(zone)
if(E) . = E.name
/mob/living/proc/get_organ(var/zone)
if(!zone)
zone = BP_TORSO
else if (zone in list( O_EYES, O_MOUTH ))
zone = BP_HEAD
return organs_by_name[zone]
/mob/living/gib()
for(var/obj/item/organ/I in internal_organs)
I.removed()
if(isturf(I?.loc)) // Some organs qdel themselves or other things when removed
I.throw_at(get_edge_target_turf(src,pick(alldirs)),rand(1,3),30)
for(var/obj/item/organ/external/E in src.organs)
E.droplimb(0,DROPLIMB_EDGE,1)
..()
@@ -71,6 +71,5 @@
/mob/living/simple_mob/proc/remove_eyes()
cut_overlay(eye_layer)
/mob/living/simple_mob/gib()
..(icon_gib,1,icon) // we need to specify where the gib animation is stored
..(icon_gib,1,icon) // we need to specify where the gib animation is stored
@@ -0,0 +1,8 @@
/mob/living/simple_mob
gib_on_butchery = TRUE
/mob/living/simple_mob/can_butcher(var/mob/user, var/obj/item/I) // Override for special butchering checks.
. = ..()
if(. && (!is_sharp(I) || !has_edge(I)))
return FALSE
@@ -68,9 +68,9 @@
else
var/datum/gender/T = gender_datums[src.get_visible_gender()]
to_chat(user, "<span class='notice'>\The [src] is dead, medical items won't bring [T.him] back to life.</span>") // the gender lookup is somewhat overkill, but it functions identically to the obsolete gender macros and future-proofs this code
if(meat_type && (stat == DEAD)) //if the animal has a meat, and if it is dead.
if(istype(O, /obj/item/weapon/material/knife))
harvest(user)
if(can_butcher(user, O)) //if the animal can be butchered, do so and return. It's likely to be gibbed.
harvest(user, O)
return
if(user.a_intent == I_HELP && harvest_tool && istype(O, harvest_tool) && stat != DEAD)
if(world.time > (harvest_recent + harvest_cooldown))
@@ -17,7 +17,7 @@
/mob/living/simple_mob/examine(mob/user)
. = ..()
if(user && harvest_tool && (get_dist(user, src) <= 3))
if(stat != DEAD && user && harvest_tool && (get_dist(user, src) <= 3))
. += "<span class='notice'>\The [src] can be [harvest_verb] with a [initial(harvest_tool.name)] every [round(harvest_cooldown, 0.1)] minutes.</span>"
var/time_to_harvest = (harvest_recent + harvest_cooldown) - world.time
if(time_to_harvest > 0)
+9 -1
View File
@@ -14,6 +14,8 @@
handle_special()
handle_guts()
return TRUE
@@ -94,7 +96,7 @@
throw_alert("oxy", /obj/screen/alert/too_much_oxy)
else
clear_alert("oxy")
if(min_tox && Environment.gas["phoron"] < min_tox)
atmos_unsuitable = 2
throw_alert("tox_in_air", /obj/screen/alert/not_enough_tox)
@@ -137,6 +139,12 @@
else
adjustOxyLoss(-unsuitable_atoms_damage)
/mob/living/simple_mob/proc/handle_guts()
for(var/obj/item/organ/OR in internal_organs)
OR.process()
for(var/obj/item/organ/OR in organs)
OR.process()
/mob/living/simple_mob/proc/handle_supernatural()
if(purge)
@@ -57,8 +57,6 @@
var/response_harm = "tries to hurt" // If clicked on harm intent
var/list/friends = list() // Mobs on this list wont get attacked regardless of faction status.
var/harm_intent_damage = 3 // How much an unarmed harm click does to this mob.
var/meat_amount = 0 // How much meat to drop from this mob when butchered
var/obj/meat_type // The meat object to drop
var/list/loot_list = list() // The list of lootable objects to drop, with "/path = prob%" structure
var/obj/item/weapon/card/id/myid// An ID card if they have one to give them access to stuff.
@@ -156,8 +154,15 @@
// contained in a cage
var/in_stasis = 0
<<<<<<< HEAD
// don't process me if there's nobody around to see it
low_priority = TRUE
=======
// Used for if the mob can drop limbs. Overrides species dmi.
var/limb_icon
// Used for if the mob can drop limbs. Overrides the icon cache key, so it doesn't keep remaking the icon needlessly.
var/limb_icon_key
>>>>>>> 68b370b... Fresh Meat, Leatherworking (#7629)
/mob/living/simple_mob/Initialize()
verbs -= /mob/verb/observe
@@ -170,8 +175,31 @@
if(has_eye_glow)
add_eyes()
return ..()
if(LAZYLEN(organs))
for(var/path in organs)
if(ispath(path))
var/obj/item/organ/external/neworg = new path(src)
neworg.name = "[name] [neworg.name]"
neworg.meat_type = meat_type
if(limb_icon)
neworg.force_icon = limb_icon
neworg.force_icon_key = limb_icon_key
organs |= neworg
organs -= path
if(LAZYLEN(internal_organs))
for(var/path in internal_organs)
if(ispath(path))
var/obj/item/organ/neworg = new path(src)
neworg.name = "[name] [neworg.name]"
neworg.meat_type = meat_type
internal_organs |= neworg
internal_organs -= path
return ..()
/mob/living/simple_mob/Destroy()
default_language = null
@@ -190,7 +218,6 @@
update_icon()
..()
//Client attached
/mob/living/simple_mob/Login()
. = ..()
@@ -269,27 +296,6 @@
/mob/living/simple_mob/get_speech_ending(verb, var/ending)
return verb
// Harvest an animal's delicious byproducts
/mob/living/simple_mob/proc/harvest(var/mob/user, var/invisible)
var/actual_meat_amount = max(1,(meat_amount/2))
var/attacker_name = user.name
if(invisible)
attacker_name = "someone"
if(meat_type && actual_meat_amount>0 && (stat == DEAD))
for(var/i=0;i<actual_meat_amount;i++)
var/obj/item/meat = new meat_type(get_turf(src))
meat.name = "[src.name] [meat.name]"
if(issmall(src))
user.visible_message("<span class='danger'>[attacker_name] chops up \the [src]!</span>")
new/obj/effect/decal/cleanable/blood/splatter(get_turf(src))
qdel(src)
else
user.visible_message("<span class='danger'>[attacker_name] butchers \the [src] messily!</span>")
gib()
/mob/living/simple_mob/is_sentient()
return mob_class & MOB_CLASS_HUMANOID|MOB_CLASS_ANIMAL|MOB_CLASS_SLIME // Update this if needed.
@@ -6,4 +6,17 @@
response_disarm = "shoos"
response_harm = "hits"
ai_holder_type = /datum/ai_holder/simple_mob/melee
ai_holder_type = /datum/ai_holder/simple_mob/melee
internal_organs = list(\
/obj/item/organ/internal/brain,\
/obj/item/organ/internal/heart,\
/obj/item/organ/internal/liver,\
/obj/item/organ/internal/stomach,\
/obj/item/organ/internal/intestine,\
/obj/item/organ/internal/lungs\
)
butchery_loot = list(\
/obj/item/stack/animalhide = 3\
)
@@ -110,6 +110,10 @@
var/poison_chance = 10 // Chance for injection to occur.
var/poison_per_bite = 5 // Amount added per injection.
butchery_loot = list(\
/obj/item/stack/material/chitin = 1\
)
/mob/living/simple_mob/animal/giant_spider/apply_melee_effects(var/atom/A)
if(isliving(A))
var/mob/living/L = A