Skip to content

Commit

Permalink
bugfix: Runtimes Fixes N5 (#5811)
Browse files Browse the repository at this point in the history
Runtimes Fixes N5
  • Loading branch information
Gottfrei authored Aug 25, 2024
1 parent d0354ba commit a4c53b1
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 21 deletions.
10 changes: 7 additions & 3 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,29 @@
/obj/item/proc/melee_attack_chain(mob/user, atom/target, params)
. = ATTACK_CHAIN_PROCEED

var/user_type = "[user.type]"
var/item_type = "[type]"
var/target_type = "[target.type]"

var/tool_chain_result = tool_attack_chain(user, target, params)
if(!(tool_chain_result & ATTACK_CHAIN_CORE_RETURN_BITFLAGS))
CRASH("tool_attack_chain() must return one of the core ATTACK_CHAIN_* bitflags, please consult code/__DEFINES/combat.dm")
CRASH("tool_attack_chain() must return one of the core ATTACK_CHAIN_* bitflags, please consult code/__DEFINES/combat.dm; user = [user_type]; item = [item_type]; target = [target_type]")

. |= tool_chain_result
if(ATTACK_CHAIN_CANCEL_CHECK(.))
return .

var/pre_attackby_result = pre_attackby(target, user, params)
if(!(pre_attackby_result & ATTACK_CHAIN_CORE_RETURN_BITFLAGS))
CRASH("pre_attackby() must return one of the core ATTACK_CHAIN_* bitflags, please consult code/__DEFINES/combat.dm")
CRASH("pre_attackby() must return one of the core ATTACK_CHAIN_* bitflags, please consult code/__DEFINES/combat.dm; user = [user_type]; item = [item_type]; target = [target_type]")

. |= pre_attackby_result
if(ATTACK_CHAIN_CANCEL_CHECK(.))
return .

var/attackby_result = target.attackby(src, user, params)
if(!(attackby_result & ATTACK_CHAIN_CORE_RETURN_BITFLAGS))
CRASH("attackby() must return one of the core ATTACK_CHAIN_* bitflags, please consult code/__DEFINES/combat.dm")
CRASH("attackby() must return one of the core ATTACK_CHAIN_* bitflags, please consult code/__DEFINES/combat.dm; user = [user_type]; item = [item_type]; target = [target_type]")

. |= attackby_result
// yes a lot of QDELETED checks but attackby is a longest spaghetti code in the entire game
Expand Down
3 changes: 2 additions & 1 deletion code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
changeNext_move(grab_state > GRAB_PASSIVE ? CLICK_CD_GRABBING : CLICK_CD_PULLING)
return
GiveTarget(A)
AttackingTarget()
if(target)
AttackingTarget()

/atom/proc/attack_animal(mob/user)
return
Expand Down
39 changes: 25 additions & 14 deletions code/datums/outfits/vv_outfit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,26 @@

/proc/collect_vv(obj/item/I)
//Temporary/Internal stuff, do not copy these.
var/static/list/ignored_vars = list("vars","x","y","z","plane","layer","override","animate_movement","pixel_step_size","screen_loc","fingerprintslast","tip_timer")

if(istype(I))
var/static/list/ignored_vars = list(
NAMEOF(I, animate_movement) = TRUE,
NAMEOF(I, datum_flags) = TRUE,
NAMEOF(I, fingerprintslast) = TRUE,
NAMEOF(I, layer) = TRUE,
NAMEOF(I, plane) = TRUE,
NAMEOF(I, screen_loc) = TRUE,
NAMEOF(I, tip_timer) = TRUE,
NAMEOF(I, vars) = TRUE,
NAMEOF(I, x) = TRUE,
NAMEOF(I, y) = TRUE,
NAMEOF(I, z) = TRUE,
)

if(istype(I) && (I.datum_flags & DF_VAR_EDITED))
var/list/vedits = list()
for(var/varname in I.vars)
if(!I.can_vv_get(varname))
continue
if(varname in ignored_vars)
if(ignored_vars[varname])
continue
var/vval = I.vars[varname]
//Does it even work ?
Expand All @@ -68,19 +80,20 @@
vedits[varname] = I.vars[varname]
return vedits


/mob/living/carbon/human/proc/copy_outfit()
var/datum/outfit/varedit/O = new

//Copy equipment
var/list/result = list()
var/list/slots_to_check = list(ITEM_SLOT_CLOTH_INNER, ITEM_SLOT_BACK, ITEM_SLOT_CLOTH_OUTER, ITEM_SLOT_BELT, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET, ITEM_SLOT_HEAD, ITEM_SLOT_MASK, ITEM_SLOT_NECK, ITEM_SLOT_EAR_LEFT, ITEM_SLOT_EAR_RIGHT, ITEM_SLOT_EYES, ITEM_SLOT_PDA, ITEM_SLOT_SUITSTORE, ITEM_SLOT_POCKET_LEFT, ITEM_SLOT_POCKET_RIGHT)
for(var/s in slots_to_check)
var/obj/item/I = get_item_by_slot(s)
for(var/slot in slots_to_check)
var/obj/item/I = get_item_by_slot(slot)
var/vedits = collect_vv(I)
if(vedits)
result["[s]"] = vedits
result["[slot]"] = vedits
if(istype(I))
O.set_equipment_by_slot(s, I.type)
O.set_equipment_by_slot(slot, I.type)

//Copy hands
if(l_hand || r_hand) //Not in the mood to let outfits transfer amputees
Expand Down Expand Up @@ -149,21 +162,19 @@
//Copy implants
O.implants = list()
for(var/obj/item/implant/I in contents)
if(istype(I))
O.implants |= I.type
O.implants |= I.type

// Copy cybernetic implants
O.cybernetic_implants = list()
for(var/obj/item/organ/internal/CI in (contents + internal_organs))
if(istype(CI))
O.cybernetic_implants |= CI.type
O.cybernetic_implants |= CI.type

// Copy accessories
var/obj/item/clothing/under/uniform_slot = get_item_by_slot(ITEM_SLOT_CLOTH_INNER)
if(uniform_slot)
O.accessories = list()
for(var/obj/item/clothing/accessory/accessory as anything in uniform_slot.accessories)
O.accessories |= accessory
O.accessories |= accessory.type

//Copy to outfit cache
var/outfit_name = stripped_input(usr, "Enter the outfit name")
Expand All @@ -185,7 +196,7 @@
else
I = H.get_item_by_slot(text2num(slot))
for(var/vname in edits)
I.vv_edit_var(vname,edits[vname])
I.vv_edit_var(vname, edits[vname])
//Dat thing will make your capes colored by using `"24":{"atom_colours":{"#ffffff":"3"}}` in "vv_values".
var/obj/item/neck_slot = H.get_item_by_slot(ITEM_SLOT_NECK)
if(neck_slot)
Expand Down
6 changes: 5 additions & 1 deletion code/game/objects/items/devices/traitordevices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,16 @@ effective or pretty fucking useless.


/obj/item/teleporter/admin
desc = "A strange syndicate version of a cult veil shifter. \n This one seems EMP proof, and with much better saftey protocols."
desc = "A strange syndicate version of a cult veil shifter. \n This one seems EMP proof, and with much better safety protocols."
charges = 8
max_charges = 8
flawless = TRUE


/obj/item/teleporter/admin/update_icon_state()
icon_state = "[base_icon_state]-[CEILING(charges / 2, 1)]"


#define ION_CALLER_AI_TARGETING "AI targeting"
#define ION_CALLER_COMMS_TARGETING "Telecomms targeting"

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/extinguisher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
if(transferred > 0)
to_chat(user, span_notice("[src] has been refilled by [transferred] units."))
playsound(loc, 'sound/effects/refill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
for(var/datum/reagent/water/reagent as anything in reagents.reagent_list)
for(var/datum/reagent/water/reagent in reagents.reagent_list)
reagent.cooling_temperature = cooling_power
else
to_chat(user, span_notice("[watertank] is empty!"))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/hostile/hostile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
var/delay = SSnpcpool.wait / rapid_melee
for(var/i in 1 to rapid_melee)
addtimer(cb, (i - 1)*delay)
else
else if(target)
AttackingTarget()
if(patience)
GainPatience()
Expand Down

0 comments on commit a4c53b1

Please sign in to comment.