Skip to content

Commit

Permalink
[PORT FEAT] Borg hats (#23690)
Browse files Browse the repository at this point in the history
* Initial commit. Adds borg hats.

* No longer spam update_icons

* Remove unused offset update

* Fixed destroyer borg icons (Fuck it, ship it)

* Borg hat examine

* Borg hat examine

* Destroyer borg fixes

* Requested fixes

* Removed weird spacing

* Corgis are not cyborgs

* Remove debugging statements

* proc renaming

* Removed comments

* Added documentation.

* Update code/modules/mob/living/silicon/robot/robot_mob.dm

Co-authored-by: Henri215 <[email protected]>

* Update code/modules/mob/living/silicon/silicon_mob.dm

Co-authored-by: Henri215 <[email protected]>

* Added missing sprite offset

* Added comment to robot_module_hat_offset

* Update code/modules/mob/living/silicon/robot/robot_mob.dm

Co-authored-by: Henri215 <[email protected]>

* Changes to stretched_hat

* Remove unnecessary user check

* Guard clause time

* Update code/modules/mob/living/silicon/silicon_mob.dm

Co-authored-by: Henri215 <[email protected]>

* Update code/modules/mob/living/silicon/robot/drone/maint_drone.dm

Co-authored-by: Henri215 <[email protected]>

* Moved HOLOGRAM check up

* I loathe DMI merge conflicts

* Moved the hologram check even further up.

* Yet more DMI conflicts

* Move borg_icons back

---------

Co-authored-by: Adrer <[email protected]>
Co-authored-by: Henri215 <[email protected]>
  • Loading branch information
3 people authored Mar 10, 2024
1 parent da979a5 commit 5670f95
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 10 deletions.
7 changes: 7 additions & 0 deletions code/modules/mob/living/silicon/ai/ai_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
see_invisible = SEE_INVISIBLE_LIVING_AI
see_in_dark = 8
can_strip = FALSE
hat_offset_y = 3
is_centered = TRUE
can_be_hatted = TRUE
var/list/network = list("SS13","Telecomms","Research Outpost","Mining Outpost")
var/obj/machinery/camera/current = null
var/list/connected_robots = list()
Expand Down Expand Up @@ -383,6 +386,10 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
if(powered_ai.anchored)
change_power_mode(ACTIVE_POWER_USE)

/mob/living/silicon/ai/update_icons()
. = ..()
update_hat_icons()

/mob/living/silicon/ai/proc/pick_icon()
set category = "AI Commands"
set name = "Set AI Core Display"
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/silicon/robot/drone/maint_drone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
mob_size = MOB_SIZE_SMALL
pull_force = MOVE_FORCE_VERY_WEAK // Can only drag small items
modules_break = FALSE
hat_offset_y = -15
is_centered = TRUE
can_be_hatted = TRUE
can_wear_restricted_hats = TRUE
/// Cooldown for law syncs
var/sync_cooldown = 0


// We need to keep track of a few module items so we don't need to do list operations
// every time we need them. These get set in New() after the module is chosen.
var/obj/item/stack/sheet/metal/cyborg/stack_metal = null
Expand Down Expand Up @@ -129,6 +134,7 @@
overlays += "eyes-repairbot-pathfinding"
else
overlays -= "eyes"
update_hat_icons()

/mob/living/silicon/robot/drone/pick_module()
return
Expand Down
9 changes: 2 additions & 7 deletions code/modules/mob/living/silicon/robot/robot_inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,19 @@
inv2.icon_state = "inv2"
inv3.icon_state = "inv3"
module_active = module_state_1
return
if(2)
if(module_active != module_state_2)
inv1.icon_state = "inv1"
inv2.icon_state = "inv2 +a"
inv3.icon_state = "inv3"
module_active = module_state_2
return
if(3)
if(module_active != module_state_3)
inv1.icon_state = "inv1"
inv2.icon_state = "inv2"
inv3.icon_state = "inv3 +a"
module_active = module_state_3
return
update_icons()
return

//deselect_module(module) - Deselects the module slot specified by "module"
Expand All @@ -195,17 +193,15 @@
if(module_active == module_state_1)
inv1.icon_state = "inv1"
module_active = null
return
if(2)
if(module_active == module_state_2)
inv2.icon_state = "inv2"
module_active = null
return
if(3)
if(module_active == module_state_3)
inv3.icon_state = "inv3"
module_active = null
return
update_icons()
return

//toggle_module(module) - Toggles the selection of the module slot specified by "module".
Expand Down Expand Up @@ -240,7 +236,6 @@
select_module(slot_num)
return
while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up.

return

/mob/living/silicon/robot/unEquip(obj/item/I, force, silent = FALSE)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/silicon/robot/robot_life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
module_state_2:screen_loc = ui_inv2
if(module_state_3)
module_state_3:screen_loc = ui_inv3
update_icons()

/mob/living/silicon/robot/proc/process_locks()
if(weapon_lock)
Expand Down
97 changes: 95 additions & 2 deletions code/modules/mob/living/silicon/robot/robot_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
scanner.Grant(src)
RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(create_trail))

robot_module_hat_offset(icon_state)

/mob/living/silicon/robot/get_radio()
return radio

