Porting flying robots from Bay. [IDB IGNORE] (#8885)

* Semiport of Allow_Spacemove from Bay.

* Porting flying robots from Bay.

* Converting platforms to an alt title of Robot.

* Converting existing modules to new proc flow.

* Cleaning up jetpack code for robots.

* Making flyers and platforms buildable.

* Debugging/refining robots port.

* Reverting some unneeded spacemove changes.

* Refining/debugging bots.

* Removing Bay subtypes, adding flying subtypes of existing modules.

* Icon rework for flying robots.

* Working commit for flying borgs PR.
This commit is contained in:
MistakeNot4892
2023-07-31 22:22:12 -08:00
committed by GitHub
parent 0941bbacae
commit 658e19e734
75 changed files with 2004 additions and 1621 deletions
@@ -0,0 +1,194 @@
/obj/item/robot_parts/frame
name = "standard robot frame"
desc = "A complex metal backbone with standard limb sockets and pseudomuscle anchors."
icon_state = "robo_suit"
var/list/parts = list()
var/list/required_parts = list(
BP_L_ARM = /obj/item/robot_parts/l_arm,
BP_R_ARM = /obj/item/robot_parts/r_arm,
BP_TORSO = /obj/item/robot_parts/chest,
BP_L_LEG = /obj/item/robot_parts/l_leg,
BP_R_LEG = /obj/item/robot_parts/r_leg,
BP_HEAD = /obj/item/robot_parts/head
)
var/created_name = ""
var/product = /mob/living/silicon/robot
/obj/item/robot_parts/frame/examine(mob/user)
. = ..()
if(check_completion())
. += SPAN_NOTICE("It is ready to receive a controlling intelligence.")
else
for(var/part in required_parts)
if(!parts[part])
var/obj/item/part_type = part
. += SPAN_WARNING("It is missing \a [initial(part_type.name)]")
/obj/item/robot_parts/frame/update_model_info(var/model)
return FALSE
/obj/item/robot_parts/frame/Initialize()
. = ..()
update_icon()
/obj/item/robot_parts/frame/update_icon()
cut_overlays()
for(var/part in required_parts)
if(parts[part])
add_overlay("[part]+o")
/obj/item/robot_parts/frame/proc/check_completion()
for(var/part in required_parts)
if(!parts[part])
return FALSE
return TRUE
/obj/item/robot_parts/frame/attackby(obj/item/W, mob/user)
// Uninstall a robotic part.
if(W.is_crowbar())
if(!parts.len)
to_chat(user, SPAN_WARNING("\The [src] has no parts to remove."))
return
var/removing = pick(parts)
var/obj/item/robot_parts/part = parts[removing]
part.forceMove(get_turf(src))
user.put_in_hands(part)
parts -= removing
to_chat(user, SPAN_WARNING("You lever \the [part] off \the [src]."))
update_icon()
// Install a robotic part.
else if (istype(W, /obj/item/robot_parts))
var/obj/item/robot_parts/part = W
if(!required_parts[part.bp_tag] || !istype(W, required_parts[part.bp_tag]))
to_chat(user, SPAN_WARNING("\The [src] is not compatible with \the [W]."))
return
if(parts[part.bp_tag])
to_chat(user, SPAN_WARNING("\The [src] already has \a [W] installed."))
return
if(part.can_install(user) && user.unEquip(W, src))
parts[part.bp_tag] = part
part.forceMove(src)
update_icon()
// Install an MMI/brain.
else if(istype(W, /obj/item/mmi))
if(!istype(loc,/turf))
to_chat(user, SPAN_WARNING("You can't put \the [W] in without the frame being on the ground."))
return
if(!check_completion())
to_chat(user, SPAN_WARNING("The frame is not ready for the central processor to be installed."))
return
var/obj/item/mmi/M = W
var/mob/living/carbon/brain/B = M.brainmob
if(!B)
to_chat(user, SPAN_WARNING("Sticking an empty [W.name] into the frame would sort of defeat the purpose."))
return
if(jobban_isbanned(B, "Robot"))
to_chat(user, SPAN_WARNING("\The [W] does not seem to fit."))
return
if(B.stat == DEAD)
to_chat(user, SPAN_WARNING("Sticking a dead [W.name] into the frame would sort of defeat the purpose."))
return
var/ghost_can_reenter = 0
if(B.mind)
if(B.key)
ghost_can_reenter = TRUE
else
for(var/mob/observer/dead/G in player_list)
if(G.can_reenter_corpse && G.mind == B.mind)
ghost_can_reenter = TRUE
//Jamming a ghosted brain into a borg is likely detrimental, and may result in some problems.
to_chat(user, SPAN_NOTICE("\The [W] is completely unresponsive, but it may be able to auto-resuscitate if you leave it be for awhile."))
break
if(!ghost_can_reenter)
to_chat(user, SPAN_WARNING("\The [W] is completely unresponsive; there's no point."))
return
if(!user.unEquip(W))
return
var/mob/living/silicon/robot/O = new product(get_turf(loc))
if(!O)
return
O.mmi = W
O.invisibility = 0
O.custom_name = created_name
O.updatename("Default")
B.mind.transfer_to(O)
if(O.mind && O.mind.assigned_role)
O.job = O.mind.assigned_role
else
O.job = "Robot"
var/obj/item/robot_parts/chest/chest = parts[BP_TORSO]
if (chest && chest.cell)
chest.cell.forceMove(O)
W.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
// Since we "magically" installed a cell, we also have to update the correct component.
if(O.cell)
var/datum/robot_component/cell_component = O.components["power cell"]
cell_component.wrapped = O.cell
cell_component.installed = 1
callHook("borgify", list(O))
O.Namepick()
qdel(src)
else if(istype(W, /obj/item/pen))
var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if(t && (in_range(src, user) || loc == user))
created_name = t
else
..()
/obj/item/robot_parts/frame/Destroy()
parts.Cut()
for(var/thing in contents)
qdel(thing)
. = ..()
/obj/item/robot_parts/frame/proc/dismantled_from(mob/living/silicon/robot/donor)
for(var/thing in required_parts - list(BP_TORSO, BP_HEAD))
var/part_type = required_parts[thing]
parts[thing] = new part_type(src)
var/obj/item/robot_parts/chest/chest = (locate() in donor.contents) || new
if(chest)
chest.forceMove(src)
parts[BP_TORSO] = chest
update_icon()
/obj/item/robot_parts/frame/SetDefaultName()
name = initial(name)
/obj/item/robot_parts/frame/flyer
name = "flying robot frame"
icon = 'icons/obj/robot_parts_flying.dmi'
product = /mob/living/silicon/robot/flying
required_parts = list(
BP_L_ARM = /obj/item/robot_parts/l_arm,
BP_R_ARM = /obj/item/robot_parts/r_arm,
BP_TORSO = /obj/item/robot_parts/chest,
BP_HEAD = /obj/item/robot_parts/head
)
/obj/item/robot_parts/frame/platform
name = "large robot frame"
icon = 'icons/obj/robot_parts_platform.dmi'
product = /mob/living/silicon/robot/platform
required_parts = list(
BP_L_ARM = /obj/item/robot_parts/l_arm,
BP_R_ARM = /obj/item/robot_parts/r_arm,
BP_L_LEG = /obj/item/robot_parts/l_leg,
BP_R_LEG = /obj/item/robot_parts/r_leg,
BP_TORSO = /obj/item/robot_parts/chest,
BP_HEAD = /obj/item/robot_parts/head
)
+151 -223
View File
@@ -4,294 +4,222 @@
item_state = "buildpipe"
icon_state = "blank"
slot_flags = SLOT_BELT
dir = SOUTH
var/list/part = null // Order of args is important for installing robolimbs.
var/sabotaged = 0 //Emagging limbs can have repercussions when installed as prosthetics.
var/model_info
dir = SOUTH
var/bp_tag = null // What part is this?
/obj/item/robot_parts/set_dir()
return
/obj/item/robot_parts/proc/update_model_info(var/model)
if(!model)
return FALSE
model_info = model
var/datum/robolimb/R = all_robolimbs[model]
if(R)
name = "[R.company] [initial(name)]"
desc = "[R.desc]"
if(icon_state in icon_states(R.icon))
icon = R.icon
return TRUE
return FALSE
/obj/item/robot_parts/Initialize(ml, model)
. = ..(ml)
if(!update_model_info(model))
SetDefaultName()
/obj/item/robot_parts/proc/SetDefaultName()
name = "robot [initial(name)]"
/obj/item/robot_parts/proc/can_install(mob/user)
return TRUE
/obj/item/robot_parts/l_arm
name = "cyborg left arm"
name = "left arm"
desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
icon_state = "l_arm"
part = list(BP_L_ARM, BP_L_HAND)
model_info = 1
bp_tag = BP_L_ARM
/obj/item/robot_parts/r_arm
name = "cyborg right arm"
name = "right arm"
desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
icon_state = "r_arm"
part = list(BP_R_ARM, BP_R_HAND)
model_info = 1
bp_tag = BP_R_ARM
/obj/item/robot_parts/l_leg
name = "cyborg left leg"
name = "left leg"
desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
icon_state = "l_leg"
part = list(BP_L_LEG, BP_L_FOOT)
model_info = 1
bp_tag = BP_L_LEG
/obj/item/robot_parts/r_leg
name = "cyborg leg"
name = "right leg"
desc = "A skeletal limb wrapped in pseudomuscles, with a low-conductivity case."
icon_state = "r_leg"
part = list(BP_R_LEG, BP_R_FOOT)
model_info = 1
/obj/item/robot_parts/chest
name = "cyborg chest"
desc = "A heavily reinforced case containing cyborg logic boards, with space for a standard power cell."
icon_state = "chest"
part = list(BP_GROIN,BP_TORSO)
var/wires = 0.0
var/obj/item/cell/cell = null
bp_tag = BP_R_LEG
/obj/item/robot_parts/head
name = "cyborg head"
name = "head"
desc = "A standard reinforced braincase, with spine-plugged neural socket and sensor gimbals."
icon_state = "head"
part = list(BP_HEAD)
bp_tag = BP_HEAD
var/obj/item/flash/flash1 = null
var/obj/item/flash/flash2 = null
/obj/item/robot_parts/robot_suit
name = "endoskeleton"
desc = "A complex metal backbone with standard limb sockets and pseudomuscle anchors."
icon_state = "robo_suit"
var/obj/item/robot_parts/l_arm/l_arm = null
var/obj/item/robot_parts/r_arm/r_arm = null
var/obj/item/robot_parts/l_leg/l_leg = null
var/obj/item/robot_parts/r_leg/r_leg = null
var/obj/item/robot_parts/chest/chest = null
var/obj/item/robot_parts/head/head = null
var/created_name = ""
/obj/item/robot_parts/head/can_install(mob/user)
var/success = TRUE
if(!flash1 || !flash2)
to_chat(user, SPAN_WARNING("You need to attach a flash to it first!"))
success = FALSE
return success && ..()
/obj/item/robot_parts/robot_suit/Initialize()
. = ..()
src.updateicon()
/obj/item/robot_parts/chest
name = "torso"
desc = "A heavily reinforced case containing cyborg logic boards, with space for a standard power cell."
icon_state = "torso"
part = list(BP_GROIN,BP_TORSO)
bp_tag = BP_TORSO
var/wires = 0.0
var/obj/item/cell/cell = null
/obj/item/robot_parts/robot_suit/proc/updateicon()
cut_overlays()
if(src.l_arm)
add_overlay("l_arm+o")
if(src.r_arm)
add_overlay("r_arm+o")
if(src.chest)
add_overlay("chest+o")
if(src.l_leg)
add_overlay("l_leg+o")
if(src.r_leg)
add_overlay("r_leg+o")
if(src.head)
add_overlay("head+o")
/obj/item/robot_parts/chest/can_install(mob/user)
var/success = TRUE
if(!wires)
to_chat(user, SPAN_WARNING("You need to attach wires to it first!"))
success = FALSE
if(!cell)
to_chat(user, SPAN_WARNING("You need to attach a cell to it first!"))
success = FALSE
return success && ..()
/obj/item/robot_parts/robot_suit/proc/check_completion()
if(src.l_arm && src.r_arm)
if(src.l_leg && src.r_leg)
if(src.chest && src.head)
feedback_inc("cyborg_frames_built",1)
return 1
return 0
/obj/item/robot_parts/chest/attackby(obj/item/W, mob/user)
/obj/item/robot_parts/robot_suit/attackby(obj/item/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/stack/material) && W.get_material_name() == MAT_STEEL && !l_arm && !r_arm && !l_leg && !r_leg && !chest && !head)
var/obj/item/stack/material/M = W
if (M.use(1))
var/obj/item/secbot_assembly/ed209_assembly/B = new /obj/item/secbot_assembly/ed209_assembly
B.loc = get_turf(src)
to_chat(user, "<span class='notice'>You armed the robot frame.</span>")
if (user.get_inactive_hand()==src)
user.remove_from_mob(src)
user.put_in_inactive_hand(B)
qdel(src)
else
to_chat(user, "<span class='warning'>You need one sheet of metal to arm the robot frame.</span>")
if(istype(W, /obj/item/robot_parts/l_leg))
if(src.l_leg) return
user.drop_item()
W.loc = src
src.l_leg = W
src.updateicon()
if(istype(W, /obj/item/robot_parts/r_leg))
if(src.r_leg) return
user.drop_item()
W.loc = src
src.r_leg = W
src.updateicon()
if(istype(W, /obj/item/robot_parts/l_arm))
if(src.l_arm) return
user.drop_item()
W.loc = src
src.l_arm = W
src.updateicon()
if(istype(W, /obj/item/robot_parts/r_arm))
if(src.r_arm) return
user.drop_item()
W.loc = src
src.r_arm = W
src.updateicon()
if(istype(W, /obj/item/robot_parts/chest))
if(src.chest) return
if(W:wires && W:cell)
user.drop_item()
W.loc = src
src.chest = W
src.updateicon()
else if(!W:wires)
to_chat(user, "<span class='warning'>You need to attach wires to it first!</span>")
else
to_chat(user, "<span class='warning'>You need to attach a cell to it first!</span>")
if(istype(W, /obj/item/robot_parts/head))
if(src.head) return
if(W:flash2 && W:flash1)
user.drop_item()
W.loc = src
src.head = W
src.updateicon()
else
to_chat(user, "<span class='warning'>You need to attach a flash to it first!</span>")
if(istype(W, /obj/item/mmi))
var/obj/item/mmi/M = W
if(check_completion())
if(!istype(loc,/turf))
to_chat(user, "<span class='warning'>You can't put \the [W] in, the frame has to be standing on the ground to be perfectly precise.</span>")
return
if(!istype(W, /obj/item/mmi/inert))
if(!M.brainmob)
to_chat(user, "<span class='warning'>Sticking an empty [W] into the frame would sort of defeat the purpose.</span>")
return
if(!M.brainmob.key)
var/ghost_can_reenter = 0
if(M.brainmob.mind)
for(var/mob/observer/dead/G in player_list)
if(G.can_reenter_corpse && G.mind == M.brainmob.mind)
ghost_can_reenter = 1 //May come in use again at another point.
to_chat(user, "<span class='notice'>\The [W] is completely unresponsive; though it may be able to auto-resuscitate.</span>") //Jamming a ghosted brain into a borg is likely detrimental, and may result in some problems.
return
if(!ghost_can_reenter)
to_chat(user, "<span class='notice'>\The [W] is completely unresponsive; there's no point.</span>")
return
if(M.brainmob.stat == DEAD)
to_chat(user, "<span class='warning'>Sticking a dead [W] into the frame would sort of defeat the purpose.</span>")
return
if(jobban_isbanned(M.brainmob, "Cyborg"))
to_chat(user, "<span class='warning'>This [W] does not seem to fit.</span>")
return
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc), TRUE)
if(!O) return
user.drop_item()
O.mmi = W
O.post_mmi_setup()
O.invisibility = 0
O.custom_name = created_name
O.updatename("Default")
if(M.brainmob)
M.brainmob.mind.transfer_to(O)
if(O.mind && O.mind.special_role)
O.mind.store_memory("In case you look at this after being borged, the objectives are only here until I find a way to make them not show up for you, as I can't simply delete them without screwing up round-end reporting. --NeoFite")
for(var/datum/language/L in M.brainmob.languages)
O.add_language(L.name)
O.job = "Cyborg"
O.cell = chest.cell
O.cell.loc = O
W.loc = O//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
// Since we "magically" installed a cell, we also have to update the correct component.
if(O.cell)
var/datum/robot_component/cell_component = O.components["power cell"]
cell_component.wrapped = O.cell
cell_component.installed = 1
feedback_inc("cyborg_birth",1)
callHook("borgify", list(O))
O.Namepick()
qdel(src)
else
to_chat(user, "<span class='warning'>The MMI must go in after everything else!</span>")
if (istype(W, /obj/item/pen))
var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if (!t)
return
if (!in_range(src, usr) && src.loc != usr)
return
src.created_name = t
return
/obj/item/robot_parts/chest/attackby(obj/item/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/cell))
if(src.cell)
to_chat(user, "<span class='warning'>You have already inserted a cell!</span>")
return
else
user.drop_item()
W.loc = src
to_chat(user, SPAN_WARNING("You have already inserted a cell!"))
return TRUE
if(user.unEquip(W, src))
src.cell = W
to_chat(user, "<span class='notice'>You insert the cell!</span>")
W.forceMove(src)
to_chat(user, SPAN_NOTICE("You insert the cell!"))
return TRUE
if(istype(W, /obj/item/stack/cable_coil))
if(src.wires)
to_chat(user, "<span class='warning'>You have already inserted wire!</span>")
return
else
var/obj/item/stack/cable_coil/coil = W
coil.use(1)
to_chat(user, SPAN_WARNING("You have already inserted wire!"))
return TRUE
var/obj/item/stack/cable_coil/coil = W
if(coil.use(1))
src.wires = 1.0
to_chat(user, "<span class='notice'>You insert the wire!</span>")
return
to_chat(user, SPAN_NOTICE("You insert the wire!"))
return TRUE
/obj/item/robot_parts/head/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/robot_parts/head))
var/obj/item/robot_parts/head/head_part = W
// Attempt to create full-body prosthesis.
var/success = TRUE
success &= can_install(user)
success &= head_part.can_install(user)
if (success)
// Species selection.
var/species = input(user, "Select a species for the prosthetic.") as null|anything in GetCyborgSpecies()
if(!species)
return TRUE
var/name = sanitizeSafe(input(user,"Set a name for the new prosthetic."), MAX_NAME_LEN)
if(!name)
name = "prosthetic ([random_id("prosthetic_id", 1, 999)])"
// Create a new, nonliving human.
var/mob/living/carbon/human/H = new /mob/living/carbon/human(get_turf(loc))
H.death(0, DEATHGASP_NO_MESSAGE)
H.set_species(species)
H.fully_replace_character_name(name)
// Remove all external organs other than chest and head..
for (var/O in list(BP_L_ARM, BP_R_ARM, BP_L_LEG, BP_R_LEG))
var/obj/item/organ/external/organ = H.organs_by_name[O]
H.organs -= organ
H.organs_by_name[organ.organ_tag] = null
qdel(organ)
// Remove brain (we want to put one in).
var/obj/item/organ/internal/brain = H.internal_organs_by_name[O_BRAIN]
H.organs -= brain
H.organs_by_name[brain.organ_tag] = null
qdel(brain)
// Robotize remaining organs: Eyes, head, and chest.
// Respect brand used.
var/obj/item/organ/internal/eyes = H.internal_organs_by_name[O_EYES]
eyes.robotize()
var/obj/item/organ/external/head = H.organs_by_name[BP_HEAD]
var/head_company = head_part.model_info
head.robotize(head_company)
var/obj/item/organ/external/chest = H.organs_by_name[BP_TORSO]
var/chest_company = model_info
chest.robotize(chest_company)
// Cleanup
qdel(W)
qdel(src)
return TRUE
return ..()
/obj/item/robot_parts/chest/proc/GetCyborgSpecies()
. = list()
for(var/N in GLOB.playable_species)
var/datum/species/S = GLOB.all_species[N]
if(S.spawn_flags & SPECIES_NO_FBP_CONSTRUCTION)
continue
. += N
/obj/item/robot_parts/head/attackby(obj/item/W, mob/user)
..()
if(istype(W, /obj/item/flash))
if(istype(user,/mob/living/silicon/robot))
var/current_module = user.get_active_hand()
if(current_module == W)
to_chat(user, "<span class='warning'>How do you propose to do that?</span>")
to_chat(user, SPAN_WARNING("How do you propose to do that?"))
return
else
add_flashes(W,user)
else
add_flashes(W,user)
return
/obj/item/robot_parts/head/proc/add_flashes(obj/item/W as obj, mob/user as mob) //Made into a separate proc to avoid copypasta
/obj/item/robot_parts/head/proc/add_flashes(obj/item/W, mob/user) //Made into a seperate proc to avoid copypasta
if(src.flash1 && src.flash2)
to_chat(user, "<span class='notice'>You have already inserted the eyes!</span>")
to_chat(user, SPAN_NOTICE("You have already inserted the eyes!"))
return
else if(src.flash1)
user.drop_item()
W.loc = src
if(!user.unEquip(W, src))
return
src.flash2 = W
to_chat(user, "<span class='notice'>You insert the flash into the eye socket!</span>")
W.forceMove(src)
to_chat(user, SPAN_NOTICE("You insert the flash into the eye socket!"))
else
user.drop_item()
W.loc = src
if(!user.unEquip(W, src))
return
src.flash1 = W
to_chat(user, "<span class='notice'>You insert the flash into the eye socket!</span>")
W.forceMove(src)
to_chat(user, SPAN_NOTICE("You insert the flash into the eye socket!"))
/obj/item/robot_parts/emag_act(var/remaining_charges, var/mob/user)
/obj/item/robot_parts/emag_act(remaining_charges, mob/user)
if(sabotaged)
to_chat(user, "<span class='warning'>[src] is already sabotaged!</span>")
to_chat(user, SPAN_WARNING("[src] is already sabotaged!"))
else
to_chat(user, "<span class='warning'>You short out the safeties.</span>")
to_chat(user, SPAN_WARNING("You short out the safeties."))
sabotaged = 1
return 1
@@ -133,22 +133,17 @@
require_module = 1
/obj/item/borg/upgrade/jetpack/action(var/mob/living/silicon/robot/R)
if(..()) return 0
if(..())
return FALSE
var/obj/item/tank/jetpack/carbondioxide/T = locate() in R.module
if(!T)
T = locate() in R.module.contents
if(!T)
T = locate() in R.module.modules
if(!T)
R.module.modules += new/obj/item/tank/jetpack/carbondioxide(R.module)
for(var/obj/item/tank/jetpack/carbondioxide in R.module.modules)
R.internals = src
return 1
if(T)
to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!")
if(R.module.jetpack)
to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!")
to_chat(usr, "There's no mounting point for the module!")
return 0
return FALSE
R.module.jetpack = new /obj/item/tank/jetpack/carbondioxide(R.module)
R.internals = R.module.jetpack
return TRUE
/obj/item/borg/upgrade/advhealth
name = "advanced health analyzer module"