From c026d533b1d99f2f68370ca65ca66fe9374ee9b0 Mon Sep 17 00:00:00 2001 From: datlo Date: Thu, 27 Dec 2018 20:13:22 +0000 Subject: [PATCH] fixed build path error, add power warnings also put back attacked_by oof removed syndicate tech requirement cuz eeeh it's just a voice, replaced by titanium requirement --- code/_onclick/hud/alert.dm | 17 ++++++++++- code/game/mecha/mecha.dm | 30 ++++++++++++++++++- .../designs/mechfabricator_designs.dm | 5 ++-- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 0ededa09c22..b7aea886903 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -322,7 +322,7 @@ Recharging stations are available in robotics, the dormitory bathrooms, and the /obj/screen/alert/nymph/Click() if(!usr || !usr.client) - return + return if(isnymph(usr)) var/mob/living/simple_animal/diona/D = usr return D.resist() @@ -412,6 +412,21 @@ so as to remain in compliance with the most up-to-date laws." else to_chat(usr, "[M] is not connected to a port at the moment.") +/obj/screen/alert/mech_nocell + name = "Missing Power Cell" + desc = "Mech has no power cell." + icon_state = "nocell" + +/obj/screen/alert/mech_emptycell + name = "Out of Power" + desc = "Mech is out of power." + icon_state = "emptycell" + +/obj/screen/alert/mech_lowcell + name = "Low Charge" + desc = "Mech is running out of power." + icon_state = "lowcell" + //GUARDIANS /obj/screen/alert/cancharge name = "Charge Ready" diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 19b9df10245..9d7b8b9ff6a 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -84,6 +84,7 @@ var/longactivationsound = 'sound/mecha/nominal.ogg' var/starting_voice = /obj/item/mecha_modkit/voice var/activated = FALSE + var/power_warned = FALSE var/melee_cooldown = 10 var/melee_can_hit = 1 @@ -894,6 +895,9 @@ else to_chat(user, "You stop installing [M].") + else + return attacked_by(W, user) + /obj/mecha/attacked_by(obj/item/I, mob/user) log_message("Attacked by [I]. Attacker - [user]") user.changeNext_move(CLICK_CD_MELEE) @@ -1012,7 +1016,7 @@ icon_state = initial(icon_state) playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) if(!hasInternalDamage()) - occupant << sound(nominalsound, volume=50) + occupant << sound(nominalsound, volume = 50) AI.cancel_camera() AI.controlled_mech = src AI.remote_control = src @@ -1371,15 +1375,39 @@ /obj/mecha/proc/use_power(amount) if(get_charge()) cell.use(amount) + update_cell() return 1 return 0 /obj/mecha/proc/give_power(amount) if(!isnull(get_charge())) cell.give(amount) + update_cell() return 1 return 0 +/obj/mecha/proc/update_cell() + if(cell) + var/cellcharge = cell.charge/cell.maxcharge + switch(cellcharge) + if(0.75 to INFINITY) + occupant.clear_alert("charge") + if(0.5 to 0.75) + occupant.throw_alert("charge", /obj/screen/alert/mech_lowcell, 1) + if(0.25 to 0.5) + occupant.throw_alert("charge", /obj/screen/alert/mech_lowcell, 2) + if(power_warned) + power_warned = FALSE + if(0.01 to 0.25) + occupant.throw_alert("charge", /obj/screen/alert/mech_lowcell, 3) + if(!power_warned) + occupant << sound(lowpowersound, volume = 50) + power_warned = TRUE + else + occupant.throw_alert("charge", /obj/screen/alert/mech_emptycell) + else + occupant.throw_alert("charge", /obj/screen/alert/mech_nocell) + /obj/mecha/proc/reset_icon() if(initial_icon) icon_state = initial_icon diff --git a/code/modules/research/designs/mechfabricator_designs.dm b/code/modules/research/designs/mechfabricator_designs.dm index 1b688a5551b..0052ec93dde 100644 --- a/code/modules/research/designs/mechfabricator_designs.dm +++ b/code/modules/research/designs/mechfabricator_designs.dm @@ -1223,7 +1223,7 @@ build_type = MECHFAB materials = list(MAT_METAL = 400, MAT_BANANIUM = 100) construction_time = 50 - build_path = /obj/item/mecha_modkit/voice/syndicate + build_path = /obj/item/mecha_modkit/voice/honk category = list("Misc") /datum/design/voice_syndicate @@ -1231,8 +1231,7 @@ desc = "A modification kit that updates a mech's onboard voice to Syndicate." id = "voice_syndicate" build_type = MECHFAB - materials = list(MAT_METAL = 500) - req_tech = list("syndicate" = 2) + materials = list(MAT_METAL = 400, MAT_TITANIUM = 100) construction_time = 50 build_path = /obj/item/mecha_modkit/voice/syndicate category = list("Misc")