From 3dcd6240d5dfa3608dd83fe5655767c306868107 Mon Sep 17 00:00:00 2001 From: Razgriz Date: Thu, 19 Nov 2020 04:05:03 -0700 Subject: [PATCH 1/4] ranged_cooldown_time variable for mobs This is the addition of a new mob variable that will allow mobs to move and shoot at the same time. This section here is special snowflake code for metroids only, or for whatever else in the future that you want to have move and shoot at the same time. Basically, this is a non-stupid version of "ranged_attack_delay." "ranged_attack_delay" is stupid because it sleeps the entire mob. This new ranged_cooldown_time is smarter in the sense that it is an internalized timer. Try not to confuse the names. --- code/modules/mob/living/simple_mob/combat.dm | 15 ++++++++--- .../mob/living/simple_mob/simple_mob.dm | 25 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/simple_mob/combat.dm b/code/modules/mob/living/simple_mob/combat.dm index 1dce673601..b38317b964 100644 --- a/code/modules/mob/living/simple_mob/combat.dm +++ b/code/modules/mob/living/simple_mob/combat.dm @@ -98,6 +98,16 @@ if(reload_count >= reload_max) try_reload() return FALSE + + //CHOMP Addition: This section here is special snowflake code for metroids only, or for whatever else in the future that you want to have move and shoot at the same time. Basically, this is a non-stupid version of the above intended for ranged vore mobs i.e. metroids. ranged_attack_delay is stupid because it sleeps the entire mob. This new ranged_cooldown_time is smarter in the sense that it is an internalized timer. Try not to confuse the names. + if(ranged_cooldown_time) //If you have a non-zero number in a mob's variables, this pattern begins. + if(ranged_cooldown <= world.time) //Further down, a timer keeps adding to the ranged_cooldown variable automatically. + visible_message("\The [src] fires at \the [A]!") //Leave notice of shooting. + shoot(A) //Perform the shoot action + if(casingtype) //If the mob is designated to leave casings... + new casingtype(loc) //... leave the casing. + ranged_cooldown = world.time + ranged_cooldown_time //Special addition here. This is a timer. Keeping updating the time after shooting. Add that ranged cooldown time specified in the mob to the world time. + return TRUE //End these commands here. visible_message("\The [src] fires at \the [A]!") shoot(A) @@ -106,10 +116,9 @@ if(ranged_attack_delay) ranged_post_animation(A) - + return TRUE - // Shoot a bullet at something. /mob/living/simple_mob/proc/shoot(atom/A) if(A == get_turf(src)) @@ -134,6 +143,7 @@ if(needs_reload) reload_count++ + // if(distance >= special_attack_min_range && distance <= special_attack_max_range) // return TRUE @@ -240,7 +250,6 @@ set_AI_busy(FALSE) - // Override these four for special custom animations (like the GOLEM). /mob/living/simple_mob/proc/melee_pre_animation(atom/A) do_windup_animation(A, melee_attack_delay) diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm index 6687b1f380..3ef06b3d81 100644 --- a/code/modules/mob/living/simple_mob/simple_mob.dm +++ b/code/modules/mob/living/simple_mob/simple_mob.dm @@ -108,6 +108,8 @@ var/melee_attack_delay = 2 // If set, the mob will do a windup animation and can miss if the target moves out of the way. var/ranged_attack_delay = null var/special_attack_delay = null + var/ranged_cooldown = 0 //CHOMP Addition. This is part of a timer in combat.dm. + var/ranged_cooldown_time = 0 //CHOMP Addition: This variable can be thrown into mob variables in order to allow the mob to move AND shoot at the same time. The previous "ranged_attack_delay" is a dumb way of handling ranged attacks because it sleeps the entire mob - this one uses an internalized timer so it is slightly smarter. //Special attacks // var/special_attack_prob = 0 // The chance to ATTEMPT a special_attack_target(). If it fails, it will do a regular attack instead. @@ -173,6 +175,29 @@ if(has_eye_glow) add_eyes() + if(LAZYLEN(organs)) + for(var/path in organs) + if(ispath(path)) + var/obj/item/organ/external/neworg = new path(src) + neworg.name = "[name] [neworg.name]" + neworg.meat_type = meat_type + + if(limb_icon) + neworg.force_icon = limb_icon + neworg.force_icon_key = limb_icon_key + + organs |= neworg + organs -= path + + if(LAZYLEN(internal_organs)) + for(var/path in internal_organs) + if(ispath(path)) + var/obj/item/organ/neworg = new path(src) + neworg.name = "[name] [neworg.name]" + neworg.meat_type = meat_type + internal_organs |= neworg + internal_organs -= path + return ..() /mob/living/simple_mob/Destroy() From 1a192a6a9ba223e4826002fb15e3486448899462 Mon Sep 17 00:00:00 2001 From: Razgriz Date: Thu, 19 Nov 2020 13:43:54 -0700 Subject: [PATCH 2/4] Update simple_mob.dm --- .../mob/living/simple_mob/simple_mob.dm | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm index 3ef06b3d81..03fc4e6c47 100644 --- a/code/modules/mob/living/simple_mob/simple_mob.dm +++ b/code/modules/mob/living/simple_mob/simple_mob.dm @@ -175,29 +175,6 @@ if(has_eye_glow) add_eyes() - if(LAZYLEN(organs)) - for(var/path in organs) - if(ispath(path)) - var/obj/item/organ/external/neworg = new path(src) - neworg.name = "[name] [neworg.name]" - neworg.meat_type = meat_type - - if(limb_icon) - neworg.force_icon = limb_icon - neworg.force_icon_key = limb_icon_key - - organs |= neworg - organs -= path - - if(LAZYLEN(internal_organs)) - for(var/path in internal_organs) - if(ispath(path)) - var/obj/item/organ/neworg = new path(src) - neworg.name = "[name] [neworg.name]" - neworg.meat_type = meat_type - internal_organs |= neworg - internal_organs -= path - return ..() /mob/living/simple_mob/Destroy() From 33b34f6d2edf9a6281f5e04512e72a5c286a8075 Mon Sep 17 00:00:00 2001 From: Novacat <35587478+Novacat@users.noreply.github.com> Date: Thu, 19 Nov 2020 19:53:51 -0500 Subject: [PATCH 3/4] Merge pull request #9329 from Novacat/nova-basicfixes Fixes PDA Alert Icons --- code/modules/pda/app.dm | 4 ++-- code/modules/pda/pda.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/pda/app.dm b/code/modules/pda/app.dm index eb64125ee9..99c9822019 100644 --- a/code/modules/pda/app.dm +++ b/code/modules/pda/app.dm @@ -41,14 +41,14 @@ pda.play_ringtone() if(blink && !(src in pda.notifying_programs)) - pda.overlays += image('icons/obj/pda.dmi', "pda-r") + pda.overlays += image(icon, "pda-r") pda.notifying_programs |= src /datum/data/pda/proc/unnotify() if(src in pda.notifying_programs) pda.notifying_programs -= src if(!pda.notifying_programs.len) - pda.overlays -= image('icons/obj/pda.dmi', "pda-r") + pda.overlays -= image(icon, "pda-r") // An app has a button on the home screen and its own UI /datum/data/pda/app diff --git a/code/modules/pda/pda.dm b/code/modules/pda/pda.dm index 2c3b368730..f05a1056fd 100644 --- a/code/modules/pda/pda.dm +++ b/code/modules/pda/pda.dm @@ -300,7 +300,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(can_use(usr)) start_program(find_program(/datum/data/pda/app/main_menu)) notifying_programs.Cut() - overlays -= image('icons/obj/pda.dmi', "pda-r") + overlays -= image(icon, "pda-r") to_chat(usr, "You press the reset button on \the [src].") else to_chat(usr, "You cannot do this while restrained.")