mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fixes Brain-Mechs, and a tangentially related MMI runtime.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
if(!melee_can_hit || !istype(target, /atom)) return
|
||||
if(istype(target, /mob/living))
|
||||
var/mob/living/M = target
|
||||
if(src.occupant.a_intent == I_HURT)
|
||||
if(src.occupant.a_intent == I_HURT || istype(src.occupant, /mob/living/carbon/brain)) //Brains cannot change intents; Exo-piloting brains lack any form of physical feedback for control, limiting the ability to 'play nice'.
|
||||
playsound(src, 'sound/weapons/punch4.ogg', 50, 1)
|
||||
if(damtype == "brute")
|
||||
step_away(M,src,15)
|
||||
@@ -244,6 +244,14 @@
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/mecha/combat/mmi_moved_inside(var/obj/item/device/mmi/mmi_as_oc as obj,mob/user as mob)
|
||||
if(..())
|
||||
if(occupant.client)
|
||||
occupant.client.mouse_pointer_icon = file("icons/mecha/mecha_mouse.dmi")
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/mecha/combat/go_out()
|
||||
if(src.occupant && src.occupant.client)
|
||||
src.occupant.client.mouse_pointer_icon = initial(src.occupant.client.mouse_pointer_icon)
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
else if(istype(target,/mob/living))
|
||||
var/mob/living/M = target
|
||||
if(M.stat>1) return
|
||||
if(chassis.occupant.a_intent == I_HURT)
|
||||
if(chassis.occupant.a_intent == I_HURT || istype(chassis.occupant,/mob/living/carbon/brain)) //No tactile feedback for brains
|
||||
M.take_overall_damage(dam_force)
|
||||
M.adjustOxyLoss(round(dam_force/2))
|
||||
M.updatehealth()
|
||||
|
||||
@@ -344,8 +344,11 @@
|
||||
|
||||
/obj/mecha/relaymove(mob/user,direction)
|
||||
if(user != src.occupant) //While not "realistic", this piece is player friendly.
|
||||
if(istype(user,/mob/living/carbon/brain))
|
||||
to_chat(user,"You try to move, but you are not the pilot! The exosuit doesn't respond.")
|
||||
return 0
|
||||
user.forceMove(get_turf(src))
|
||||
user << "You climb out from [src]"
|
||||
to_chat(user,"You climb out from [src]")
|
||||
return 0
|
||||
if(connected_port)
|
||||
if(world.time - last_message > 20)
|
||||
@@ -686,6 +689,13 @@
|
||||
|
||||
/obj/mecha/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
if(istype(W, /obj/item/device/mmi))
|
||||
if(mmi_move_inside(W,user))
|
||||
to_chat(user,"[src]-MMI interface initialized successfuly")
|
||||
else
|
||||
to_chat(user,"[src]-MMI interface initialization failed.")
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/mecha_parts/mecha_equipment))
|
||||
var/obj/item/mecha_parts/mecha_equipment/E = W
|
||||
spawn()
|
||||
@@ -829,6 +839,70 @@
|
||||
return
|
||||
*/
|
||||
|
||||
///////////////////////////////
|
||||
//////// Brain Stuff ////////
|
||||
///////////////////////////////
|
||||
|
||||
/obj/mecha/proc/mmi_move_inside(var/obj/item/device/mmi/mmi_as_oc as obj,mob/user as mob)
|
||||
if(!mmi_as_oc.brainmob || !mmi_as_oc.brainmob.client)
|
||||
to_chat(user,"Consciousness matrix not detected.")
|
||||
return 0
|
||||
else if(mmi_as_oc.brainmob.stat)
|
||||
to_chat(user,"Brain activity below acceptable level.")
|
||||
return 0
|
||||
else if(occupant)
|
||||
to_chat(user,"Occupant detected.")
|
||||
return 0
|
||||
else if(dna && dna!=mmi_as_oc.brainmob.dna.unique_enzymes)
|
||||
to_chat(user,"Genetic sequence or serial number incompatible with locking mechanism.")
|
||||
return 0
|
||||
//Added a message here since people assume their first click failed or something./N
|
||||
// user << "Installing MMI, please stand by."
|
||||
|
||||
visible_message("<span class='notice'>[usr] starts to insert a brain into [src.name]</span>")
|
||||
|
||||
if(enter_after(40,user))
|
||||
if(!occupant)
|
||||
return mmi_moved_inside(mmi_as_oc,user)
|
||||
else
|
||||
to_chat(user,"Occupant detected.")
|
||||
else
|
||||
to_chat(user,"You stop attempting to install the brain.")
|
||||
return 0
|
||||
|
||||
/obj/mecha/proc/mmi_moved_inside(var/obj/item/device/mmi/mmi_as_oc as obj,mob/user as mob)
|
||||
if(mmi_as_oc && user in range(1))
|
||||
if(!mmi_as_oc.brainmob || !mmi_as_oc.brainmob.client)
|
||||
user << "Consciousness matrix not detected."
|
||||
return 0
|
||||
else if(mmi_as_oc.brainmob.stat)
|
||||
user << "Beta-rhythm below acceptable level."
|
||||
return 0
|
||||
user.drop_from_inventory(mmi_as_oc)
|
||||
var/mob/brainmob = mmi_as_oc.brainmob
|
||||
brainmob.reset_view(src)
|
||||
/*
|
||||
brainmob.client.eye = src
|
||||
brainmob.client.perspective = EYE_PERSPECTIVE
|
||||
*/
|
||||
occupant = brainmob
|
||||
brainmob.loc = src //should allow relaymove
|
||||
brainmob.canmove = 1
|
||||
mmi_as_oc.loc = src
|
||||
mmi_as_oc.mecha = src
|
||||
src.verbs += /obj/mecha/verb/eject
|
||||
src.Entered(mmi_as_oc)
|
||||
src.Move(src.loc)
|
||||
src.icon_state = src.reset_icon()
|
||||
set_dir(dir_in)
|
||||
src.log_message("[mmi_as_oc] moved in as pilot.")
|
||||
if(!hasInternalDamage())
|
||||
src.occupant << sound('sound/mecha/nominal.ogg',volume=50)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
//////// Atmospheric stuff ////////
|
||||
/////////////////////////////////////
|
||||
@@ -1044,6 +1118,7 @@
|
||||
src.occupant = H
|
||||
src.add_fingerprint(H)
|
||||
src.forceMove(src.loc)
|
||||
src.verbs += /obj/mecha/verb/eject
|
||||
src.log_append_to_last("[H] moved in as pilot.")
|
||||
src.icon_state = src.reset_icon()
|
||||
set_dir(dir_in)
|
||||
@@ -1132,10 +1207,10 @@
|
||||
occupant.loc = mmi
|
||||
mmi.mecha = null
|
||||
src.occupant.canmove = 0
|
||||
src.verbs += /obj/mecha/verb/eject
|
||||
src.occupant = null
|
||||
src.icon_state = src.reset_icon()+"-open"
|
||||
src.set_dir(dir_in)
|
||||
src.verbs -= /obj/mecha/verb/eject
|
||||
return
|
||||
|
||||
/////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user