Finish Machinery new to init (#17334)

* Finish Machinery new to init

* fix that

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Kashargul
2025-03-16 03:57:48 -04:00
committed by GitHub
co-authored by Cameron Lennox
parent f362f6585f
commit 4d36cfdaeb
116 changed files with 486 additions and 528 deletions
@@ -18,26 +18,34 @@
// maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - halloss
/obj/item/inserted_spell/asphyxiation/on_insert()
spawn(1)
if(ishuman(host))
var/mob/living/carbon/human/H = host
if(H.isSynthetic() || H.does_not_breathe) // It's hard to choke a robot or something that doesn't breathe.
on_expire()
return
to_chat(H, span_warning("You are having difficulty breathing!"))
var/pulses = 3
var/warned_victim = 0
while(pulses)
if(!warned_victim)
warned_victim = predict_crit(pulses, H, 0)
sleep(4 SECONDS)
H.adjustOxyLoss(5)
var/health_lost = H.getMaxHealth() - H.getOxyLoss() + H.getToxLoss() + H.getFireLoss() + H.getBruteLoss() + H.getCloneLoss()
H.adjustOxyLoss(round(abs(health_lost * 0.25)))
//to_world("Inflicted [round(abs(health_lost * 0.25))] damage!")
pulses--
if(src) //We might've been dispelled at this point and deleted, better safe than sorry.
on_expire()
if(ishuman(host))
var/mob/living/carbon/human/H = host
if(H.isSynthetic() || H.does_not_breathe) // It's hard to choke a robot or something that doesn't breathe.
on_expire()
return
to_chat(H, span_warning("You are having difficulty breathing!"))
var/pulses = 3
var/warned_victim = 0
if(!warned_victim)
warned_victim = predict_crit(pulses, H, 0)
looped_insert(3, H, warned_victim)
/obj/item/inserted_spell/mend_wires/looped_insert(remaining_callbacks, mob/living/carbon/human/H, var/warned)
if(H)
remaining_callbacks --
H.adjustOxyLoss(5)
var/health_lost = H.getMaxHealth() - H.getOxyLoss() + H.getToxLoss() + H.getFireLoss() + H.getBruteLoss() + H.getCloneLoss()
H.adjustOxyLoss(round(abs(health_lost * 0.25)))
if(remaining_callbacks > 0)
if(!warned)
warned = predict_crit(pulses, H, 0)
addtimer(CALLBACK(src, PROC_REF(looped_insert), remaining_callbacks, H, warned), 4 SECONDS, TIMER_DELETE_ME)
return
on_expire()
/obj/item/inserted_spell/asphyxiation/on_expire()
..()
@@ -20,18 +20,21 @@
var/mob/living/host = null
var/spell_power_at_creation = 1.0 // This is here because the spell object that made this object probably won't exist.
/obj/item/inserted_spell/New(var/newloc, var/user, var/obj/item/spell/insert/inserter)
..(newloc)
host = newloc
/obj/item/inserted_spell/Initialize(mapload, var/user, var/obj/item/spell/insert/inserter)
. = ..()
host = loc
origin = user
if(light_color)
spawn(1)
set_light(inserter.spell_light_range, inserter.spell_light_intensity, inserter.spell_color)
set_light(inserter.spell_light_range, inserter.spell_light_intensity, inserter.spell_color)
on_insert()
/obj/item/inserted_spell/proc/on_insert()
return
/obj/item/inserted_spell/proc/looped_insert(var/remaining_callbacks, var/mob/living/carbon/human/H)
PROTECTED_RPOC(TRUE)
return
/obj/item/inserted_spell/proc/on_expire(var/dispelled = 0)
qdel(src)
return
@@ -17,14 +17,21 @@
inserting = /obj/item/inserted_spell/mend_burns
/obj/item/inserted_spell/mend_burns/on_insert()
spawn(1)
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 10 : 30
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(10)
for(var/i = 0, i<5,i++)
if(H)
H.adjustFireLoss(-heal_power / 5)
sleep(1 SECOND)
on_expire()
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 10 : 30
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(10)
looped_insert(5, H)
/obj/item/inserted_spell/mend_wires/looped_insert(remaining_callbacks, mob/living/carbon/human/H)
if(H)
remaining_callbacks --
H.adjustFireLoss(-heal_power / 5)
if(remaining_callbacks > 0)
addtimer(CALLBACK(src, PROC_REF(looped_insert), remaining_callbacks, H), 1 SECOND, TIMER_DELETE_ME)
return
on_expire()
@@ -17,17 +17,24 @@
inserting = /obj/item/inserted_spell/mend_metal
/obj/item/inserted_spell/mend_metal/on_insert()
spawn(1)
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 10 : 30
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(10)
for(var/i = 0, i<5,i++)
if(H)
for(var/obj/item/organ/external/O in H.organs)
if(O.robotic < ORGAN_ROBOT) // Robot parts only.
continue
O.heal_damage(heal_power / 5, 0, internal = 1, robo_repair = 1)
sleep(1 SECOND)
on_expire()
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 10 : 30
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(10)
looped_insert(5, H)
/obj/item/inserted_spell/mend_metal/looped_insert(remaining_callbacks, mob/living/carbon/human/H)
if(H)
remaining_callbacks --
for(var/obj/item/organ/external/O in H.organs)
if(O.robotic < ORGAN_ROBOT) // Robot parts only.
continue
O.heal_damage(heal_power / 5, 0, internal = 1, robo_repair = 1)
if(remaining_callbacks > 0)
addtimer(CALLBACK(src, PROC_REF(looped_insert), remaining_callbacks, H), 1 SECOND, TIMER_DELETE_ME)
return
on_expire()
@@ -18,39 +18,45 @@
inserting = /obj/item/inserted_spell/mend_organs
/obj/item/inserted_spell/mend_organs/on_insert()
spawn(1)
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 2 : 5
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(15)
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 2 : 5
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(15)
for(var/i = 0, i<5,i++)
if(H)
for(var/obj/item/organ/O in H.internal_organs)
if(O.damage > 0) // Fix internal damage
O.damage = max(O.damage - (heal_power / 5), 0)
if(O.damage <= 5 && O.organ_tag == O_EYES) // Fix eyes
H.sdisabilities &= ~BLIND
looped_insert(5, H)
for(var/obj/item/organ/external/O in H.organs) // Fix limbs
if(!O.robotic < ORGAN_ROBOT) // No robot parts for this.
continue
O.heal_damage(0, heal_power / 5, internal = 1, robo_repair = 0)
for(var/obj/item/organ/E in H.bad_external_organs) // Fix bones
var/obj/item/organ/external/affected = E
if((affected.damage < affected.min_broken_damage * config.organ_health_multiplier) && (affected.status & ORGAN_BROKEN))
affected.status &= ~ORGAN_BROKEN
/obj/item/inserted_spell/mend_wires/looped_insert(remaining_callbacks, mob/living/carbon/human/H)
if(H)
remaining_callbacks --
for(var/obj/item/organ/O in H.internal_organs)
if(O.damage > 0) // Fix internal damage
O.damage = max(O.damage - (heal_power / 5), 0)
if(O.damage <= 5 && O.organ_tag == O_EYES) // Fix eyes
H.sdisabilities &= ~BLIND
for(var/datum/wound/W in affected.wounds) // Fix IB
if(istype(W, /datum/wound/internal_bleeding))
affected.wounds -= W
affected.update_damages()
for(var/obj/item/organ/external/O in H.organs) // Fix limbs
if(!O.robotic < ORGAN_ROBOT) // No robot parts for this.
continue
O.heal_damage(0, heal_power / 5, internal = 1, robo_repair = 0)
H.restore_blood() // Fix bloodloss
for(var/obj/item/organ/E in H.bad_external_organs) // Fix bones
var/obj/item/organ/external/affected = E
if((affected.damage < affected.min_broken_damage * config.organ_health_multiplier) && (affected.status & ORGAN_BROKEN))
affected.status &= ~ORGAN_BROKEN
H.adjustBruteLoss(-heal_power)
for(var/datum/wound/W in affected.wounds) // Fix IB
if(istype(W, /datum/wound/internal_bleeding))
affected.wounds -= W
affected.update_damages()
sleep(1 SECOND)
on_expire()
H.restore_blood() // Fix bloodloss
H.adjustBruteLoss(-heal_power)
if(remaining_callbacks > 0)
addtimer(CALLBACK(src, PROC_REF(looped_insert), remaining_callbacks, H), 1 SECOND, TIMER_DELETE_ME)
return
on_expire()
@@ -17,17 +17,23 @@
inserting = /obj/item/inserted_spell/mend_wires
/obj/item/inserted_spell/mend_wires/on_insert()
spawn(1)
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 10 : 30
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(10)
for(var/i = 0, i<5,i++)
if(H)
for(var/obj/item/organ/external/O in H.organs)
if(O.robotic < ORGAN_ROBOT) // Robot parts only.
continue
O.heal_damage(0, heal_power / 5, internal = 1, robo_repair = 1)
sleep(1 SECOND)
on_expire()
if(ishuman(host))
var/mob/living/carbon/human/H = host
var/heal_power = host == origin ? 10 : 30
heal_power = round(heal_power * spell_power_at_creation, 1)
origin.adjust_instability(10)
looped_insert(5, H)
/obj/item/inserted_spell/mend_wires/looped_insert(remaining_callbacks, mob/living/carbon/human/H)
if(H)
remaining_callbacks --
for(var/obj/item/organ/external/O in H.organs)
if(O.robotic < ORGAN_ROBOT) // Robot parts only.
continue
O.heal_damage(0, heal_power / 5, internal = 1, robo_repair = 1)
if(remaining_callbacks > 0)
addtimer(CALLBACK(src, PROC_REF(looped_insert), remaining_callbacks, H), 1 SECOND, TIMER_DELETE_ME)
return
on_expire()