mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 19:22:56 +00:00
Conflicts: baystation12.dme code/ATMOSPHERICS/components/unary/vent_pump.dm code/ATMOSPHERICS/components/unary/vent_scrubber.dm code/__HELPERS/game.dm code/controllers/shuttle_controller.dm code/datums/datumvars.dm code/datums/supplypacks.dm code/defines/obj/storage.dm code/defines/obj/vending.dm code/defines/obj/weapon.dm code/defines/procs/command_alert.dm code/game/area/Space Station 13 areas.dm code/game/atoms.dm code/game/gamemodes/changeling/modularchangling.dm code/game/gamemodes/cult/runes.dm code/game/gamemodes/events.dm code/game/gamemodes/events/dust.dm code/game/gamemodes/events/miniblob.dm code/game/gamemodes/events/ninja_equipment.dm code/game/gamemodes/factions.dm code/game/gamemodes/game_mode.dm code/game/gamemodes/gameticker.dm code/game/jobs/access.dm code/game/jobs/job/assistant.dm code/game/jobs/job/captain.dm code/game/jobs/job/civilian.dm code/game/jobs/job/engineering.dm code/game/jobs/job/medical.dm code/game/jobs/job/science.dm code/game/jobs/job/security.dm code/game/jobs/job_controller.dm code/game/machinery/alarm.dm code/game/machinery/atmo_control.dm code/game/machinery/atmoalter/area_atmos_computer.dm code/game/machinery/bots/medbot.dm code/game/machinery/computer/HolodeckControl.dm code/game/machinery/computer/ai_core.dm code/game/machinery/computer/atmos_alert.dm code/game/machinery/computer/card.dm code/game/machinery/computer/cloning.dm code/game/machinery/computer/computer.dm code/game/machinery/computer/message.dm code/game/machinery/computer/pod.dm code/game/machinery/computer/prisoner.dm code/game/machinery/computer/syndicate_shuttle.dm code/game/machinery/constructable_frame.dm code/game/machinery/doors/door.dm code/game/machinery/doors/firedoor.dm code/game/machinery/newscaster.dm code/game/machinery/recharger.dm code/game/machinery/spaceheater.dm code/game/machinery/telecomms/broadcaster.dm code/game/machinery/telecomms/logbrowser.dm code/game/machinery/telecomms/machine_interactions.dm code/game/machinery/teleporter.dm code/game/machinery/wishgranter.dm code/game/mecha/mech_fabricator.dm code/game/mecha/working/ripley.dm code/game/objects/items.dm code/game/objects/items/blueprints.dm code/game/objects/items/devices/flashlight.dm code/game/objects/items/devices/radio/encryptionkey.dm code/game/objects/items/devices/uplinks.dm code/game/objects/items/stacks/medical.dm code/game/objects/items/weapons/cards_ids.dm code/game/objects/items/weapons/gift_wrappaper.dm code/game/objects/items/weapons/hydroponics.dm code/game/objects/items/weapons/manuals.dm code/game/objects/items/weapons/secstorage/secstorage.dm code/game/objects/items/weapons/storage/backpack.dm code/game/objects/items/weapons/storage/firstaid.dm code/game/objects/items/weapons/storage/kit.dm code/game/objects/items/weapons/storage/storage.dm code/game/objects/items/weapons/storage/toolbox.dm code/game/objects/items/weapons/storage/uplink_kits.dm code/game/objects/items/weapons/stunbaton.dm code/game/objects/items/weapons/surgery_tools.dm code/game/objects/items/weapons/tools.dm code/game/objects/structures/crates_lockers/closets/secure/cargo.dm code/game/objects/structures/crates_lockers/closets/secure/hydroponics.dm code/game/objects/structures/crates_lockers/closets/secure/scientist.dm code/game/objects/structures/crates_lockers/closets/secure/security.dm code/game/objects/structures/electricchair.dm code/game/objects/structures/extinguisher.dm code/game/objects/structures/watercloset.dm code/game/objects/weapons.dm code/game/turfs/turf.dm code/game/vehicles/airtight/airtight.dm code/game/vehicles/vehicle.dm code/global.dm code/modules/DetectiveWork/evidence.dm code/modules/admin/IsBanned.dm code/modules/admin/player_panel.dm code/modules/admin/verbs/diagnostics.dm code/modules/admin/verbs/getlogs.dm code/modules/client/preferences.dm code/modules/clothing/masks/miscellaneous.dm code/modules/clothing/spacesuits/rig.dm code/modules/clothing/suits/miscellaneous.dm code/modules/critters/critter_defenses.dm code/modules/detectivework/scanner.dm code/modules/flufftext/Hallucination.dm code/modules/food/recipes_microwave.dm code/modules/mining/mine_items.dm code/modules/mining/mine_turfs.dm code/modules/mining/satchel_ore_boxdm.dm code/modules/mob/dead/observer/observer.dm code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm code/modules/mob/living/carbon/alien/special/facehugger.dm code/modules/mob/living/carbon/carbon.dm code/modules/mob/living/carbon/carbon_defines.dm code/modules/mob/living/carbon/human/human.dm code/modules/mob/living/carbon/human/human_attackhand.dm code/modules/mob/living/carbon/human/life.dm code/modules/mob/living/carbon/human/say.dm code/modules/mob/living/carbon/human/update_icons.dm code/modules/mob/living/carbon/metroid/metroid.dm code/modules/mob/living/living.dm code/modules/mob/living/silicon/ai/life.dm code/modules/mob/living/silicon/robot/robot.dm code/modules/mob/mob_cleanup.dm code/modules/mob/mob_defines.dm code/modules/mob/mob_transformation_simple.dm code/modules/paperwork/clipboard.dm code/modules/paperwork/folders.dm code/modules/paperwork/paper.dm code/modules/paperwork/paperbin.dm code/modules/paperwork/pen.dm code/modules/power/cable.dm code/modules/projectiles/guns/energy/special.dm code/modules/projectiles/guns/projectile/revolver.dm code/modules/projectiles/projectile/change.dm code/modules/projectiles/projectile/special.dm code/modules/reagents/Chemistry-Reagents.dm code/modules/reagents/reagent_containers/glass.dm code/modules/reagents/reagent_containers/hypospray.dm code/modules/recycling/sortingmachinery.dm code/modules/research/designs.dm config/config.txt html/changelog.html icons/mob/head.dmi icons/mob/hud.dmi icons/mob/items_lefthand.dmi icons/mob/items_righthand.dmi icons/mob/mask.dmi icons/mob/suit.dmi icons/mob/ties.dmi icons/mob/uniform.dmi icons/obj/clothing/hats.dmi icons/obj/clothing/masks.dmi icons/obj/clothing/suits.dmi icons/obj/clothing/ties.dmi icons/obj/grenade.dmi icons/obj/projectiles.dmi Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
314 lines
7.8 KiB
Plaintext
314 lines
7.8 KiB
Plaintext
//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting l_hand = ...etc
|
|
//as they handle all relevant stuff like adding it to the player's screen and updating their overlays.
|
|
|
|
//Returns the thing in our active hand
|
|
/mob/proc/get_active_hand()
|
|
if(issilicon(src))
|
|
if(isrobot(src))
|
|
if(src:module_active)
|
|
return src:module_active
|
|
else
|
|
if(hand) return l_hand
|
|
else return r_hand
|
|
|
|
//Returns the thing in our inactive hand
|
|
/mob/proc/get_inactive_hand()
|
|
if(hand) return r_hand
|
|
else return l_hand
|
|
|
|
//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success.
|
|
/mob/proc/put_in_l_hand(var/obj/item/W)
|
|
if(lying) return 0
|
|
if(!istype(W)) return 0
|
|
if(!l_hand)
|
|
W.loc = src //TODO: move to equipped?
|
|
l_hand = W
|
|
W.layer = 20 //TODO: move to equipped?
|
|
// l_hand.screen_loc = ui_lhand
|
|
W.equipped(src,slot_l_hand)
|
|
if(client) client.screen |= W
|
|
if(pulling == W) stop_pulling()
|
|
update_inv_l_hand()
|
|
return 1
|
|
return 0
|
|
|
|
//Puts the item into your r_hand if possible and calls all necessary triggers/updates. returns 1 on success.
|
|
/mob/proc/put_in_r_hand(var/obj/item/W)
|
|
if(lying) return 0
|
|
if(!istype(W)) return 0
|
|
if(!r_hand)
|
|
W.loc = src
|
|
r_hand = W
|
|
W.layer = 20
|
|
// r_hand.screen_loc = ui_rhand
|
|
W.equipped(src,slot_r_hand)
|
|
if(client) client.screen |= W
|
|
if(pulling == W) stop_pulling()
|
|
update_inv_r_hand()
|
|
return 1
|
|
return 0
|
|
|
|
//Puts the item into our active hand if possible. returns 1 on success.
|
|
/mob/proc/put_in_active_hand(var/obj/item/W)
|
|
if(hand) return put_in_l_hand(W)
|
|
else return put_in_r_hand(W)
|
|
|
|
//Puts the item into our inactive hand if possible. returns 1 on success.
|
|
/mob/proc/put_in_inactive_hand(var/obj/item/W)
|
|
if(hand) return put_in_r_hand(W)
|
|
else return put_in_l_hand(W)
|
|
|
|
//Puts the item our active hand if possible. Failing that it tries our inactive hand. Returns 1 on success.
|
|
//If both fail it drops it on the floor and returns 0.
|
|
//This is probably the main one you need to know :)
|
|
/mob/proc/put_in_hands(var/obj/item/W)
|
|
if(!W) return 0
|
|
if(put_in_active_hand(W))
|
|
update_inv_l_hand()
|
|
update_inv_r_hand()
|
|
return 1
|
|
else if(put_in_inactive_hand(W))
|
|
update_inv_l_hand()
|
|
update_inv_r_hand()
|
|
return 1
|
|
else
|
|
W.loc = get_turf(src)
|
|
W.layer = initial(W.layer)
|
|
W.dropped()
|
|
return 0
|
|
|
|
|
|
|
|
/mob/proc/drop_item_v() //this is dumb.
|
|
if(stat == CONSCIOUS && isturf(loc))
|
|
return drop_item()
|
|
return 0
|
|
|
|
|
|
/mob/proc/drop_from_inventory(var/obj/item/W)
|
|
if(W)
|
|
if(client) client.screen -= W
|
|
u_equip(W)
|
|
W.layer = initial(W.layer)
|
|
W.loc = loc
|
|
|
|
var/turf/T = get_turf(loc)
|
|
if(isturf(T))
|
|
T.Entered(W)
|
|
|
|
W.dropped(src)
|
|
update_icons()
|
|
return 1
|
|
return 0
|
|
|
|
|
|
//Drops the item in our left hand
|
|
/mob/proc/drop_l_hand(var/atom/Target)
|
|
if(l_hand)
|
|
if(client) client.screen -= l_hand
|
|
l_hand.layer = initial(l_hand.layer)
|
|
|
|
if(Target) l_hand.loc = Target.loc
|
|
else l_hand.loc = loc
|
|
|
|
var/turf/T = get_turf(loc)
|
|
if(isturf(T))
|
|
T.Entered(l_hand)
|
|
|
|
l_hand.dropped(src)
|
|
l_hand = null
|
|
update_inv_l_hand()
|
|
return 1
|
|
return 0
|
|
|
|
//Drops the item in our right hand
|
|
/mob/proc/drop_r_hand(var/atom/Target)
|
|
if(r_hand)
|
|
if(client) client.screen -= r_hand
|
|
r_hand.layer = initial(r_hand.layer)
|
|
|
|
if(Target) r_hand.loc = Target.loc
|
|
else r_hand.loc = loc
|
|
|
|
var/turf/T = get_turf(Target)
|
|
if(istype(T))
|
|
T.Entered(r_hand)
|
|
|
|
r_hand.dropped(src)
|
|
r_hand = null
|
|
update_inv_r_hand()
|
|
return 1
|
|
return 0
|
|
|
|
//Drops the item in our active hand.
|
|
/mob/proc/drop_item(var/atom/Target)
|
|
if(hand) return drop_l_hand(Target)
|
|
else return drop_r_hand(Target)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: phase out this proc
|
|
/mob/proc/before_take_item(var/obj/item/W) //TODO: what is this?
|
|
W.loc = null
|
|
W.layer = initial(W.layer)
|
|
u_equip(W)
|
|
update_icons()
|
|
return
|
|
|
|
|
|
/mob/proc/u_equip(W as obj)
|
|
if (W == r_hand)
|
|
r_hand = null
|
|
update_inv_r_hand(0)
|
|
else if (W == l_hand)
|
|
l_hand = null
|
|
update_inv_l_hand(0)
|
|
else if (W == back)
|
|
back = null
|
|
update_inv_back(0)
|
|
else if (W == wear_mask)
|
|
wear_mask = null
|
|
update_inv_wear_mask(0)
|
|
return
|
|
|
|
|
|
//Attemps to remove an object on a mob. Will not move it to another area or such, just removes from the mob.
|
|
/mob/proc/remove_from_mob(var/obj/O)
|
|
src.u_equip(O)
|
|
if (src.client)
|
|
src.client.screen -= O
|
|
O.layer = initial(O.layer)
|
|
O.screen_loc = null
|
|
return 1
|
|
|
|
|
|
//Outdated but still in use apparently. This should at least be a human proc.
|
|
/mob/proc/get_equipped_items()
|
|
var/list/items = new/list()
|
|
|
|
if(hasvar(src,"back")) if(src:back) items += src:back
|
|
if(hasvar(src,"belt")) if(src:belt) items += src:belt
|
|
if(hasvar(src,"ears")) if(src:ears) items += src:ears
|
|
if(hasvar(src,"glasses")) if(src:glasses) items += src:glasses
|
|
if(hasvar(src,"gloves")) if(src:gloves) items += src:gloves
|
|
if(hasvar(src,"head")) if(src:head) items += src:head
|
|
if(hasvar(src,"shoes")) if(src:shoes) items += src:shoes
|
|
if(hasvar(src,"wear_id")) if(src:wear_id) items += src:wear_id
|
|
if(hasvar(src,"wear_mask")) if(src:wear_mask) items += src:wear_mask
|
|
if(hasvar(src,"wear_suit")) if(src:wear_suit) items += src:wear_suit
|
|
// if(hasvar(src,"w_radio")) if(src:w_radio) items += src:w_radio commenting this out since headsets go on your ears now PLEASE DON'T BE MAD KEELIN
|
|
if(hasvar(src,"w_uniform")) if(src:w_uniform) items += src:w_uniform
|
|
|
|
//if(hasvar(src,"l_hand")) if(src:l_hand) items += src:l_hand
|
|
//if(hasvar(src,"r_hand")) if(src:r_hand) items += src:r_hand
|
|
|
|
return items
|
|
|
|
/** BS12's proc to get the item in the active hand. Couldn't find the /tg/ equivalent. **/
|
|
/mob/proc/equipped()
|
|
if(issilicon(src))
|
|
if(isrobot(src))
|
|
if(src:module_active)
|
|
return src:module_active
|
|
else
|
|
if (hand)
|
|
return l_hand
|
|
else
|
|
return r_hand
|
|
return
|
|
|
|
/mob/living/carbon/human/proc/equip_if_possible(obj/item/W, slot, del_on_fail = 1) // since byond doesn't seem to have pointers, this seems like the best way to do this :/
|
|
//warning: icky code
|
|
var/equipped = 0
|
|
switch(slot)
|
|
if(slot_back)
|
|
if(!src.back)
|
|
src.back = W
|
|
equipped = 1
|
|
if(slot_wear_mask)
|
|
if(!src.wear_mask)
|
|
src.wear_mask = W
|
|
equipped = 1
|
|
if(slot_handcuffed)
|
|
if(!src.handcuffed)
|
|
src.handcuffed = W
|
|
equipped = 1
|
|
if(slot_l_hand)
|
|
if(!src.l_hand)
|
|
src.l_hand = W
|
|
equipped = 1
|
|
if(slot_r_hand)
|
|
if(!src.r_hand)
|
|
src.r_hand = W
|
|
equipped = 1
|
|
if(slot_belt)
|
|
if(!src.belt && src.w_uniform)
|
|
src.belt = W
|
|
equipped = 1
|
|
if(slot_wear_id)
|
|
if(!src.wear_id && src.w_uniform)
|
|
src.wear_id = W
|
|
equipped = 1
|
|
if(slot_ears)
|
|
if(!src.ears)
|
|
src.ears = W
|
|
equipped = 1
|
|
if(slot_glasses)
|
|
if(!src.glasses)
|
|
src.glasses = W
|
|
equipped = 1
|
|
if(slot_gloves)
|
|
if(!src.gloves)
|
|
src.gloves = W
|
|
equipped = 1
|
|
if(slot_head)
|
|
if(!src.head)
|
|
src.head = W
|
|
equipped = 1
|
|
if(slot_shoes)
|
|
if(!src.shoes)
|
|
src.shoes = W
|
|
equipped = 1
|
|
if(slot_wear_suit)
|
|
if(!src.wear_suit)
|
|
src.wear_suit = W
|
|
equipped = 1
|
|
if(slot_w_uniform)
|
|
if(!src.w_uniform)
|
|
src.w_uniform = W
|
|
equipped = 1
|
|
if(slot_l_store)
|
|
if(!src.l_store && src.w_uniform)
|
|
src.l_store = W
|
|
equipped = 1
|
|
if(slot_r_store)
|
|
if(!src.r_store && src.w_uniform)
|
|
src.r_store = W
|
|
equipped = 1
|
|
if(slot_s_store)
|
|
if(!src.s_store && src.wear_suit)
|
|
src.s_store = W
|
|
equipped = 1
|
|
if(slot_in_backpack)
|
|
if (src.back && istype(src.back, /obj/item/weapon/storage/backpack))
|
|
var/obj/item/weapon/storage/backpack/B = src.back
|
|
if(B.contents.len < B.storage_slots && W.w_class <= B.max_w_class)
|
|
W.loc = B
|
|
equipped = 1
|
|
|
|
if(equipped)
|
|
W.layer = 20
|
|
if(src.back && W.loc != src.back)
|
|
W.loc = src
|
|
else
|
|
if (del_on_fail)
|
|
del(W)
|
|
return equipped
|
|
|