Skip to content

Commit

Permalink
add: New() -> Initialize() organs migration. (#6137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeberdir authored Dec 6, 2024
1 parent 5822373 commit 5973657
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 52 deletions.
26 changes: 15 additions & 11 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,29 +202,33 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g
///Datum used in item pixel shift TGUI
var/datum/ui_module/item_pixel_shift/item_pixel_shift

/obj/item/New()
..()
for(var/path in actions_types)
if(action_icon && action_icon_state)
new path(src, action_icon[path], action_icon_state[path])
else
new path(src)

if(!move_resist)
determine_move_resist()


/obj/item/Initialize(mapload)
. = ..()

if(isstorage(loc)) //marks all items in storage as being such
item_flags |= IN_STORAGE

if(!hitsound)
if(damtype == "fire")
hitsound = 'sound/items/welder.ogg'

if(damtype == "brute")
hitsound = "swing_hit"

for(var/path in actions_types)
if(action_icon && action_icon_state)
new path(src, action_icon[path], action_icon_state[path])

else
new path(src)

if(!move_resist)
determine_move_resist()

add_eatable_component()


/obj/item/proc/add_eatable_component()
AddComponent(/datum/component/eatable)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/limb_reattach.dm
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
continue

var/new_limb_type = organ_data["path"]
var/obj/item/organ/external/new_limb = new new_limb_type(holder = target, special = ORGAN_MANIPULATION_DEFAULT)
var/obj/item/organ/external/new_limb = new new_limb_type(target, ORGAN_MANIPULATION_DEFAULT)
new_limb.robotize(company = L.model_info)

if(L.sabotaged)
Expand Down
7 changes: 4 additions & 3 deletions code/modules/surgery/organs/organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@
var/hidden_pain = FALSE


/obj/item/organ/New(mob/living/carbon/human/holder)
..(holder)
/obj/item/organ/Initialize(mapload)
. = ..()

if(!max_damage)
max_damage = min_broken_damage * 2

if(ishuman(holder))
if(ishuman(loc))
var/mob/living/carbon/human/holder = loc
update_DNA(holder.dna)
return

Expand Down
11 changes: 6 additions & 5 deletions code/modules/surgery/organs/organ_external.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@
light_on = FALSE


/obj/item/organ/external/New(mob/living/carbon/holder, special = ORGAN_MANIPULATION_NOEFFECT)
..()
/obj/item/organ/external/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

if(dna?.species)
icobase = dna.species.icobase
deform = dna.species.deform
if(ishuman(holder))
replaced(holder, special)
sync_colour_to_human(holder)

if(ishuman(loc))
replaced(loc, special)
sync_colour_to_human(loc)
properly_attached = TRUE

if(is_robotic())
Expand Down
9 changes: 5 additions & 4 deletions code/modules/surgery/organs/organ_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
light_on = FALSE


/obj/item/organ/internal/New(mob/living/carbon/holder)
..()
if(istype(holder))
insert(holder)
/obj/item/organ/internal/Initialize(mapload)
. = ..()

if(iscarbon(loc))
insert(loc)

if(species_type == /datum/species/diona)
AddComponent(/datum/component/diona_internals)
Expand Down
55 changes: 33 additions & 22 deletions code/modules/surgery/organs/subtypes/machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/head/ipc/New()
..()
/obj/item/organ/external/head/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/chest/ipc
Expand All @@ -22,8 +23,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/chest/ipc/New()
..()
/obj/item/organ/external/chest/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/groin/ipc
Expand All @@ -34,8 +36,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/groin/ipc/New()
..()
/obj/item/organ/external/groin/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/arm/ipc
Expand All @@ -46,8 +49,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/arm/ipc/New()
..()
/obj/item/organ/external/arm/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/arm/right/ipc
Expand All @@ -56,8 +60,9 @@
status = ORGAN_ROBOT
emp_resistant = TRUE

/obj/item/organ/external/arm/right/ipc/New()
..()
/obj/item/organ/external/arm/right/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/leg/ipc
Expand All @@ -68,8 +73,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/leg/ipc/New()
..()
/obj/item/organ/external/leg/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/leg/right/ipc
Expand All @@ -78,8 +84,9 @@
status = ORGAN_ROBOT
emp_resistant = TRUE

/obj/item/organ/external/leg/right/ipc/New()
..()
/obj/item/organ/external/leg/right/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/foot/ipc
Expand All @@ -90,8 +97,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/foot/ipc/New()
..()
/obj/item/organ/external/foot/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/foot/right/ipc
Expand All @@ -100,8 +108,9 @@
status = ORGAN_ROBOT
emp_resistant = TRUE

/obj/item/organ/external/foot/right/ipc/New()
..()
/obj/item/organ/external/foot/right/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/hand/ipc
Expand All @@ -112,8 +121,9 @@
pickup_sound = 'sound/items/handling/component_pickup.ogg'
drop_sound = 'sound/items/handling/component_drop.ogg'

/obj/item/organ/external/hand/ipc/New()
..()
/obj/item/organ/external/hand/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/external/hand/right/ipc
Expand All @@ -122,8 +132,9 @@
status = ORGAN_ROBOT
emp_resistant = TRUE

/obj/item/organ/external/hand/right/ipc/New()
..()
/obj/item/organ/external/hand/right/ipc/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

robotize(company = "Morpheus Cyberkinetics")

/obj/item/organ/internal/cell
Expand Down
14 changes: 8 additions & 6 deletions code/modules/surgery/organs/subtypes/standard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,10 @@
var/list/m_colours = list("tail" = "#000000")
s_col = "#000000"

/obj/item/organ/external/tail/New(mob/living/carbon/holder)
..()
if(!holder)
/obj/item/organ/external/tail/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

if(!ishuman(loc))
var/icon/tempicon = new/icon("icon" = force_icon, "icon_state" = icon_name)
var/icon/tempicon2 = new/icon(tempicon,dir=NORTH)
tempicon2.Flip(SOUTH)
Expand Down Expand Up @@ -548,9 +549,10 @@
var/list/m_colours = list("wing" = "#000000")
s_col = "#000000"

/obj/item/organ/external/wing/New(mob/living/carbon/holder)
..()
if(!holder)
/obj/item/organ/external/wing/Initialize(mapload, special = ORGAN_MANIPULATION_NOEFFECT)
. = ..()

if(!ishuman(loc))
var/icon/tempicon = new/icon("icon" = force_icon, "icon_state" = icon_name)
var/icon/tempicon2 = new/icon(tempicon,dir=NORTH)
tempicon2.Flip(SOUTH)
Expand Down

0 comments on commit 5973657

Please sign in to comment.