From 04ad06eca0de54a2252d683a3dd0b971d7ab7379 Mon Sep 17 00:00:00 2001 From: Miauw Date: Sat, 10 Jan 2015 15:39:03 +0100 Subject: [PATCH 1/3] Fixed #126. MMIs and pAIs can now be teleported properly. Revamped the AI get/jump procs to use admin_forcemove(), which makes sure that mobs are moved by setting various vars and then calling Move(). --- code/modules/admin/admin_verbs.dm | 2 +- code/modules/admin/verbs/adminjump.dm | 43 ++++++++++++++----- code/modules/mob/living/carbon/brain/brain.dm | 11 +++++ code/modules/mob/living/silicon/pai/pai.dm | 8 ++++ 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index c3d664ab1d4..dcaab15c107 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -49,7 +49,7 @@ var/list/admin_verbs_admin = list( /client/proc/Getmob, /*teleports a mob to our location*/ /client/proc/Getkey, /*teleports a mob with a certain ckey to our location*/ // /client/proc/sendmob, /*sends a mob somewhere*/ -Removed due to it needing two sorting procs to work, which were executed every time an admin right-clicked. ~Errorage - /client/proc/Jump, + /client/proc/jumptoarea, /client/proc/jumptokey, /*allows us to jump to the location of a mob with a certain ckey*/ /client/proc/jumptomob, /*allows us to jump to a specific mob*/ /client/proc/jumptoturf, /*allows us to jump to a specific turf*/ diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 0d16a4ed108..3160cdc784f 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -1,11 +1,11 @@ -/client/proc/Jump(area/A in sortedAreas) +/client/proc/jumptoarea(area/A in sortedAreas) set name = "Jump to Area" set desc = "Area to jump to" set category = "Admin" if(!src.holder) src << "Only administrators may use this command." return - + if(!A) return @@ -19,8 +19,8 @@ var/turf/T = pick_n_take(turfs) if(!T) src << "Nowhere to jump to!" - return - usr.loc = T + return + admin_forcemove(usr, T) log_admin("[key_name(usr)] jumped to [A]") message_admins("[key_name_admin(usr)] jumped to [A]") feedback_add_details("admin_verb","JA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -53,7 +53,7 @@ var/turf/T = get_turf(M) if(T && isturf(T)) feedback_add_details("admin_verb","JM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - A.loc = T + admin_forcemove(A, M.loc) else A << "This mob is not located in the game world." @@ -91,7 +91,9 @@ var/mob/M = selection:mob log_admin("[key_name(usr)] jumped to [key_name(M)]") message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]") - usr.loc = M.loc + + admin_forcemove(usr, M.loc) + feedback_add_details("admin_verb","JK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/Getmob(var/mob/M in mob_list) @@ -104,7 +106,7 @@ log_admin("[key_name(usr)] teleported [key_name(M)]") message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)]") - M.loc = get_turf(usr) + admin_forcemove(M, get_turf(usr)) feedback_add_details("admin_verb","GM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/Getkey() @@ -129,7 +131,8 @@ log_admin("[key_name(usr)] teleported [key_name(M)]") message_admins("[key_name_admin(usr)] teleported [key_name(M)]") if(M) - M.loc = get_turf(usr) + admin_forcemove(M, get_turf(usr)) + usr.loc = M.loc feedback_add_details("admin_verb","GK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/sendmob(var/mob/M in sortmobs()) @@ -140,8 +143,26 @@ return var/area/A = input(usr, "Pick an area.", "Pick an area") in sortedAreas if(A) - M.loc = pick(get_area_turfs(A)) + admin_forcemove(pick(get_area_turfs(A))) feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - log_admin("[key_name(usr)] teleported [key_name(M)] to [A]") - message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)] to [A]") \ No newline at end of file + message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)] to [A]") + +/proc/admin_forcemove(var/mob/mover, var/atom/newloc) + var/startdensity = mover.density + var/startflags = mover.pass_flags + var/startincorporeal = 0 + if(istype(mover, /mob/living)) + world << "incorporeal" + var/mob/living/L = mover + startincorporeal = L.incorporeal_move + L.incorporeal_move = 1 + mover.density = 0 + mover.pass_flags = ALL + newloc.density = 0 + . = mover.Move(newloc) + mover.density = startdensity + mover.pass_flags = startflags + if(istype(mover, /mob/living)) + var/mob/living/L = mover + L.incorporeal_move = startincorporeal diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 68370fa1c11..e70ea378428 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -28,3 +28,14 @@ /mob/living/carbon/brain/ex_act() //you cant blow up brainmobs because it makes transfer_to() freak out when borgs blow up. return + +/mob/living/carbon/brain/Move(var/atom/newloc) + if(container) + container.Move(newloc) + else //something went very wrong. + CRASH("Brainmob without container") + . = ..() + loc = container + +/mob/living/carbon/brain/UnarmedAttack(var/atom/A)//Stops runtimes due to attack_animal being the default + return diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index f96b7223b00..ac5153b71ae 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -178,6 +178,14 @@ /mob/living/silicon/pai/UnarmedAttack(var/atom/A)//Stops runtimes due to attack_animal being the default return +/mob/living/silicon/pai/Move(var/atom/newloc) + if(card) + card.Move(newloc) + else //something went very wrong. + CRASH("pAI without card") + . = ..() + loc = card + //Addition by Mord_Sith to define AI's network change ability /* /mob/living/silicon/pai/proc/pai_network_change() From e1d3799f9dd9344f700639272f7ac47b65027941 Mon Sep 17 00:00:00 2001 From: Miauw Date: Sat, 10 Jan 2015 15:39:40 +0100 Subject: [PATCH 2/3] Removes a debug message. --- code/modules/admin/verbs/adminjump.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 3160cdc784f..4d224126f67 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -153,7 +153,6 @@ var/startflags = mover.pass_flags var/startincorporeal = 0 if(istype(mover, /mob/living)) - world << "incorporeal" var/mob/living/L = mover startincorporeal = L.incorporeal_move L.incorporeal_move = 1 From b6b17e214f73db69bc389cd50dc9f52295d7dd61 Mon Sep 17 00:00:00 2001 From: Miauw Date: Tue, 27 Jan 2015 17:47:34 +0100 Subject: [PATCH 3/3] After-merge cleanup. --- code/modules/admin/verbs/adminjump.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 4d224126f67..8ec36f3d008 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -1,4 +1,4 @@ -/client/proc/jumptoarea(area/A in sortedAreas) +/client/proc/jumptoarea(area/A in sortedAreas) set name = "Jump to Area" set desc = "Area to jump to" set category = "Admin" @@ -143,7 +143,7 @@ return var/area/A = input(usr, "Pick an area.", "Pick an area") in sortedAreas if(A) - admin_forcemove(pick(get_area_turfs(A))) + admin_forcemove(M, pick(get_area_turfs(A))) feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(usr)] teleported [key_name(M)] to [A]") message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)] to [A]")