From be6368b71c4143cd80eeedb18234478214b30f6f Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Sun, 13 May 2012 23:18:02 -0700 Subject: [PATCH] Bugfixes for some temperature sharing, added variable editing by reference, fixed up some wound stuff. --- code/FEA/FEA_gas_mixture.dm | 8 +- code/game/objects/items/weapons/medical.dm | 26 ++-- code/game/objects/items/weapons/tools.dm | 3 + code/modules/admin/admin_verbs.dm | 2 + code/modules/admin/verbs/modifyvariables.dm | 11 ++ code/modules/mob/organ/organ.dm | 128 ++++++++++---------- 6 files changed, 96 insertions(+), 82 deletions(-) diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index 0c7538c770d..18191295325 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -891,6 +891,9 @@ datum if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/self_heat_capacity = heat_capacity_archived() var/sharer_heat_capacity = sharer.heat_capacity_archived() + if(!group_multiplier) + message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!") + return if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) var/heat = conduction_coefficient*delta_temperature* \ @@ -903,13 +906,14 @@ datum var/delta_temperature = (temperature - model.temperature) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/self_heat_capacity = heat_capacity()//_archived() + if(!group_multiplier) + message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!") + return if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) var/heat = conduction_coefficient*delta_temperature* \ (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity)) - ASSERT(self_heat_capacity != 0) // Trying to solve a runtime error - Abi79 - ASSERT(group_multiplier != 0) if(border_multiplier) temperature -= heat*border_multiplier/(self_heat_capacity*group_multiplier) else diff --git a/code/game/objects/items/weapons/medical.dm b/code/game/objects/items/weapons/medical.dm index 8755deddf0f..ef8a6b52f08 100644 --- a/code/game/objects/items/weapons/medical.dm +++ b/code/game/objects/items/weapons/medical.dm @@ -27,18 +27,17 @@ MEDICAL return 1 var/stoppedblood = 0 - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/datum/organ/external/affecting = H.get_organ("chest") + if(hasorgans(M)) + var/datum/organ/external/affecting = M:get_organ("chest") if(istype(user, /mob/living/carbon/human)) var/mob/living/carbon/human/user2 = user - affecting = H.get_organ(check_zone(user2.zone_sel.selecting)) + affecting = M:get_organ(check_zone(user2.zone_sel.selecting)) else if(!istype(affecting, /datum/organ/external) || affecting:burn_dam <= 0) - affecting = H.get_organ("head") + affecting = M:get_organ("head") if(affecting.destroyed && !affecting.gauzed) - user.visible_message("\red You do your best to stop the bleeding from [H]'s stump.", "\red [user] does [user.gender == MALE? "his" : "her"] best to stem [H]'s bleeding from [H.gender == MALE? "his" : "her"] stump.", "\red You hear something like gauze being ripped.") + user.visible_message("\red You do your best to stop the bleeding from [M]'s stump.", "\red [user] does [user.gender == MALE? "his" : "her"] best to stem [M]'s bleeding from [M.gender == MALE? "his" : "her"] stump.", "\red You hear something like gauze being ripped.") affecting.gauzed = 1 use(1) return @@ -69,7 +68,7 @@ MEDICAL if (user && stoppedblood) if (M != user) - user.visible_message("\red [user] [heal_burn? "salves" : "bandages"] [stoppedblood - 1 ? "some of" : "the last of"] [H]'s cuts with [src].", "\red You [heal_burn? "salve" : "bandage up"] [stoppedblood - 1 ? "some of" : "the last of"] [H]'s [heal_burn? "burns" : "wounds"].", "\red You hear something like gauze being ripped.") + user.visible_message("\red [user] [heal_burn? "salves" : "bandages"] [stoppedblood - 1 ? "some of" : "the last of"] [M]'s cuts with [src].", "\red You [heal_burn? "salve" : "bandage up"] [stoppedblood - 1 ? "some of" : "the last of"] [M]'s [heal_burn? "burns" : "wounds"].", "\red You hear something like gauze being ripped.") else user.visible_message("\red [user] [heal_burn? "salves" : "bandages"] [stoppedblood - 1 ? "some of" : "the last of"] [user.gender == MALE? "his" : "her"] own cuts with [src].", "\red You [heal_burn? "salve" : "bandage up"] [stoppedblood - 1 ? "some of" : "the last of"] your [heal_burn? "burns" : "wounds"].", "\red You hear something like gauze being ripped.") else if(user) @@ -146,18 +145,17 @@ MEDICAL return 1 var/stoppedblood = 0 - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/datum/organ/external/affecting = H.get_organ("chest") + if(hasorgans(M)) + var/datum/organ/external/affecting = M:get_organ("chest") if(istype(user, /mob/living/carbon/human)) var/mob/living/carbon/human/user2 = user - affecting = H.get_organ(check_zone(user2.zone_sel.selecting)) + affecting = M:get_organ(check_zone(user2.zone_sel.selecting)) else if(!istype(affecting, /datum/organ/external) || affecting:burn_dam <= 0) - affecting = H.get_organ("head") + affecting = M:get_organ("head") if(affecting.destroyed && !affecting.gauzed) - H.visible_message("\red You do your best to stop the bleeding from [H]'s stump.", "\red [user] does their best to stem [H]'s bleeding from [H.gender == MALE? "his" : "her"] stump.", "\red You hear something like gauze being ripped.") + M.visible_message("\red You do your best to stop the bleeding from [M]'s stump.", "\red [user] does their best to stem [M]'s bleeding from [M.gender == MALE? "his" : "her"] stump.", "\red You hear something like gauze being ripped.") affecting.gauzed = 1 use(1) return @@ -179,7 +177,7 @@ MEDICAL if (user && stoppedblood) if (M != user) - user.visible_message("\red [user] [heal_burn? "salves" : "bandages"] [stoppedblood - 1 ? "some of" : "the last of"] [H]'s cuts with [src].", "\red You [heal_burn? "salve" : "bandage up"] [stoppedblood - 1 ? "some of" : "the last of"] [H]'s [heal_burn? "burns" : "wounds"].", "\red You hear something like gauze being ripped.") + user.visible_message("\red [user] [heal_burn? "salves" : "bandages"] [stoppedblood - 1 ? "some of" : "the last of"] [M]'s cuts with [src].", "\red You [heal_burn? "salve" : "bandage up"] [stoppedblood - 1 ? "some of" : "the last of"] [M]'s [heal_burn? "burns" : "wounds"].", "\red You hear something like gauze being ripped.") else user.visible_message("\red [user] [heal_burn? "salves" : "bandages"] [stoppedblood - 1 ? "some of" : "the last of"] [user.gender == MALE? "his" : "her"] own cuts with [src].", "\red You [heal_burn? "salve" : "bandage up"] [stoppedblood - 1 ? "some of" : "the last of"] your [heal_burn? "burns" : "wounds"].", "\red You hear something like gauze being ripped.") else if(user) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index ba6fd257718..3e6b14ee0c5 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -263,6 +263,9 @@ WELDINGTOOOL attack(mob/M as mob, mob/user as mob) if(hasorgans(M)) var/datum/organ/external/S = M:organs[user.zone_sel.selecting] + if(S) + message_admins("It appears [M] has \"null\" where there should be a [user.zone_sel.selecting]. Check into this, and tell SkyMarshal: \"[M.type]\"") + return ..() if(!S.robot || user.a_intent != "help") return ..() if(S.brute_dam) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 7574cfc2270..0a76b274e8f 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -210,6 +210,7 @@ verbs += /obj/admins/proc/adspawn //toggle admin item spawning verbs += /client/proc/debug_variables verbs += /client/proc/cmd_modify_ticker_variables + verbs += /client/proc/cmd_modify_ref_variables verbs += /client/proc/Debug2 //debug toggle switch verbs += /client/proc/toggle_view_range verbs += /client/proc/Getmob @@ -432,6 +433,7 @@ verbs -= /client/proc/radioalert verbs -= /client/proc/rnd_check_designs verbs -= /client/proc/CarbonCopy + verbs -= /client/proc/cmd_modify_ref_variables verbs -= /proc/possess verbs -= /proc/release //verbs -= /client/proc/give_spell --Merged with view variables diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 51242323fa4..be02856640a 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -11,6 +11,17 @@ var/list/forbidden_varedit_object_types = list( src.modify_variables(O) //feedback_add_details("admin_verb","EDITV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/client/proc/cmd_modify_ref_variables(var/target as text) + set category = "Debug" + set name = "Edit Variables (Reference)" + set desc="(target) Edit a target item's variables" + var/obj/I = locate(target) + if(!I) + usr << "ERROR: Object could not be located!" + return + src.modify_variables(I) + //feedback_add_details("admin_verb","EDITV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + /client/proc/cmd_modify_ticker_variables() set category = "Debug" set name = "Edit Ticker Variables" diff --git a/code/modules/mob/organ/organ.dm b/code/modules/mob/organ/organ.dm index bc0d6ac5c77..5d992667129 100644 --- a/code/modules/mob/organ/organ.dm +++ b/code/modules/mob/organ/organ.dm @@ -477,28 +477,21 @@ proc/start_close() if(parent.robot) return - sleep(rand(1800,3000)) //3-5 minutes - if(prob(50) && wound_size == 1) - parent.wounds.Remove(src) - update_health(1) - del(src) - else if(prob(33) && wound_size < 3) - stopbleeding() - return - sleep(rand(1800,3000)) - if(wound_size == 1) //Small cuts heal in 6-10 minutes. - parent.wounds.Remove(src) - update_health(1) - del(src) - else if(prob(50) && wound_size < 5 && bleeding) - stopbleeding() - return - if(wound_size < 5 && bleeding) //Give it a chance to stop bleeding on it's own. - spawn while(1) - sleep(1200) - if(prob(50)) - stopbleeding() - return + spawn(rand(1800,3000)) //3-5 minutes + if(prob(50) && wound_size == 1) + parent.wounds.Remove(src) + update_health(1) + del(src) + else if(prob(33) && wound_size < 3) + stopbleeding() + else + spawn(rand(1800,3000)) + if(wound_size == 1) //Small cuts heal in 6-10 minutes. + parent.wounds.Remove(src) + update_health(1) + del(src) + else if(prob(50) && wound_size < 3 && bleeding) + stopbleeding() return proc/stopbleeding(var/bleed = 0) @@ -518,60 +511,60 @@ return 1 proc/become_scar() - if(parent.robot) + if(parent.robot || healing_state) return healing_state = 1 //Patched spawn(200*slowheal) //~20-60 seconds update_health(5) //Heals some. - sleep(rand(1800,3000)*slowheal) //3-5 minutes - - if(!parent || !parent.owner || parent.owner.stat == 2) - if(!parent || !parent.owner) - del(parent) + spawn(rand(180,300)*slowheal) //18-30 second + if(!parent || !parent.owner || parent.owner.stat == 2) + if(!parent || !parent.owner) + del(parent) + del(src) + return + if(prob(80) && wound_size < 2) //Small cuts heal. + update_health(1) + parent.wounds.Remove(src) del(src) - return - if(prob(80) && wound_size < 2) //Small cuts heal. - update_health(1) - parent.wounds.Remove(src) - del(src) - healing_state = 2 //Noticibly healing. - update_health(2) //Heals more. + healing_state = 2 //Noticibly healing. + update_health(2) //Heals more. - sleep(rand(1800,3000)*slowheal) //3-5 minutes - if(!parent || !parent.owner || parent.owner.stat == 2) - if(!parent || !parent.owner) - del(parent) - del(src) - return - if(prob(60) && wound_size < 3) //Cuts heal up - parent.wounds.Remove(src) - del(src) - healing_state = 3 //Angry red scar - update_health(1) //Heals the rest of the way. + spawn(rand(1200,1800)*slowheal) //2-3 minutes + if(!parent || !parent.owner || parent.owner.stat == 2) + if(!parent || !parent.owner) + del(parent) + del(src) + return + if(prob(60) && wound_size < 3) //Cuts heal up + parent.wounds.Remove(src) + del(src) + healing_state = 3 //Angry red scar + update_health(1) //Heals the rest of the way. - sleep(rand(6000,9000)*slowheal) //10-15 minutes - if(!parent || !parent.owner || parent.owner.stat == 2) - if(!parent || !parent.owner) - del(parent) - del(src) - return - if(prob(80) && wound_size < 4) //Minor wounds heal up fully. - parent.wounds.Remove(src) - del(src) - healing_state = 4 //Scar - sleep(rand(6000,9000)*slowheal) //10-15 minutes - if(!parent || !parent.owner || parent.owner.stat == 2) - if(!parent || !parent.owner) - del(parent) - del(src) - return - if(prob(30) || wound_size < 4 || wound_type == 1) //Small chance for the scar to disappear, any small remaining wounds deleted. - parent.wounds.Remove(src) - del(src) - healing_state = 5 //Faded scar + spawn(rand(6000,9000)*slowheal) //10-15 minutes + if(!parent || !parent.owner || parent.owner.stat == 2) + if(!parent || !parent.owner) + del(parent) + del(src) + return + if(prob(80) && wound_size < 4) //Minor wounds heal up fully. + parent.wounds.Remove(src) + del(src) + healing_state = 4 //Scar. + + spawn(rand(6000,9000)*slowheal) //10-15 minutes + if(!parent || !parent.owner || parent.owner.stat == 2) + if(!parent || !parent.owner) + del(parent) + del(src) + return + if(prob(30) || wound_size < 4 || wound_type == 1) //Small chance for the scar to disappear, any small remaining wounds deleted. + parent.wounds.Remove(src) + del(src) + healing_state = 5 //Faded scar return proc/update_health(var/percent = 1) @@ -584,6 +577,9 @@ parent.brute_dam = max(parent.brute_dam - (initial_dmg - damage),0) initial_dmg = damage //reset it for further updates. parent.owner.updatehealth() + if(percent == 1 && wound_type == 1) + parent.wounds.Remove(src) + del(src)