diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index bf843cad..7ae413ec 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1103,3 +1103,5 @@ //define holder_type on nerds we wanna commit scoop to /mob/living/carbon/human var/holder_type = /obj/item/clothing/head/mob_holder/micro + can_be_held = "micro" + diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 63f1bd08..d0a16ea0 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -65,3 +65,5 @@ var/static/list/can_ride_typecache = typecacheof(list(/mob/living/carbon/human, /mob/living/simple_animal/slime, /mob/living/simple_animal/parrot)) var/lastpuke = 0 var/last_fire_update + + can_be_held = "micro" diff --git a/code/modules/mob/living/inhand_holder.dm b/code/modules/mob/living/inhand_holder.dm index c91ec665..e68260de 100644 --- a/code/modules/mob/living/inhand_holder.dm +++ b/code/modules/mob/living/inhand_holder.dm @@ -73,20 +73,10 @@ L.put_in_hands(holder) return -//shoehorned (get it?) and lazy way to do instant foot pickups cause haha funny. -/mob/living/proc/mob_pickupfeet(mob/living/L) - var/obj/item/clothing/head/mob_holder/holder = generate_mob_holder() - if(!holder) - return - drop_all_held_items() - L.equip_to_slot(holder, SLOT_SHOES) - return - /mob/living/proc/mob_try_pickup(mob/living/user) if(!ishuman(user) || !src.Adjacent(user) || user.incapacitated() || !can_be_held) return FALSE - if(abs(user.get_effective_size()/src.get_effective_size()) < 2.0 ) - to_chat(user, "They're too big to pick up!") + if(src.can_be_held == "micro") return FALSE if(user.get_active_held_item()) to_chat(user, "Your hands are full!") diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 70317492..d1c3492a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -42,6 +42,9 @@ /mob/living/proc/generate_mob_holder() + if(ishuman(src)) + var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(src), src, (istext(can_be_held) ? can_be_held : ""), 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi') + return holder var/obj/item/clothing/head/mob_holder/holder = new(get_turf(src), src, (istext(can_be_held) ? can_be_held : ""), 'icons/mob/animals_held.dmi', 'icons/mob/animals_held_lh.dmi', 'icons/mob/animals_held_rh.dmi') return holder @@ -1244,5 +1247,3 @@ /mob/living var/size_multiplier = 1 //multiplier for the mob's icon size atm var/previous_size = 1 - var/holder_default -// can_be_held = "micro" \ No newline at end of file diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 3740827b..3ae1e305 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -108,7 +108,7 @@ var/list/obj/effect/proc_holder/abilities = list() - var/can_be_held = TRUE //whether this can be picked up and held. Currently needs to be on for sizecode to work, fix later. + var/can_be_held = FALSE var/radiation = 0 //If the mob is irradiated. var/ventcrawl_layer = PIPING_LAYER_DEFAULT diff --git a/hyperstation/code/modules/resize/holder_micro.dm b/hyperstation/code/modules/resize/holder_micro.dm index 6f3d7806..31193594 100644 --- a/hyperstation/code/modules/resize/holder_micro.dm +++ b/hyperstation/code/modules/resize/holder_micro.dm @@ -1,8 +1,158 @@ -// Micro Holders - Extends /obj/item/holder +// Micro Holders - Extends /obj/item/holder... TO:DO, just use most of the already-set procs in inhand_holder.dm /obj/item/clothing/head/mob_holder/micro name = "micro" desc = "Another person, small enough to fit in your hand." - icon = null // I forgot how to fix this. + icon = null icon_state = "" - slot_flags = ITEM_SLOT_FEET | ITEM_SLOT_HEAD | ITEM_SLOT_ID \ No newline at end of file + slot_flags = ITEM_SLOT_FEET | ITEM_SLOT_HEAD | ITEM_SLOT_ID | ITEM_SLOT_BACK | ITEM_SLOT_NECK + w_class = WEIGHT_CLASS_NORMAL + can_head = TRUE + +/obj/item/clothing/head/mob_holder/micro/Initialize(mapload, mob/living/M, _worn_state, alt_worn, lh_icon, rh_icon, _can_head_override = FALSE) + . = ..() + + if(M) + M.setDir(SOUTH) + held_mob = M + M.forceMove(src) + appearance = M.appearance + name = M.name + desc = M.desc + assimilate(M) + + if(_can_head_override) + can_head = _can_head_override + if(alt_worn) + alternate_worn_icon = alt_worn + if(_worn_state) + item_state = _worn_state + icon_state = _worn_state + if(lh_icon) + lefthand_file = lh_icon + if(rh_icon) + righthand_file = rh_icon + +/obj/item/clothing/head/mob_holder/micro/proc/assimilate(mob/living/M) + switch(M.mob_size) + if(MOB_SIZE_TINY) + w_class = WEIGHT_CLASS_TINY + if(MOB_SIZE_SMALL) + w_class = WEIGHT_CLASS_SMALL + if(MOB_SIZE_LARGE) + w_class = WEIGHT_CLASS_HUGE + + +/obj/item/clothing/head/mob_holder/micro/Destroy() + if(held_mob) + release() + return ..() + +/obj/item/clothing/head/mob_holder/micro/dropped() + ..() + if(isturf(loc))//don't release on soft-drops + release() + +/obj/item/clothing/head/mob_holder/micro/relaymove(mob/user) + return + +//TODO: add a timer to escape someone's grip dependant on size diff +/obj/item/clothing/head/mob_holder/micro/container_resist() + if(isliving(loc)) + var/mob/living/L = loc + visible_message("[src] escapes [L]!") + release() + +/mob/living/proc/mob_pickup_micro(mob/living/L) + var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() + if(!holder) + return + drop_all_held_items() + L.put_in_hands(holder) + return + +//shoehorned (get it?) and lazy way to do instant foot pickups cause haha funny. +/mob/living/proc/mob_pickup_micro_feet(mob/living/L) + var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() + if(!holder) + return + drop_all_held_items() + L.equip_to_slot(holder, SLOT_SHOES) + return + +/mob/living/proc/mob_try_pickup_micro(mob/living/user) + if(!ishuman(user) || !src.Adjacent(user) || user.incapacitated() || !can_be_held) + return FALSE + if(abs(user.get_effective_size()/src.get_effective_size()) < 2.0 ) + to_chat(user, "They're too big to pick up!") + return FALSE + if(user.get_active_held_item()) + to_chat(user, "Your hands are full!") + return FALSE + if(buckled) + to_chat(user, "[src] is buckled to something!") + return FALSE + if(src == user) + to_chat(user, "You can't pick yourself up.") + return FALSE + visible_message("[user] starts picking up [src].", \ + "[user] starts picking you up!") + if(!do_after(user, 20, target = src)) + return FALSE + + if(user.get_active_held_item()||buckled) + return FALSE + + visible_message("[user] picks up [src]!", \ + "[user] picks you up!") + to_chat(user, "You pick [src] up.") + mob_pickup_micro(user) + return TRUE + +/mob/living/AltClick(mob/user) + . = ..() + if(mob_try_pickup_micro(user)) + return TRUE + +/obj/item/clothing/head/mob_holder/micro/assume_air(datum/gas_mixture/env) + var/atom/location = loc + if(!loc) + return //null + var/turf/T = get_turf(loc) + while(location != T) + location = location.loc + if(ismob(location)) + return location.loc.assume_air(env) + return location.assume_air(env) + +/obj/item/clothing/head/mob_holder/micro/remove_air(amount) + var/atom/location = loc + if(!loc) + return //null + var/turf/T = get_turf(loc) + while(location != T) + location = location.loc + if(ismob(location)) + return location.loc.remove_air(amount) + return location.remove_air(amount) + +/obj/item/clothing/head/mob_holder/micro/examine(var/mob/user) + for(var/mob/living/M in contents) + M.examine(user) + +/obj/item/clothing/head/mob_holder/micro/MouseDrop(mob/M as mob) + ..() + if(M != usr) return + if(usr == src) return + if(!Adjacent(usr)) return + if(istype(M,/mob/living/silicon/ai)) return + for(var/mob/living/carbon/human/O in contents) + O.show_inv(usr) + +/obj/item/clothing/head/mob_holder/micro/attack_self(var/mob/living/user) + for(var/mob/living/carbon/human/M in contents) + M.help_shake_act(user) + +/obj/item/clothing/head/mob_holder/micro/attacked_by(obj/item/I, mob/living/user) + for(var/mob/living/carbon/human/M in contents) + M.attacked_by(I, user) diff --git a/hyperstation/code/modules/resize/resizing.dm b/hyperstation/code/modules/resize/resizing.dm index e536bff6..86254176 100644 --- a/hyperstation/code/modules/resize/resizing.dm +++ b/hyperstation/code/modules/resize/resizing.dm @@ -22,6 +22,7 @@ var/const/RESIZE_A_TINYMICRO = (RESIZE_TINY + RESIZE_MICRO) / 2 M.Scale(size_multiplier) M.Translate(0, 16*(size_multiplier-1)) //translate by 16 * size_multiplier - 1 on Y axis src.transform = M //the source of transform is M + src.update_mobsize() //Doesn't work yet /mob/proc/get_effective_size() return 100000 @@ -38,34 +39,36 @@ mob/living/get_effective_size() //handle the big steppy, except nice /mob/living/proc/handle_micro_bump_helping(var/mob/living/tmob) + if(ishuman(src)) + var/mob/living/carbon/human/H = src - //Both small. - if(src.get_effective_size() <= RESIZE_A_SMALLTINY && tmob.get_effective_size() <= RESIZE_A_SMALLTINY) - now_pushing = 0 - src.forceMove(tmob.loc) - return 1 - - //Doing messages - if(abs(get_effective_size()/tmob.get_effective_size()) >= 2) //if the initiator is twice the size of the micro - now_pushing = 0 - src.forceMove(tmob.loc) - - //Smaller person being stepped on - if(get_effective_size() > tmob.get_effective_size() && iscarbon(src)) - if(istype(tmob) && istype(tmob, /datum/sprite_accessory/taur/naga)) - to_chat(src,"You carefully slither around [tmob].") - to_chat(tmob,"[src]'s huge tail slithers beside you!") - else - to_chat(src,"You carefully step over [tmob].") - to_chat(tmob,"[src] steps over you carefully!") + //Both small. + if(H.get_effective_size() <= RESIZE_A_SMALLTINY && tmob.get_effective_size() <= RESIZE_A_SMALLTINY) + now_pushing = 0 + H.forceMove(tmob.loc) return 1 - //Smaller person stepping under a larger person - if(tmob.get_effective_size() > get_effective_size()) - micro_step_under(tmob) - src.forceMove(tmob.loc) - now_pushing = 0 - return 1 + //Doing messages + if(abs(get_effective_size()/tmob.get_effective_size()) >= 2) //if the initiator is twice the size of the micro + now_pushing = 0 + H.forceMove(tmob.loc) + + //Smaller person being stepped on + if(get_effective_size() > tmob.get_effective_size() && iscarbon(src)) + if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") + to_chat(H,"You carefully slither around [tmob].") + to_chat(tmob,"[H]'s huge tail slithers beside you!") + else + to_chat(H,"You carefully step over [tmob].") + to_chat(tmob,"[H] steps over you carefully!") + return 1 + + //Smaller person stepping under a larger person + if(tmob.get_effective_size() > get_effective_size()) + H.forceMove(tmob.loc) + now_pushing = 0 + micro_step_under(tmob) + return 1 //Stepping on disarm intent -- TO DO, OPTIMIZE ALL OF THIS SHIT /mob/living/proc/handle_micro_bump_other(var/mob/living/tmob) @@ -83,72 +86,63 @@ mob/living/get_effective_size() if(H.a_intent == "disarm" && H.canmove && !H.buckled) now_pushing = 0 H.forceMove(tmob.loc) + sizediffStamLoss(tmob) if(get_effective_size() > tmob.get_effective_size() && iscarbon(H)) - if(istype(tmob) && istype(tmob, /datum/sprite_accessory/taur/naga)) + if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") to_chat(H,"You carefully roll over [tmob] with your tail!") to_chat(tmob,"[H]'s huge tail rolls over you!") - sizediffStamLoss(tmob) else to_chat(H,"You painfully but harmlessly step on [tmob]!") to_chat(tmob,"[H] steps onto you with force!") - sizediffStamLoss(tmob) return 1 if(H.a_intent == "harm" && H.canmove && !H.buckled) now_pushing = 0 H.forceMove(tmob.loc) + sizediffStamLoss(tmob) + sizediffBruteloss(tmob) if(get_effective_size() > tmob.get_effective_size() && iscarbon(H)) - if(istype(tmob) && istype(tmob, /datum/sprite_accessory/taur/naga)) + if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") to_chat(H,"You grind [tmob] into the floor with your tail!") to_chat(tmob,"[H]'s massive tail plows you into the floor!") - sizediffStamLoss(tmob) - sizediffBruteloss(tmob) else to_chat(H,"You pound [tmob] into the floor underfoot!") to_chat(tmob,"[H] slams you into the ground, crushing you!") - sizediffStamLoss(tmob) - sizediffBruteloss(tmob) return 1 if(H.a_intent == "grab" && H.canmove && !H.buckled) now_pushing = 0 H.forceMove(tmob.loc) + sizediffStamLoss(tmob) + sizediffStun(tmob) if(get_effective_size() > tmob.get_effective_size() && iscarbon(H)) var/feetCover = (H.wear_suit && (H.wear_suit.body_parts_covered & FEET)) || (H.w_uniform && (H.w_uniform.body_parts_covered & FEET) || (H.shoes && (H.shoes.body_parts_covered & FEET))) if(feetCover) - if(istype(tmob) && istype(tmob, /datum/sprite_accessory/taur/naga)) + if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") to_chat(H,"You pin [tmob] underneath your tail!") to_chat(tmob,"[H]'s plows you into the ground, pinning you helplessly!") - sizediffStamLoss(tmob) - sizediffStun(tmob) else to_chat(H,"You pin [tmob] helplessly to the floor with your foot!") to_chat(tmob,"[H] weightfully pins you to the ground!") - sizediffStamLoss(tmob) - sizediffStun(tmob) return 1 else - if(istype(tmob) && istype(tmob, /datum/sprite_accessory/taur/naga)) + if(istype(H) && H.dna.features["taur"] == "Naga" || H.dna.features["taur"] == "Tentacle") to_chat(H,"You curl [tmob] up in the coils of your tail!") to_chat(tmob,"[H]'s tail winds around you and snatches you in its coils!") - sizediffStamLoss(tmob) - sizediffStun(tmob) - tmob.mob_pickupfeet(H) + tmob.mob_pickup_micro_feet(H) else to_chat(H,"You stomp your foot into [tmob], curling your toes and picking them up!") to_chat(tmob,"[H]'s toes pin you down and curl around you, picking you up!'") - sizediffStamLoss(tmob) - sizediffStun(tmob) - tmob.mob_pickupfeet(H) + tmob.mob_pickup_micro_feet(H) return 1 if(tmob.get_effective_size() > get_effective_size()) - micro_step_under(tmob) H.forceMove(tmob.loc) now_pushing = 0 + micro_step_under(tmob) return 1 -//smaller person stepping under another person +//smaller person stepping under another person... TO DO, fix and allow special interactions with naga legs to be seen /mob/living/proc/micro_step_under(var/mob/living/tmob) if(istype(tmob) && istype(tmob, /datum/sprite_accessory/taur/naga)) to_chat(src,"You jump over [tmob]'s thick tail.") @@ -172,6 +166,15 @@ mob/living/get_effective_size() var/B = (get_effective_size()/tmob.get_effective_size()*2) //macro divided by micro, times 2 tmob.adjustBruteLoss(B) //final result in brute loss +//Proc for changing mob_size to be grabbed for item weight classes +/mob/living/proc/update_mobsize() + if(size_multiplier <= 0.50) + mob_size = MOB_SIZE_TINY + if(size_multiplier <= 1) + mob_size = MOB_SIZE_SMALL + if(size_multiplier >= 2) + mob_size = MOB_SIZE_LARGE + //Proc for instantly grabbing valid size difference. Code optimizations soon(TM) /* /mob/living/proc/sizeinteractioncheck(var/mob/living/tmob)