mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-24 05:36:57 +01:00
Implementing tranquilizer rifle and pistols.
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
// Hit by a projectile.
|
||||
/mob/living/simple_mob/bullet_act(var/obj/item/projectile/P)
|
||||
//Projectiles with bonus SA damage
|
||||
if(!P.nodamage)
|
||||
// if(!P.SA_vulnerability || P.SA_vulnerability == intelligence_level)
|
||||
if(P.SA_vulnerability & mob_class)
|
||||
P.damage += P.SA_bonus_damage
|
||||
P.damage += P.apply_SA_vulnerability(src)
|
||||
. = ..()
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
//Should we be dead?
|
||||
/mob/living/simple_mob/updatehealth()
|
||||
var/lasthealth = health
|
||||
health = getMaxHealth() - getFireLoss() - getBruteLoss() - getToxLoss() - getOxyLoss() - getCloneLoss()
|
||||
|
||||
//Alive, becoming dead
|
||||
@@ -33,26 +34,30 @@
|
||||
health = getMaxHealth()
|
||||
|
||||
//Update our hud if we have one
|
||||
if(healths)
|
||||
if(stat != DEAD)
|
||||
var/heal_per = (health / getMaxHealth()) * 100
|
||||
switch(heal_per)
|
||||
if(100 to INFINITY)
|
||||
healths.icon_state = "health0"
|
||||
if(80 to 100)
|
||||
healths.icon_state = "health1"
|
||||
if(60 to 80)
|
||||
healths.icon_state = "health2"
|
||||
if(40 to 60)
|
||||
healths.icon_state = "health3"
|
||||
if(20 to 40)
|
||||
healths.icon_state = "health4"
|
||||
if(0 to 20)
|
||||
healths.icon_state = "health5"
|
||||
else
|
||||
healths.icon_state = "health6"
|
||||
else
|
||||
healths.icon_state = "health7"
|
||||
if(lasthealth != health)
|
||||
if(lasthealth > health && sleeping) // Damage wakes us up.
|
||||
tranq_countdown = 0
|
||||
SetSleeping(0)
|
||||
if(healths)
|
||||
if(stat != DEAD)
|
||||
var/heal_per = (health / getMaxHealth()) * 100
|
||||
switch(heal_per)
|
||||
if(100 to INFINITY)
|
||||
healths.icon_state = "health0"
|
||||
if(80 to 100)
|
||||
healths.icon_state = "health1"
|
||||
if(60 to 80)
|
||||
healths.icon_state = "health2"
|
||||
if(40 to 60)
|
||||
healths.icon_state = "health3"
|
||||
if(20 to 40)
|
||||
healths.icon_state = "health4"
|
||||
if(0 to 20)
|
||||
healths.icon_state = "health5"
|
||||
else
|
||||
healths.icon_state = "health6"
|
||||
else
|
||||
healths.icon_state = "health7"
|
||||
|
||||
//Updates the nutrition while we're here
|
||||
var/food_per = (nutrition / max_nutrition) * 100
|
||||
|
||||
@@ -163,6 +163,11 @@
|
||||
// Used for if the mob can drop limbs. Overrides the icon cache key, so it doesn't keep remaking the icon needlessly.
|
||||
var/limb_icon_key
|
||||
|
||||
/// If above zero, decrement in Life(); on zero, put the mob to sleep for thirty seconds.
|
||||
var/tranq_countdown = 0
|
||||
/// A temporary storage value for the duration of any tranquilizer effect.
|
||||
var/tranq_duration
|
||||
|
||||
/mob/living/simple_mob/Initialize()
|
||||
verbs -= /mob/verb/observe
|
||||
health = maxHealth
|
||||
@@ -288,3 +293,17 @@
|
||||
|
||||
/decl/mob_organ_names
|
||||
var/list/hit_zones = list("body") //When in doubt, it's probably got a body.
|
||||
|
||||
/mob/living/simple_mob/handle_sleeping()
|
||||
if(sleeping || stat != CONSCIOUS)
|
||||
tranq_countdown = null
|
||||
tranq_duration = null
|
||||
else if(tranq_countdown > 0)
|
||||
tranq_countdown--
|
||||
if(tranq_countdown <= 0)
|
||||
if(client)
|
||||
to_chat(src, SPAN_DANGER("You fall asleep!"))
|
||||
SetSleeping(max(1, round(tranq_duration / SSmobs.wait)))
|
||||
else if(prob(5) && client)
|
||||
to_chat(src, SPAN_WARNING("You feel [pick("dizzy", "woozy", "sleepy")]..."))
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user