Skip to content

Commit

Permalink
More Harddel Fixes (shiptest-ss13#3569)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Fixes a few harddels that surfaced in PR shiptest-ss13#3558 

## Why It's Good For The Game
Harddels are still just terrible wastes of time

## Changelog

:cl:
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
MarkSuckerberg authored and zimon9 committed Oct 29, 2024
1 parent 723e5f7 commit 4cf8917
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 42 deletions.
13 changes: 5 additions & 8 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,13 @@

/datum/action/item_action/nano_picket_sign
name = "Retext Nano Picket Sign"
var/obj/item/picket_sign/S

/datum/action/item_action/nano_picket_sign/New(Target)
..()
if(istype(Target, /obj/item/picket_sign))
S = Target

/datum/action/item_action/nano_picket_sign/Trigger()
if(istype(S))
S.retext(owner)
if(!istype(target, /obj/item/picket_sign))
return

var/obj/item/picket_sign/sign = target
sign.retext(owner)

/datum/action/item_action/adjust

Expand Down
9 changes: 6 additions & 3 deletions code/datums/components/remote_materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ handles linking back and forth.
// specify explicitly in case the other component is deleted first
var/atom/P = parent
mat_container.retrieve_all(P.drop_location())
mat_container = null
return ..()

/datum/component/remote_materials/proc/_MakeLocal()
Expand Down Expand Up @@ -77,9 +78,11 @@ handles linking back and forth.
/datum/component/remote_materials/proc/OnAttackBy(datum/source, obj/item/I, mob/user)
SIGNAL_HANDLER

if (silo && istype(I, /obj/item/stack))
if (silo.remote_attackby(parent, user, I))
return COMPONENT_NO_AFTERATTACK
if (!silo || !istype(I, /obj/item/stack))
return

if (silo.remote_attackby(parent, user, I))
return COMPONENT_NO_AFTERATTACK

/datum/component/remote_materials/proc/OnMultitool(datum/source, mob/user, obj/item/I)
SIGNAL_HANDLER
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/implants/implant_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
radio.keyslot = new radio_key
radio.recalculateChannels()

/obj/item/implant/radio/Destroy()
QDEL_NULL(radio)
return ..()

/obj/item/implant/radio/mining
radio_key = /obj/item/encryptionkey

Expand Down
3 changes: 1 addition & 2 deletions code/game/turfs/closed/minerals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
ScrapeAway()

/turf/closed/mineral/ex_act(severity, target)
..()
switch(severity)
if(3)
if (prob(75))
Expand All @@ -177,7 +176,7 @@
gets_drilled(null, FALSE)
if(1)
gets_drilled(null, FALSE)
return
return ..()

/turf/closed/mineral/random
var/list/mineralSpawnChanceList = list(/obj/item/stack/ore/uranium = 3, /obj/item/stack/ore/diamond = 1, /obj/item/stack/ore/gold = 4,
Expand Down
3 changes: 1 addition & 2 deletions code/modules/atmospherics/machinery/airalarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27)

/obj/machinery/airalarm/Destroy()
SSradio.remove_object(src, frequency)
qdel(wires)
wires = null
QDEL_NULL(wires)
var/area/ourarea = get_area(src)
ourarea.atmosalert(FALSE, src)
return ..()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/clothing/under/accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@
chameleon_action.chameleon_name = "Accessory"
chameleon_action.initialize_disguises()

/obj/item/clothing/accessory/holster/chameleon/Destroy()
QDEL_NULL(chameleon_action)
return ..()

/obj/item/clothing/accessory/holster/chameleon/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@
animal_species = /mob/living/simple_animal/hostile/asteroid/gutlunch
childtype = list(/mob/living/simple_animal/hostile/asteroid/gutlunch/grublunch = 100)

var/mutable_appearance/gutlunch_full_overlay

wanted_objects = list(/obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/blood/gibs/, /obj/item/organ, /obj/item/reagent_containers/food/snacks/meat/slab)

/mob/living/simple_animal/hostile/asteroid/gutlunch/Initialize()
. = ..()
if(wanted_objects.len)
AddComponent(/datum/component/udder, /obj/item/udder/gutlunch, CALLBACK(src, PROC_REF(regenerate_icons)), CALLBACK(src, PROC_REF(regenerate_icons)))
if(!length(wanted_objects))
return
AddComponent(/datum/component/udder, /obj/item/udder/gutlunch, CALLBACK(src, TYPE_PROC_REF(/atom/movable, update_overlays)), CALLBACK(src, TYPE_PROC_REF(/atom/movable, update_overlays)))
gutlunch_full_overlay = mutable_appearance(icon, "gl_full")

/mob/living/simple_animal/hostile/asteroid/gutlunch/CanAttack(atom/the_target) // Gutlunch-specific version of CanAttack to handle stupid stat_exclusive = true crap so we don't have to do it for literally every single simple_animal/hostile except the two that spawn in lavaland
if(isturf(the_target) || !the_target || the_target.type == /atom/movable/lighting_object) // bail out on invalids
Expand All @@ -72,14 +76,12 @@

return FALSE

/mob/living/simple_animal/hostile/asteroid/gutlunch/regenerate_icons(new_udder_volume, max_udder_volume)
cut_overlays()
var/static/gutlunch_full_overlay
if(isnull(gutlunch_full_overlay))
gutlunch_full_overlay = iconstate2appearance(icon, "gl_full")
if(new_udder_volume == max_udder_volume)
add_overlay(gutlunch_full_overlay)
..()
/mob/living/simple_animal/hostile/asteroid/gutlunch/update_overlays(new_udder_volume, max_udder_volume)
. = ..()
if(new_udder_volume != max_udder_volume)
return

. += gutlunch_full_overlay

//Male gutlunch. They're smaller and more colorful!
/mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck
Expand Down
1 change: 1 addition & 0 deletions code/modules/power/singularity/emitter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
log_game("Emitter deleted at [AREACOORD(T)]")
investigate_log("<font color='red'>deleted</font> at [AREACOORD(T)]", INVESTIGATE_SINGULO)
QDEL_NULL(sparks)
QDEL_NULL(wires)
return ..()

/obj/machinery/power/emitter/update_icon_state()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/boxes_magazines/_box_magazine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
for(var/i = max(1, stored_ammo.len), i <= max_ammo, i++)
stored_ammo += new round_check(src)

/obj/item/ammo_box/Destroy()
stored_ammo.Cut()
return ..()

///gets a round from the magazine, if keep is TRUE the round will stay in the gun
/obj/item/ammo_box/proc/get_round(keep = FALSE)
if(!stored_ammo.len)
Expand Down
26 changes: 14 additions & 12 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@
*/
///The types of attachments allowed, a list of types. SUBTYPES OF AN ALLOWED TYPE ARE ALSO ALLOWED
var/list/valid_attachments = list()
///Reference to our attachment holder to prevent subtypes having to call GetComponent
var/datum/component/attachment_holder/attachment_holder
///Number of attachments that can fit on a given slot
var/list/slot_available = ATTACHMENT_DEFAULT_SLOT_AVAILABLE
///Offsets for the slots on this gun. should be indexed by SLOT and then by X/Y
Expand Down Expand Up @@ -339,7 +337,7 @@

/obj/item/gun/ComponentInitialize()
. = ..()
attachment_holder = AddComponent(/datum/component/attachment_holder, slot_available, valid_attachments, slot_offsets, default_attachments)
AddComponent(/datum/component/attachment_holder, slot_available, valid_attachments, slot_offsets, default_attachments)
AddComponent(/datum/component/two_handed)

/// triggered on wield of two handed item
Expand Down Expand Up @@ -384,6 +382,8 @@
QDEL_NULL(azoom)
if(muzzle_flash)
QDEL_NULL(muzzle_flash)
if(magazine)
QDEL_NULL(magazine)
return ..()

/obj/item/gun/handle_atom_del(atom/A)
Expand Down Expand Up @@ -1008,18 +1008,21 @@
check_flags = AB_CHECK_CONSCIOUS|AB_CHECK_HANDS_BLOCKED|AB_CHECK_IMMOBILE|AB_CHECK_LYING
icon_icon = 'icons/mob/actions/actions_items.dmi'
button_icon_state = "sniper_zoom"
var/obj/item/gun/gun = null

/datum/action/toggle_scope_zoom/Trigger()
if(!istype(target, /obj/item/gun) || !..())
return

var/obj/item/gun/gun = target
gun.zoom(owner, owner.dir)

/datum/action/toggle_scope_zoom/IsAvailable()
. = ..()
if(!. && gun)
gun.zoom(owner, owner.dir, FALSE)
/datum/action/toggle_scope_zoom/Remove(mob/user)
if(!istype(target, /obj/item/gun))
return ..()

var/obj/item/gun/gun = target
gun.zoom(user, user.dir, FALSE)

/datum/action/toggle_scope_zoom/Remove(mob/living/L)
gun.zoom(L, L.dir, FALSE)
..()

/obj/item/gun/proc/rotate(atom/thing, old_dir, new_dir)
Expand Down Expand Up @@ -1056,8 +1059,7 @@
return

if(zoomable)
azoom = new()
azoom.gun = src
azoom = new(src)

/obj/item/gun/proc/build_firemodes()
if(FIREMODE_FULLAUTO in gun_firemodes)
Expand Down
11 changes: 6 additions & 5 deletions code/modules/surgery/organs/vocal_cords.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@

/datum/action/item_action/organ_action/colossus
name = "Voice of God"
var/obj/item/organ/vocal_cords/colossus/cords = null

/datum/action/item_action/organ_action/colossus/New()
..()
cords = target

/datum/action/item_action/organ_action/colossus/IsAvailable()
if(!istype(target, /obj/item/organ/vocal_cords/colossus))
return FALSE

var/obj/item/organ/vocal_cords/colossus/cords = target

if(world.time < cords.next_command)
return FALSE
if(!owner)
Expand All @@ -58,6 +58,7 @@
/datum/action/item_action/organ_action/colossus/Trigger()
. = ..()
if(!IsAvailable())
var/obj/item/organ/vocal_cords/colossus/cords = target
if(world.time < cords.next_command)
to_chat(owner, "<span class='notice'>You must wait [DisplayTimeText(cords.next_command - world.time)] before Speaking again.</span>")
return
Expand Down

0 comments on commit 4cf8917

Please sign in to comment.