Skip to content

Commit

Permalink
Merge pull request tgstation#25682 from GunHog/Of_Mecha_And_Fixes
Browse files Browse the repository at this point in the history
Mech fixes
  • Loading branch information
duncathan authored Apr 2, 2017
2 parents 4d12c5c + 7fc5754 commit ef017c0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions code/game/mecha/equipment/tools/mining_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
var/scanning = 0

/obj/item/mecha_parts/mecha_equipment/mining_scanner/New()
..()
START_PROCESSING(SSobj, src)

/obj/item/mecha_parts/mecha_equipment/mining_scanner/attach(obj/mecha/M)
Expand Down
15 changes: 11 additions & 4 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,11 @@
AI.ai_restore_power()//So the AI initially has power.
AI.control_disabled = 1
AI.radio_enabled = 0
AI.disconnect_shell()
RemoveActions(AI, TRUE)
occupant = null
AI.forceMove(card)
card.AI = AI
occupant = null
AI.controlled_mech = null
AI.remote_control = null
icon_state = initial(icon_state)+"-open"
Expand All @@ -686,10 +688,12 @@
if(!AI)
to_chat(user, "<span class='warning'>There is no AI currently installed on this device.</span>")
return
else if(AI.stat || !AI.client)
if(AI.deployed_shell) //Recall AI if shelled so it can be checked for a client
AI.disconnect_shell()
if(AI.stat || !AI.client)
to_chat(user, "<span class='warning'>[AI.name] is currently unresponsive, and cannot be uploaded.</span>")
return
else if(occupant || dna_lock) //Normal AIs cannot steal mechs!
if(occupant || dna_lock) //Normal AIs cannot steal mechs!
to_chat(user, "<span class='warning'>Access denied. [name] is [occupant ? "currently occupied" : "secured with a DNA lock"].")
return
AI.control_disabled = 0
Expand All @@ -715,7 +719,10 @@
to_chat(AI, "[AI.can_dominate_mechs ? "<span class='announce'>Takeover of [name] complete! You are now loaded onto the onboard computer. Do not attempt to leave the station sector!</span>" \
: "<span class='notice'>You have been uploaded to a mech's onboard computer."]")
to_chat(AI, "<span class='reallybig boldnotice'>Use Middle-Mouse to activate mech functions and equipment. Click normally for AI interactions.</span>")
GrantActions(AI, !AI.can_dominate_mechs)
if(interaction == AI_TRANS_FROM_CARD)
GrantActions(AI, FALSE) //No eject/return to core action for AI uploaded by card
else
GrantActions(AI, !AI.can_dominate_mechs)


//An actual AI (simple_animal mecha pilot) entering the mech
Expand Down
3 changes: 2 additions & 1 deletion code/game/mecha/mecha_actions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
var/obj/mecha/chassis

/datum/action/innate/mecha/Grant(mob/living/L, obj/mecha/M)
chassis = M
if(M)
chassis = M
..()

/datum/action/innate/mecha/Destroy()
Expand Down
14 changes: 7 additions & 7 deletions code/game/mecha/mecha_control_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@
return 0
var/obj/mecha/M = src.loc
var/cell_charge = M.get_charge()
var/answer = {"<b>Name:</b> [M.name]<br>
<b>Integrity:</b> [M.obj_integrity/M.max_integrity*100]%<br>
<b>Cell charge:</b> [isnull(cell_charge)?"Not found":"[M.cell.percent()]%"]<br>
<b>Airtank:</b> [M.return_pressure()]kPa<br>
<b>Pilot:</b> [M.occupant||"None"]<br>
<b>Location:</b> [get_area(M)||"Unknown"]<br>
<b>Active equipment:</b> [M.selected||"None"]<br>"}
var/answer = {"<b>Name:</b> [M.name]
<b>Integrity:</b> [M.obj_integrity/M.max_integrity*100]%
<b>Cell charge:</b> [isnull(cell_charge)?"Not found":"[M.cell.percent()]%"]
<b>Airtank:</b> [M.return_pressure()]kPa
<b>Pilot:</b> [M.occupant||"None"]
<b>Location:</b> [get_area(M)||"Unknown"]
<b>Active equipment:</b> [M.selected||"None"] "}
if(istype(M, /obj/mecha/working/ripley))
var/obj/mecha/working/ripley/RM = M
answer += "<b>Used cargo space:</b> [RM.cargo.len/RM.cargo_capacity*100]%<br>"
Expand Down

0 comments on commit ef017c0

Please sign in to comment.