Files
Aurora.3/code/modules/mob/mob_grab.dm
Cael_Aislinn bdeb96b7e5 Merge branch 'incremental_tg' r5514 (11/1/2013) into bs12_with_tgport
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>
2013-01-11 22:12:31 +10:00

292 lines
9.2 KiB
Plaintext

/obj/item/weapon/grab
name = "grab"
icon = 'icons/mob/screen1.dmi'
icon_state = "grabbed"
var/obj/screen/grab/hud1 = null
var/mob/affecting = null
var/atom/movable/structure = null // if the grab is not grabbing a mob
var/mob/assailant = null
var/state = 1.0
var/killing = 0.0 // 1 = about to kill, 2 = killing
var/kill_loc = null
var/allow_upgrade = 1.0
var/last_suffocate = 1.0
layer = 21
abstract = 1.0
item_state = "nothing"
w_class = 5.0
/obj/item/weapon/grab/proc/throw()
if(affecting)
if(state >= 2)
var/grabee = affecting
spawn(1)
del(src)
return grabee
else
spawn(1)
del(src)
return null
else if(structure)
var/grabee = structure
spawn(1)
del(src)
return grabee
return null
/obj/item/weapon/grab/proc/synch()
if(affecting)
if(affecting.anchored)//This will prevent from grabbing people that are anchored.
del(src)
if (assailant.r_hand == src)
hud1.screen_loc = ui_rhand
else
hud1.screen_loc = ui_lhand
return
/obj/item/weapon/grab/process()
if(!assailant || (!affecting && !structure))
del(src)
return
if(affecting && !structure)
if ((!( isturf(assailant.loc) ) || (!( isturf(affecting.loc) ) || (assailant.loc != affecting.loc && get_dist(assailant, affecting) > 1))))
//SN src = null
del(src)
return
else if(!affecting && structure)
if (!isturf(structure.loc) || !isturf(structure.loc) || (assailant.loc != structure.loc && get_dist(assailant, structure) > 1))
del(src)
return
if (assailant.client)
assailant.client.screen -= hud1
assailant.client.screen += hud1
if (assailant.pulling == affecting || assailant.pulling == structure)
assailant.stop_pulling()
if (structure)
structure.loc = assailant.loc
structure.layer = assailant.layer + 1
if (state <= 2)
allow_upgrade = 1
if ((assailant.l_hand && assailant.l_hand != src && istype(assailant.l_hand, /obj/item/weapon/grab)))
var/obj/item/weapon/grab/G = assailant.l_hand
if (G.affecting != affecting)
allow_upgrade = 0
if ((assailant.r_hand && assailant.r_hand != src && istype(assailant.r_hand, /obj/item/weapon/grab)))
var/obj/item/weapon/grab/G = assailant.r_hand
if (G.affecting != affecting)
allow_upgrade = 0
if (state == 2)
var/h = affecting.hand
affecting.hand = 0
affecting.drop_item()
affecting.hand = 1
affecting.drop_item()
affecting.hand = h
for(var/obj/item/weapon/grab/G in affecting.grabbed_by)
if (G.state == 2)
allow_upgrade = 0
if (allow_upgrade)
hud1.icon_state = "reinforce"
else
hud1.icon_state = "!reinforce"
else
if (!( affecting.buckled ))
affecting.loc = assailant.loc
if ((killing == 2 && state == 3))
if(assailant.loc != kill_loc)
assailant.visible_message("\red [assailant] lost \his tightened grip on [affecting]'s neck!")
killing = 0
hud1.icon_state = "disarm/kill"
return
if(ishuman(affecting))
var/mob/living/carbon/human/H = affecting
var/datum/organ/external/head = H.get_organ("head")
head.add_autopsy_data("Strangulation", 0)
affecting.Weaken(5) // Should keep you down unless you get help.
affecting.Stun(5) // It will hamper your voice, being choked and all.
affecting.losebreath = min(affecting.losebreath + 2, 3)
return
/obj/item/weapon/grab/proc/s_click(obj/screen/S as obj)
if (!affecting)
return
if(killing)
return
if (assailant.next_move > world.time)
return
if ((!( assailant.canmove ) || assailant.lying))
//SN src = null
del(src)
return
switch(S.id)
if(1.0)
if (state >= 3)
if (!( killing ))
assailant.visible_message("\red [assailant] has temporarily tightened \his grip on [affecting]!")
//Foreach goto(97)
assailant.next_move = world.time + 10
//affecting.stunned = max(2, affecting.stunned)
//affecting.paralysis = max(1, affecting.paralysis)
affecting.losebreath = min(affecting.losebreath + 1, 3)
last_suffocate = world.time
flick("disarm/killf", S)
else
return
/obj/item/weapon/grab/proc/s_dbclick(obj/screen/S as obj)
//if ((assailant.next_move > world.time && !( last_suffocate < world.time + 2 )))
// return
if (!affecting)
return
if ((!( assailant.canmove ) || assailant.lying))
del(src)
return
if(killing)
return
switch(S.id)
if(1.0)
if (state < 2)
if (!( allow_upgrade ))
return
assailant.visible_message("\red [assailant] has grabbed [affecting] aggressively (now hands)!")
state = 2
icon_state = "grabbed1"
/*if (prob(75))
for(var/mob/O in viewers(assailant, null))
O.show_message(text("\red [] has grabbed [] aggressively (now hands)!", assailant, affecting), 1)
state = 2
icon_state = "grabbed1"
else
for(var/mob/O in viewers(assailant, null))
O.show_message(text("\red [] has failed to grab [] aggressively!", assailant, affecting), 1)
del(src)
return*/
else
if (state < 3)
if(istype(affecting, /mob/living/carbon/human))
var/mob/living/carbon/human/H = affecting
if(FAT in H.mutations)
assailant << "\blue You can't strangle [affecting] through all that fat!"
return
/*Hrm might want to add this back in
//we should be able to strangle the Captain if he is wearing a hat
for(var/obj/item/clothing/C in list(H.head, H.wear_suit, H.wear_mask, H.w_uniform))
if(C.body_parts_covered & HEAD)
assailant << "\blue You have to take off [affecting]'s [C.name] first!"
return
if(istype(H.wear_suit, /obj/item/clothing/suit/space) || istype(H.wear_suit, /obj/item/clothing/suit/armor) || istype(H.wear_suit, /obj/item/clothing/suit/bio_suit) || istype(H.wear_suit, /obj/item/clothing/suit/swat_suit))
assailant << "\blue You can't strangle [affecting] through their suit collar!"
return
*/
if(istype(affecting, /mob/living/carbon/slime))
assailant << "\blue You squeeze [affecting], but nothing interesting happens."
return
assailant.visible_message("\red [assailant] has reinforced \his grip on [affecting] (now neck)!")
state = 3
icon_state = "grabbed+1"
if (!( affecting.buckled ))
affecting.loc = assailant.loc
affecting.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their neck grabbed by [assailant.name] ([assailant.ckey])</font>")
assailant.attack_log += text("\[[time_stamp()]\] <font color='red'>Grabbed the neck of [affecting.name] ([affecting.ckey])</font>")
log_attack("<font color='red'>[assailant.name] ([assailant.ckey]) grabbed the neck of [affecting.name] ([affecting.ckey])</font>")
hud1.icon_state = "disarm/kill"
hud1.name = "disarm/kill"
else
if (state >= 3 && !killing)
assailant.visible_message("\red [assailant] starts to tighten \his grip on [affecting]'s neck!")
hud1.icon_state = "disarm/kill1"
killing = 1
if(do_after(assailant, 40))
if(killing == 2)
return
if(!affecting)
del(src)
return
if ((!( assailant.canmove ) || assailant.lying))
del(src)
return
killing = 2
kill_loc = assailant.loc
assailant.visible_message("\red [assailant] has tightened \his grip on [affecting]'s neck!")
affecting.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been strangled (kill intent) by [assailant.name] ([assailant.ckey])</font>")
assailant.attack_log += text("\[[time_stamp()]\] <font color='red'>Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>")
log_attack("<font color='red'>[assailant.name] ([assailant.ckey]) Strangled (kill intent) [affecting.name] ([affecting.ckey])</font>")
assailant.next_move = world.time + 10
affecting.losebreath += 1
else
assailant.visible_message("\red [assailant] was unable to tighten \his grip on [affecting]'s neck!")
killing = 0
hud1.icon_state = "disarm/kill"
return
/obj/item/weapon/grab/New(var/location, mob/user as mob, mob/affected as mob)
..()
src.loc = location
src.assailant = user
src.affecting = affected
// HUD
hud1 = new /obj/screen/grab( src )
hud1.icon_state = "reinforce"
hud1.name = "Reinforce Grab"
hud1.id = 1
hud1.master = src
return
/obj/item/weapon/grab/attack(mob/M as mob, mob/user as mob)
if(!affecting) return
if (M == affecting)
if (state < 3)
s_dbclick(hud1)
else
s_click(hud1)
return
if(M == assailant && state >= 2)
if( ( ishuman(user) && (FAT in user.mutations) && ismonkey(affecting) ) || ( isalien(user) && iscarbon(affecting) ) )
var/mob/living/carbon/attacker = user
user.visible_message("\red <B>[user] is attempting to devour [affecting]!</B>")
if(istype(user, /mob/living/carbon/alien/humanoid/hunter))
if(!do_mob(user, affecting)||!do_after(user, 30)) return
else
if(!do_mob(user, affecting)||!do_after(user, 100)) return
user.visible_message("\red <B>[user] devours [affecting]!</B>")
affecting.loc = user
attacker.stomach_contents.Add(affecting)
del(src)
/obj/item/weapon/grab/dropped()
del(src)
return
/obj/item/weapon/grab/Del()
del(hud1)
..()
return