From 4cd2417eb8f174d736ebbc1bc26fe66d312adffa Mon Sep 17 00:00:00 2001 From: Atlantis Date: Mon, 18 May 2015 22:05:18 +0200 Subject: [PATCH] Implements suggestions from github - qdel() instead of del() - z in config.station_levels insted of z == 1 - Typo fix - Playercount is now 2 instead of 1 which was debug setting - AI is now properly deleted when struck by very strong explosion (heavy impact). - Hardware now properly uses install(). Hardware list is generated from existing datums using typesof() --- .../gamemodes/malfunction/malf_hardware.dm | 18 +++++- .../game/gamemodes/malfunction/malfunction.dm | 2 +- .../newmalf_ability_trees/HARDWARE.dm | 2 +- .../newmalf_ability_trees/HELPERS.dm | 58 +++++++------------ .../newmalf_ability_trees/tree_networking.dm | 6 +- code/modules/mob/living/silicon/ai/ai.dm | 8 ++- 6 files changed, 50 insertions(+), 44 deletions(-) diff --git a/code/game/gamemodes/malfunction/malf_hardware.dm b/code/game/gamemodes/malfunction/malf_hardware.dm index a3c91b53f2..ac5debc3a7 100644 --- a/code/game/gamemodes/malfunction/malf_hardware.dm +++ b/code/game/gamemodes/malfunction/malf_hardware.dm @@ -15,6 +15,8 @@ /datum/malf_hardware/apu_gen name = "APU Generator" desc = "Auxiliary Power Unit that will keep you operational even without external power. Has to be manually activated. When APU is operational most abilities will be unavailable, and ability research will temporarily stop." + driver = new/datum/game_mode/malfunction/verb/ai_toggle_apu() + /datum/malf_hardware/dual_cpu name = "Secondary Processor Unit" @@ -27,7 +29,21 @@ /datum/malf_hardware/core_bomb name = "Self-Destruct Explosives" desc = "High yield explosives are attached to your physical mainframe. This hardware comes with special driver that allows activation of these explosives. Timer is set to 15 seconds after manual activation. This is a doomsday device that will destroy both you and any intruders in your core." + driver = new/datum/game_mode/malfunction/verb/ai_self_destruct() /datum/malf_hardware/strong_turrets name = "Turrets Focus Enhancer" - desc = "Turrets are upgraded to have larger rate of fire and much larger damage. This however massively increases power usage when firing." \ No newline at end of file + desc = "Turrets are upgraded to have larger rate of fire and much larger damage. This however massively increases power usage when firing." + +/datum/malf_hardware/strong_turrets/install() + ..() + for(var/obj/machinery/turret/T in machines) + T.maxhealth += 30 + T.shot_delay = 7 // Half of default time. + T.auto_repair = 1 + T.active_power_usage = 25000 + for(var/obj/machinery/porta_turret/T in machines) + T.maxhealth += 30 + T.shot_delay = 7 // Half of default time. + T.auto_repair = 1 + T.active_power_usage = 25000 \ No newline at end of file diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index bd18a08e09..19378de167 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -4,7 +4,7 @@ extended_round_description = "The AI will attempt to hack the APCs around the station in order to gain as much control as possible." uplink_welcome = "Crazy AI Uplink Console:" config_tag = "malfunction" - required_players = 1 // DEBUG SETTING! Should be "2" for release (one AI and at least one crewmember) + required_players = 2 required_players_secret = 7 required_enemies = 1 end_on_antag_death = 0 diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/HARDWARE.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/HARDWARE.dm index 34551a0b17..34c82f6853 100644 --- a/code/game/gamemodes/malfunction/newmalf_ability_trees/HARDWARE.dm +++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/HARDWARE.dm @@ -39,7 +39,7 @@ return user << "** [timer] **" explosion(user.loc, 3,6,12,24) - del(user) + qdel(user) /datum/game_mode/malfunction/verb/ai_toggle_apu() diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm index 6ccf83688f..83944b4f9c 100644 --- a/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm +++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm @@ -14,12 +14,16 @@ user << "You have already selected your hardware." return - var/possible_choices = list("APU Generator", \ - "Turrets Focus Enhancer", \ - "Secondary Processor Unit",\ - "Secondary Memory Bank",\ - "Self-Destruct Explosives",\ - "CANCEL") + var/hardware_list = list() + for(var/H in typesof(/datum/malf_hardware)) + var/datum/malf_hardware/HW = new H + hardware_list += HW + + var/possible_choices = list() + for(var/datum/malf_hardware/H in hardware_list) + possible_choices += H.name + + possible_choices += "CANCEL" var/choice = input("Select desired hardware. You may only choose one hardware piece!: ") in possible_choices if(choice == "CANCEL") return @@ -27,20 +31,17 @@ var/datum/malf_hardware/C - switch(choice) - if("APU Generator") - C = new/datum/malf_hardware/apu_gen() - if("Turrets Focus Enhancer") - C = new/datum/malf_hardware/strong_turrets() - if("Secondary Processor Unit") - C = new/datum/malf_hardware/dual_cpu() - if("Secondary Memory Bank") - C = new/datum/malf_hardware/dual_ram() - if("Self-Destruct Explosives") - C = new/datum/malf_hardware/core_bomb() + for (var/datum/malf_hardware/H in hardware_list) + if(H.name == choice) + C = H + break if(C) note = C.desc + else + user << "This hardware does not exist! Probably a bug in game. Please report this." + return + if(!note) error("Hardware without description: [C]") @@ -51,26 +52,9 @@ user << "Selection cancelled. Use command again to select" return - switch(choice) - if("APU Generator") - user.verbs += new/datum/game_mode/malfunction/verb/ai_toggle_apu() - if("Turrets Focus Enhancer") - for(var/obj/machinery/turret/T in machines) - T.maxhealth += 30 - T.shot_delay = 7 // Half of default time. - T.auto_repair = 1 - T.active_power_usage = 25000 - for(var/obj/machinery/porta_turret/T in machines) - T.maxhealth += 30 - T.shot_delay = 7 // Half of default time. - T.auto_repair = 1 - T.active_power_usage = 25000 - if("Secondary Processor Unit") - if("Secondary Memory Bank") - if("Self-Destruct Explosives") - user.verbs += new/datum/game_mode/malfunction/verb/ai_self_destruct() - - user.hardware = C + if(C) + C.owner = user + C.install() // Verb: ai_help() // Parameters: None diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_networking.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_networking.dm index f059720dc0..23adb5e190 100644 --- a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_networking.dm +++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_networking.dm @@ -148,7 +148,7 @@ return var/list/remaining_apcs = list() for(var/obj/machinery/power/apc/A in machines) - if(A.z != 1) // Only station APCs + if(!(A.z in config.station_levels)) // Only station APCs continue if(A.hacker == user || A.aidisabled) // This one is already hacked, or AI control is disabled on it. continue @@ -168,7 +168,7 @@ sleep(duration/5) if(!user || user.stat == DEAD) return - command_announcement.Announce("This is highly abnormal and somewhat concerning. The intruder is too fast, he is evading our traces. It's almost as if it wasn't human.,,", "Network Monitoring") + command_announcement.Announce("This is highly abnormal and somewhat concerning. The intruder is too fast, he is evading our traces. It's almost as if it wasn't human..", "Network Monitoring") sleep(duration/5) if(!user || user.stat == DEAD) return @@ -194,7 +194,7 @@ sleep(300) // Hack all APCs, including those built during hack sequence. for(var/obj/machinery/power/apc/A in machines) - if((!A.hacker || A.hacker != src) && !A.aidisabled) + if((!A.hacker || A.hacker != src) && !A.aidisabled && A.z in config.station_levels) A.ai_hack(src) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index b16b14899b..7a1fbd573f 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -693,6 +693,12 @@ var/list/ai_verbs_default = list( return istype(loc, /turf) +/mob/living/silicon/ai/ex_act(var/severity) + if(severity == 1.0) + qdel(src) + return + ..() + // NEWMALF FUNCTIONS/PROCEDURES // Sets up malfunction-related variables, research system and such. @@ -757,7 +763,7 @@ var/list/ai_verbs_default = list( // Off-Station APCs should not count towards CPU generation. for(var/obj/machinery/power/apc/A in hacked_apcs) - if(A.z == 1) + if(A.z in config.station_levels) cpu_gain += 0.002 cpu_storage += 10