Expand Down Expand Up @@ -447,6 +449,85 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(

return module_sprites

/**
* Sets the offset for a cyborg's hats based on their module icon.
* Borgs are grouped by similar sprites (Eg. all the Noble borgs are all the same sprite but recoloured.)
*
* Arguments:
* * module - An `icon_state` for which the offset needs to be calculated.
*/
/mob/living/silicon/robot/proc/robot_module_hat_offset(module)
switch(module)
if("Engineering", "Miner_old", "JanBot2", "Medbot", "engineerrobot", "maximillion", "secborg", "Hydrobot")
can_be_hatted = FALSE // Their base sprite already comes with a hat
hat_offset_y = -1
if("Noble-CLN", "Noble-SRV", "Noble-DIG", "Noble-MED", "Noble-SEC", "Noble-ENG", "Noble-STD")
can_be_hatted = TRUE
can_wear_restricted_hats = TRUE
hat_offset_y = 4
if("droid-medical")
can_be_hatted = TRUE
can_wear_restricted_hats = TRUE
hat_offset_y = 4
if("droid-miner", "mk2", "mk3")
can_be_hatted = TRUE
is_centered = TRUE
hat_offset_y = 3
if("bloodhound", "nano_bloodhound", "syndie_bloodhound", "ertgamma")
can_be_hatted = TRUE
hat_offset_y = 1
if("Cricket-SEC", "Cricket-MEDI", "Cricket-JANI", "Cricket-ENGI", "Cricket-MINE", "Cricket-SERV")
can_be_hatted = TRUE
hat_offset_y = 2
if("droidcombat-shield", "droidcombat")
can_be_hatted = TRUE
hat_alpha = 255
hat_offset_y = 2
if("droidcombat-roll")
can_be_hatted = TRUE
hat_alpha = 0
hat_offset_y = 2
if("syndi-medi", "surgeon", "toiletbot")
can_be_hatted = TRUE
is_centered = TRUE
hat_offset_y = 1
if("Security", "janitorrobot", "medicalrobot")
can_be_hatted = TRUE
is_centered = TRUE
can_wear_restricted_hats = TRUE
hat_offset_y = -1
if("Brobot", "Service", "Service2", "robot_old", "securityrobot")
can_be_hatted = TRUE
is_centered = TRUE
can_wear_restricted_hats = TRUE
hat_offset_y = -1
if("Miner", "lavaland")
can_be_hatted = TRUE
hat_offset_y = -1
if("robot", "Standard", "Standard-Secy", "Standard-Medi", "Standard-Engi",
"Standard-Jani", "Standard-Serv", "Standard-Mine", "xenoborg-state-a")
can_be_hatted = TRUE
hat_offset_y = -3
if("droid")
can_be_hatted = TRUE
is_centered = TRUE
can_wear_restricted_hats = TRUE
hat_offset_y = -4
if("landmate", "syndi-engi")
can_be_hatted = TRUE
hat_offset_y = -7
if("mopgearrex")
can_be_hatted = TRUE
hat_offset_y = -6

if(silicon_hat)
if(!can_be_hatted)
remove_from_head(usr)
return
if(!can_wear_restricted_hats && is_type_in_list(silicon_hat, restricted_hats))
remove_from_head(usr)
return

/**
* Sets up the module items and sprites for the cyborg module chosen in `pick_module()`.
*
Expand Down Expand Up @@ -510,6 +591,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
custom_panel = trim(names[1])

update_module_icon()
robot_module_hat_offset(icon_state)
update_icons()
if(client.stat_tab == "Status")
SSstatpanels.set_status_tab(client)
Expand Down Expand Up @@ -538,6 +620,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
radio.recalculateChannels()
custom_panel = null

robot_module_hat_offset(icon_state)
update_icons()
update_headlamp()

Expand Down Expand Up @@ -1087,6 +1170,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(

/mob/living/silicon/robot/update_icons()
overlays.Cut()

if(stat != DEAD && !(IsParalyzed() || IsStunned() || IsWeakened() || low_power_mode)) //Not dead, not stunned.
if(custom_panel in custom_eye_names)
overlays += "eyes-[custom_panel]"
Expand All @@ -1107,6 +1191,8 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
else
overlays += "[panelprefix]-openpanel -c"
borg_icons()
robot_module_hat_offset(icon_state)
update_hat_icons()
update_fire()

/mob/living/silicon/robot/proc/borg_icons() // Exists so that robot/destroyer can override it
Expand Down Expand Up @@ -1237,6 +1323,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
if(cell) //Sanity check.
cell.forceMove(T)
cell = null
drop_hat()
qdel(src)

#define CAMERA_UPDATE_COOLDOWN 2.5 SECONDS
Expand Down Expand Up @@ -1586,8 +1673,6 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
set category = "Robot Commands"
set name = "Power Warning"



if(!is_component_functioning("power cell") || !cell || !cell.charge)
if(!start_audio_emote_cooldown(TRUE, 10 SECONDS))
to_chat(src, "<span class='warning'>The low-power capacitor for your speaker system is still recharging, please try again later.</span>")
Expand All @@ -1613,3 +1698,11 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
old_ai.connected_robots -= src
if(connected_ai)
connected_ai.connected_robots |= src

/datum/emote/flip/run_emote(mob/user, params, type_override, intentional)
. = ..()
if(isrobot(user))
var/mob/living/silicon/robot/borg = user
if(borg.drop_hat())
borg.visible_message("<span class='warning'><span class='name'>[src]</span> drops their hat!</span>",
"<span class='warning'>Your hat falls off!</span>")
Loading

0 comments on commit 5670f95

Please sign in to comment.