mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Fix robot storage units dropping security borgs' taser/laser on storage, slight refactor.
This commit is contained in:
@@ -277,113 +277,125 @@
|
|||||||
if(!find_control_computer(urgent=1))
|
if(!find_control_computer(urgent=1))
|
||||||
return
|
return
|
||||||
|
|
||||||
//Drop all items into the pod.
|
despawn_occupant()
|
||||||
for(var/obj/item/W in occupant)
|
|
||||||
if(istype(W, /obj/item/device/mmi))
|
|
||||||
if(istype(occupant, /mob/living/silicon/robot))
|
|
||||||
var/mob/living/silicon/robot/R = occupant
|
|
||||||
if(R.mmi == W)
|
|
||||||
del(W)
|
|
||||||
continue
|
|
||||||
occupant.drop_from_inventory(W)
|
|
||||||
W.loc = src
|
|
||||||
|
|
||||||
if(W.contents.len) //Make sure we catch anything not handled by del() on the items.
|
// This function can not be undone; do not call this unless you are sure
|
||||||
for(var/obj/item/O in W.contents)
|
// Also make sure there is a valid control computer
|
||||||
if(istype(O,/obj/item/weapon/storage/internal)) //Stop eating pockets, you fuck!
|
/obj/machinery/cryopod/robot/despawn_occupant()
|
||||||
continue
|
var/mob/living/silicon/robot/R = occupant
|
||||||
O.loc = src
|
if(!istype(R)) return ..()
|
||||||
|
|
||||||
//Delete all items not on the preservation list.
|
del(R.mmi)
|
||||||
var/list/items = src.contents
|
for(var/obj/item/I in R.module) // the tools the borg has; metal, glass, guns etc
|
||||||
items -= occupant // Don't delete the occupant
|
for(var/obj/item/O in I) // the things inside the tools, if anything; mainly for janiborg trash bags
|
||||||
items -= announce // or the autosay radio.
|
O.loc = R
|
||||||
|
del(I)
|
||||||
|
del(R.module)
|
||||||
|
|
||||||
for(var/obj/item/W in items)
|
return ..()
|
||||||
|
|
||||||
var/preserve = null
|
// This function can not be undone; do not call this unless you are sure
|
||||||
for(var/T in preserve_items)
|
// Also make sure there is a valid control computer
|
||||||
if(istype(W,T))
|
/obj/machinery/cryopod/proc/despawn_occupant()
|
||||||
preserve = 1
|
//Drop all items into the pod.
|
||||||
break
|
for(var/obj/item/W in occupant)
|
||||||
|
occupant.drop_from_inventory(W)
|
||||||
|
W.loc = src
|
||||||
|
|
||||||
if(!preserve)
|
if(W.contents.len) //Make sure we catch anything not handled by del() on the items.
|
||||||
del(W)
|
for(var/obj/item/O in W.contents)
|
||||||
else
|
if(istype(O,/obj/item/weapon/storage/internal)) //Stop eating pockets, you fuck!
|
||||||
if(control_computer && control_computer.allow_items)
|
continue
|
||||||
control_computer.frozen_items += W
|
O.loc = src
|
||||||
W.loc = null
|
|
||||||
else
|
|
||||||
W.loc = src.loc
|
|
||||||
|
|
||||||
//Update any existing objectives involving this mob.
|
//Delete all items not on the preservation list.
|
||||||
for(var/datum/objective/O in all_objectives)
|
var/list/items = src.contents
|
||||||
// We don't want revs to get objectives that aren't for heads of staff. Letting
|
items -= occupant // Don't delete the occupant
|
||||||
// them win or lose based on cryo is silly so we remove the objective.
|
items -= announce // or the autosay radio.
|
||||||
if(istype(O,/datum/objective/mutiny) && O.target == occupant.mind)
|
|
||||||
del(O)
|
|
||||||
else if(O.target && istype(O.target,/datum/mind))
|
|
||||||
if(O.target == occupant.mind)
|
|
||||||
if(O.owner && O.owner.current)
|
|
||||||
O.owner.current << "\red You get the feeling your target is no longer within your reach. Time for Plan [pick(list("A","B","C","D","X","Y","Z"))]..."
|
|
||||||
O.target = null
|
|
||||||
spawn(1) //This should ideally fire after the occupant is deleted.
|
|
||||||
if(!O) return
|
|
||||||
O.find_target()
|
|
||||||
if(!(O.target))
|
|
||||||
all_objectives -= O
|
|
||||||
O.owner.objectives -= O
|
|
||||||
del(O)
|
|
||||||
|
|
||||||
//Handle job slot/tater cleanup.
|
for(var/obj/item/W in items)
|
||||||
var/job = occupant.mind.assigned_role
|
|
||||||
|
|
||||||
job_master.FreeRole(job)
|
var/preserve = null
|
||||||
|
for(var/T in preserve_items)
|
||||||
|
if(istype(W,T))
|
||||||
|
preserve = 1
|
||||||
|
break
|
||||||
|
|
||||||
if(occupant.mind.objectives.len)
|
if(!preserve)
|
||||||
del(occupant.mind.objectives)
|
del(W)
|
||||||
occupant.mind.special_role = null
|
else
|
||||||
|
if(control_computer && control_computer.allow_items)
|
||||||
|
control_computer.frozen_items += W
|
||||||
|
W.loc = null
|
||||||
else
|
else
|
||||||
if(ticker.mode.name == "AutoTraitor")
|
W.loc = src.loc
|
||||||
var/datum/game_mode/traitor/autotraitor/current_mode = ticker.mode
|
|
||||||
current_mode.possible_traitors.Remove(occupant)
|
|
||||||
|
|
||||||
// Delete them from datacore.
|
//Update any existing objectives involving this mob.
|
||||||
|
for(var/datum/objective/O in all_objectives)
|
||||||
|
// We don't want revs to get objectives that aren't for heads of staff. Letting
|
||||||
|
// them win or lose based on cryo is silly so we remove the objective.
|
||||||
|
if(istype(O,/datum/objective/mutiny) && O.target == occupant.mind)
|
||||||
|
del(O)
|
||||||
|
else if(O.target && istype(O.target,/datum/mind))
|
||||||
|
if(O.target == occupant.mind)
|
||||||
|
if(O.owner && O.owner.current)
|
||||||
|
O.owner.current << "\red You get the feeling your target is no longer within your reach. Time for Plan [pick(list("A","B","C","D","X","Y","Z"))]..."
|
||||||
|
O.target = null
|
||||||
|
spawn(1) //This should ideally fire after the occupant is deleted.
|
||||||
|
if(!O) return
|
||||||
|
O.find_target()
|
||||||
|
if(!(O.target))
|
||||||
|
all_objectives -= O
|
||||||
|
O.owner.objectives -= O
|
||||||
|
del(O)
|
||||||
|
|
||||||
if(PDA_Manifest.len)
|
//Handle job slot/tater cleanup.
|
||||||
PDA_Manifest.Cut()
|
var/job = occupant.mind.assigned_role
|
||||||
for(var/datum/data/record/R in data_core.medical)
|
|
||||||
if ((R.fields["name"] == occupant.real_name))
|
|
||||||
del(R)
|
|
||||||
for(var/datum/data/record/T in data_core.security)
|
|
||||||
if ((T.fields["name"] == occupant.real_name))
|
|
||||||
del(T)
|
|
||||||
for(var/datum/data/record/G in data_core.general)
|
|
||||||
if ((G.fields["name"] == occupant.real_name))
|
|
||||||
del(G)
|
|
||||||
|
|
||||||
if(orient_right)
|
job_master.FreeRole(job)
|
||||||
icon_state = "[base_icon_state]-r"
|
|
||||||
else
|
|
||||||
icon_state = base_icon_state
|
|
||||||
|
|
||||||
//TODO: Check objectives/mode, update new targets if this mob is the target, spawn new antags?
|
if(occupant.mind.objectives.len)
|
||||||
|
del(occupant.mind.objectives)
|
||||||
|
occupant.mind.special_role = null
|
||||||
|
else
|
||||||
|
if(ticker.mode.name == "AutoTraitor")
|
||||||
|
var/datum/game_mode/traitor/autotraitor/current_mode = ticker.mode
|
||||||
|
current_mode.possible_traitors.Remove(occupant)
|
||||||
|
|
||||||
//This should guarantee that ghosts don't spawn.
|
// Delete them from datacore.
|
||||||
occupant.ckey = null
|
|
||||||
|
|
||||||
//Make an announcement and log the person entering storage.
|
if(PDA_Manifest.len)
|
||||||
control_computer.frozen_crew += "[occupant.real_name]"
|
PDA_Manifest.Cut()
|
||||||
|
for(var/datum/data/record/R in data_core.medical)
|
||||||
|
if ((R.fields["name"] == occupant.real_name))
|
||||||
|
del(R)
|
||||||
|
for(var/datum/data/record/T in data_core.security)
|
||||||
|
if ((T.fields["name"] == occupant.real_name))
|
||||||
|
del(T)
|
||||||
|
for(var/datum/data/record/G in data_core.general)
|
||||||
|
if ((G.fields["name"] == occupant.real_name))
|
||||||
|
del(G)
|
||||||
|
|
||||||
announce.autosay("[occupant.real_name] [on_store_message]", "[on_store_name]")
|
if(orient_right)
|
||||||
visible_message("\blue \The [src] hums and hisses as it moves [occupant.real_name] into storage.", 3)
|
icon_state = "[base_icon_state]-r"
|
||||||
|
else
|
||||||
|
icon_state = base_icon_state
|
||||||
|
|
||||||
// Delete the mob.
|
//TODO: Check objectives/mode, update new targets if this mob is the target, spawn new antags?
|
||||||
del(occupant)
|
|
||||||
occupant = null
|
|
||||||
name = initial(name)
|
|
||||||
|
|
||||||
return
|
//This should guarantee that ghosts don't spawn.
|
||||||
|
occupant.ckey = null
|
||||||
|
|
||||||
|
//Make an announcement and log the person entering storage.
|
||||||
|
control_computer.frozen_crew += "[occupant.real_name]"
|
||||||
|
|
||||||
|
announce.autosay("[occupant.real_name] [on_store_message]", "[on_store_name]")
|
||||||
|
visible_message("\blue \The [src] hums and hisses as it moves [occupant.real_name] into storage.", 3)
|
||||||
|
|
||||||
|
// Delete the mob.
|
||||||
|
del(occupant)
|
||||||
|
occupant = null
|
||||||
|
name = initial(name)
|
||||||
|
|
||||||
|
|
||||||
/obj/machinery/cryopod/attackby(var/obj/item/weapon/G as obj, var/mob/user as mob)
|
/obj/machinery/cryopod/attackby(var/obj/item/weapon/G as obj, var/mob/user as mob)
|
||||||
|
|||||||
@@ -428,9 +428,9 @@
|
|||||||
|
|
||||||
//checks whether this item is a module of the robot it is located in.
|
//checks whether this item is a module of the robot it is located in.
|
||||||
/obj/item/proc/is_robot_module()
|
/obj/item/proc/is_robot_module()
|
||||||
if (!istype(src.loc, /mob/living/silicon/robot))
|
if (!istype(src.loc.loc, /mob/living/silicon/robot))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/mob/living/silicon/robot/R = src.loc
|
var/mob/living/silicon/robot/R = src.loc.loc
|
||||||
|
|
||||||
return (src in R.module.modules)
|
return (src in R.module.modules)
|
||||||
|
|||||||
Reference in New Issue
Block a user