mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 02:24:11 +01:00
Code effeciency project: handle_embedded_objects
Before: EVERYTIME someone moved their character this proc would be called and loop through every organ looking for implanted items to see if it needs to apply damage. After: We create a flag that is set when an item embeddes, only when that flag is set do we do that loop through organs upon movement. Also every 10 ticks while that flag is set we will check to see if we need to unset it. Conflicts: code/modules/mob/living/carbon/human/human_damage.dm
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
icon_state = "body_m_s"
|
||||
var/list/hud_list = list()
|
||||
var/datum/species/species //Contains icon generation and language information, set during New().
|
||||
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
|
||||
|
||||
/mob/living/carbon/human/dummy
|
||||
real_name = "Test Dummy"
|
||||
|
||||
@@ -251,6 +251,7 @@
|
||||
if(!istype(W, /obj/item/weapon/butch/meatcleaver))
|
||||
organ.implants += W
|
||||
visible_message("<span class='danger'>\The [W] sticks in the wound!</span>")
|
||||
embedded_flag = 1
|
||||
src.verbs += /mob/proc/yank_out_object
|
||||
W.add_blood(src)
|
||||
if(ismob(W.loc))
|
||||
@@ -273,4 +274,4 @@
|
||||
if(prob(60))
|
||||
step_rand(H)
|
||||
if(!stat)
|
||||
src << "<span class='warning'>Your [H] fell off!</span>"
|
||||
src << "<span class='warning'>Your [H] fell off!</span>"
|
||||
|
||||
@@ -100,6 +100,7 @@ emp_act
|
||||
(SP.loc) = organ
|
||||
organ.implants += SP
|
||||
visible_message("<span class='danger'>The projectile sticks in the wound!</span>")
|
||||
embedded_flag = 1
|
||||
src.verbs += /mob/proc/yank_out_object
|
||||
SP.add_blood(src)
|
||||
return (..(P , def_zone))
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything
|
||||
|
||||
handle_embedded_objects() //Moving with objects stuck in you can cause bad times.
|
||||
if(embedded_flag)
|
||||
handle_embedded_objects() //Moving with objects stuck in you can cause bad times.
|
||||
|
||||
if(reagents.has_reagent("hyperzine")) return -1
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
handle_environment(environment)
|
||||
|
||||
//Status updates, death etc.
|
||||
handle_regular_status_updates() //TODO: optimise ~Carn
|
||||
handle_regular_status_updates() //TODO: optimise ~Carn NO SHIT ~Ccomp
|
||||
update_canmove()
|
||||
|
||||
//Update our name based on whether our face is obscured/disfigured
|
||||
@@ -1146,6 +1146,13 @@
|
||||
if(halloss > 0)
|
||||
adjustHalLoss(-1)
|
||||
|
||||
if(embedded_flag && !(life_tick % 10))
|
||||
var/list/E
|
||||
E = get_visible_implants(0)
|
||||
if(!E.len)
|
||||
embedded_flag = 0
|
||||
|
||||
|
||||
//Eyes
|
||||
if(sdisabilities & BLIND) //disabled-blind, doesn't get better on its own
|
||||
blinded = 1
|
||||
|
||||
Reference in New Issue
Block a user