Merge pull request #3988 from Mechoid/Mecha_2_The_Mechening_V_1

Brain-Mech fix, MMI Runtime fix, Mecha Wall Punching Fix
This commit is contained in:
Anewbe
2017-09-30 21:44:59 -05:00
committed by GitHub
5 changed files with 102 additions and 7 deletions
+16 -3
View File
@@ -2,7 +2,7 @@
force = 30
var/melee_cooldown = 10
var/melee_can_hit = 1
var/list/destroyable_obj = list(/obj/mecha, /obj/structure/window, /obj/structure/grille, /turf/simulated/wall)
var/list/destroyable_obj = list(/obj/mecha, /obj/structure/window, /obj/structure/grille, /turf/simulated/wall, /obj/structure/girder)
internal_damage_threshold = 50
maint_access = 0
//add_req_access = 0
@@ -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)
@@ -95,14 +95,19 @@
if(istype(target, target_type) && hascall(target, "attackby"))
src.occupant_message("You hit [target].")
src.visible_message("<font color='red'><b>[src.name] hits [target]</b></font>")
if(!istype(target, /turf/simulated/wall))
if(!istype(target, /turf/simulated/wall) && !istype(target, /obj/structure/girder))
target:attackby(src,src.occupant)
else if(prob(5))
target:dismantle_wall(1)
src.occupant_message("<span class='notice'>You smash through the wall.</span>")
src.visible_message("<b>[src.name] smashes through the wall</b>")
playsound(src, 'sound/weapons/smash.ogg', 50, 1)
else if(istype(target, /turf/simulated/wall))
target:take_damage(force)
else if(istype(target, /obj/structure/girder))
target:take_damage(force * 3) //Girders have 200 health by default. Steel, non-reinforced walls take four punches, girders take (with this value-mod) two, girders took five without.
melee_can_hit = 0
if(do_after(melee_cooldown))
melee_can_hit = 1
break
@@ -244,6 +249,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)
+1 -1
View File
@@ -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()
+77 -2
View File
@@ -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)
to_chat(user,"Consciousness matrix not detected.")
return 0
else if(mmi_as_oc.brainmob.stat)
to_chat(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
/////////////////////////
+6
View File
@@ -125,6 +125,12 @@
else
return ..()
/obj/structure/girder/proc/take_damage(var/damage)
health -= damage
if(health <= 0)
dismantle()
/obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user)
var/amount_to_use = reinf_material ? 1 : 2
if(S.get_amount() < amount_to_use)
+2 -1
View File
@@ -128,7 +128,8 @@
return
var/obj/item/weapon/rig/rig = src.get_rig()
if(rig)
rig.forced_move(direction, user)
if(istype(rig,/obj/item/weapon/rig))
rig.forced_move(direction, user)
/obj/item/device/mmi/Destroy()
if(isrobot(loc))