mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Traits framework (#12548)
This commit is contained in:
committed by
variableundefined
parent
c2a963d7a8
commit
d6a6debf94
@@ -1,5 +1,8 @@
|
||||
/mob/living/carbon/alien/humanoid/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return FALSE
|
||||
..(user, TRUE)
|
||||
adjustBruteLoss(15)
|
||||
var/hitverb = "punched"
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
/mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return FALSE
|
||||
..(user, TRUE)
|
||||
adjustBruteLoss(5 + rand(1, 9))
|
||||
spawn(0)
|
||||
|
||||
@@ -582,6 +582,9 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
|
||||
qdel(G) //We delete the grab.
|
||||
if(throwable_mob)
|
||||
thrown_thing = throwable_mob
|
||||
if(HAS_TRAIT(src, TRAIT_PACIFISM))
|
||||
to_chat(src, "<span class='notice'>You gently let go of [throwable_mob].</span>")
|
||||
return
|
||||
var/turf/start_T = get_turf(loc) //Get the start and target tile for the descriptors
|
||||
var/turf/end_T = get_turf(target)
|
||||
throwable_mob.forceMove(start_T)
|
||||
@@ -595,6 +598,10 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
|
||||
thrown_thing = I
|
||||
unEquip(I)
|
||||
|
||||
if(HAS_TRAIT(src, TRAIT_PACIFISM) && I.throwforce)
|
||||
to_chat(src, "<span class='notice'>You set [I] down gently on the ground.</span>")
|
||||
return
|
||||
|
||||
if(thrown_thing)
|
||||
visible_message("<span class='danger'>[src] has thrown [thrown_thing].</span>")
|
||||
newtonian_move(get_dir(target, src))
|
||||
|
||||
@@ -510,6 +510,9 @@ emp_act
|
||||
|
||||
/mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return FALSE
|
||||
var/hulk_verb = pick("smash", "pummel")
|
||||
if(check_shields(user, 15, "the [hulk_verb]ing"))
|
||||
return
|
||||
@@ -616,6 +619,9 @@ emp_act
|
||||
|
||||
/mob/living/carbon/human/mech_melee_attack(obj/mecha/M)
|
||||
if(M.occupant.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(M.occupant, TRAIT_PACIFISM))
|
||||
to_chat(M.occupant, "<span class='warning'>You don't want to harm other living beings!</span>")
|
||||
return
|
||||
M.do_attack_animation(src)
|
||||
if(M.damtype == "brute")
|
||||
step_away(src,M,15)
|
||||
|
||||
@@ -393,6 +393,9 @@
|
||||
return TRUE
|
||||
|
||||
/datum/species/proc/harm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to harm [target]!</span>")
|
||||
return FALSE
|
||||
//Vampire code
|
||||
if(user.mind && user.mind.vampire && (user.mind in SSticker.mode.vampires) && !user.mind.vampire.draining && user.zone_selected == "head" && target != user)
|
||||
if((NO_BLOOD in target.dna.species.species_traits) || target.dna.species.exotic_blood || !target.blood_volume)
|
||||
|
||||
@@ -124,6 +124,9 @@
|
||||
|
||||
/mob/living/mech_melee_attack(obj/mecha/M)
|
||||
if(M.occupant.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(M.occupant, TRAIT_PACIFISM))
|
||||
to_chat(M.occupant, "<span class='warning'>You don't want to harm other living beings!</span>")
|
||||
return
|
||||
M.do_attack_animation(src)
|
||||
if(M.damtype == "brute")
|
||||
step_away(src,M,15)
|
||||
@@ -288,6 +291,10 @@
|
||||
M.Feedstop()
|
||||
return // can't attack while eating!
|
||||
|
||||
if(HAS_TRAIT(src, TRAIT_PACIFISM))
|
||||
to_chat(M, "<span class='warning'>You don't want to hurt anyone!</span>")
|
||||
return FALSE
|
||||
|
||||
if(stat != DEAD)
|
||||
add_attack_logs(src, M, "Slime'd")
|
||||
M.do_attack_animation(src)
|
||||
@@ -299,6 +306,10 @@
|
||||
if((M.a_intent == INTENT_HELP && M.ckey) || M.melee_damage_upper == 0)
|
||||
M.custom_emote(1, "[M.friendly] [src].")
|
||||
return FALSE
|
||||
if(HAS_TRAIT(M, TRAIT_PACIFISM))
|
||||
to_chat(M, "<span class='warning'>You don't want to hurt anyone!</span>")
|
||||
return FALSE
|
||||
|
||||
if(M.attack_sound)
|
||||
playsound(loc, M.attack_sound, 50, 1, 1)
|
||||
M.do_attack_animation(src)
|
||||
@@ -314,6 +325,10 @@
|
||||
return 0
|
||||
|
||||
else
|
||||
if(HAS_TRAIT(L, TRAIT_PACIFISM))
|
||||
to_chat(L, "<span class='warning'>You don't want to hurt anyone!</span>")
|
||||
return
|
||||
|
||||
L.do_attack_animation(src)
|
||||
if(prob(90))
|
||||
add_attack_logs(L, src, "Larva attacked")
|
||||
@@ -335,6 +350,9 @@
|
||||
grabbedby(M)
|
||||
return FALSE
|
||||
if(INTENT_HARM)
|
||||
if(HAS_TRAIT(M, TRAIT_PACIFISM))
|
||||
to_chat(M, "<span class='warning'>You don't want to hurt anyone!</span>")
|
||||
return FALSE
|
||||
M.do_attack_animation(src)
|
||||
return TRUE
|
||||
if(INTENT_DISARM)
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
|
||||
/mob/living/silicon/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return FALSE
|
||||
..(user, TRUE)
|
||||
adjustBruteLoss(rand(10, 15))
|
||||
playsound(loc, "punch", 25, 1, -1)
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
grabbedby(M)
|
||||
|
||||
if(INTENT_HARM, INTENT_DISARM)
|
||||
if(HAS_TRAIT(M, TRAIT_PACIFISM))
|
||||
to_chat(M, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return
|
||||
M.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
|
||||
visible_message("<span class='danger'>[M] [response_harm] [src]!</span>", "<span class='userdanger'>[M] [response_harm] you!</span>")
|
||||
playsound(loc, attacked_sound, 25, 1, -1)
|
||||
@@ -28,6 +31,9 @@
|
||||
|
||||
/mob/living/simple_animal/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return FALSE
|
||||
..(user, TRUE)
|
||||
playsound(loc, "punch", 25, 1, -1)
|
||||
visible_message("<span class='danger'>[user] has punched [src]!</span>", "<span class='userdanger'>[user] has punched [src]!</span>")
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/mob/living/simple_animal/hostile/retaliate/poison
|
||||
var/poison_per_bite = 0
|
||||
var/poison_type = "toxin"
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/poison/AttackingTarget()
|
||||
. = ..()
|
||||
if(. && isliving(target))
|
||||
var/mob/living/L = target
|
||||
if(L.reagents && !poison_per_bite == 0)
|
||||
L.reagents.add_reagent(poison_type, poison_per_bite)
|
||||
return .
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/poison/snake
|
||||
name = "snake"
|
||||
desc = "A slithery snake. These legless reptiles are the bane of mice and adventurers alike."
|
||||
icon_state = "snake"
|
||||
icon_living = "snake"
|
||||
icon_dead = "snake_dead"
|
||||
speak_emote = list("hisses")
|
||||
health = 20
|
||||
maxHealth = 20
|
||||
attacktext = "bites"
|
||||
melee_damage_lower = 5
|
||||
melee_damage_upper = 6
|
||||
response_help = "pets"
|
||||
response_disarm = "shoos"
|
||||
response_harm = "steps on"
|
||||
faction = list("hostile")
|
||||
ventcrawler = VENTCRAWLER_ALWAYS
|
||||
density = FALSE
|
||||
pass_flags = PASSTABLE | PASSMOB
|
||||
mob_size = MOB_SIZE_SMALL
|
||||
gold_core_spawnable = FRIENDLY_SPAWN
|
||||
obj_damage = 0
|
||||
environment_smash = ENVIRONMENT_SMASH_NONE
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/poison/snake/ListTargets(atom/the_target)
|
||||
. = oview(vision_range, targets_from) //get list of things in vision range
|
||||
var/list/living_mobs = list()
|
||||
var/list/mice = list()
|
||||
for(var/HM in .)
|
||||
//Yum a tasty mouse
|
||||
if(istype(HM, /mob/living/simple_animal/mouse))
|
||||
mice += HM
|
||||
if(isliving(HM))
|
||||
living_mobs += HM
|
||||
|
||||
// if no tasty mice to chase, lets chase any living mob enemies in our vision range
|
||||
if(length(mice) == 0)
|
||||
//Filter living mobs (in range mobs) by those we consider enemies (retaliate behaviour)
|
||||
return living_mobs & enemies
|
||||
return mice
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/poison/snake/AttackingTarget()
|
||||
if(istype(target, /mob/living/simple_animal/mouse))
|
||||
visible_message("<span class='notice'>[name] consumes [target] in a single gulp!</span>", "<span class='notice'>You consume [target] in a single gulp!</span>")
|
||||
QDEL_NULL(target)
|
||||
adjustHealth(-2)
|
||||
else
|
||||
return ..()
|
||||
@@ -42,45 +42,4 @@
|
||||
if(prob(15) && iscarbon(target))
|
||||
var/mob/living/carbon/C = target
|
||||
C.Weaken(3)
|
||||
C.visible_message("<span class='danger'>\the [src] knocks down \the [C]!</span>")
|
||||
|
||||
//*******//
|
||||
// Snake //
|
||||
//*******//
|
||||
|
||||
/mob/living/simple_animal/hostile/snake
|
||||
name = "snake"
|
||||
desc = "A sinuously coiled, venomous looking reptile."
|
||||
icon_state = "snake"
|
||||
icon_living = "snake"
|
||||
icon_dead = "snake_dead"
|
||||
icon_gib = "snake_dead"
|
||||
speak_chance = 0
|
||||
turns_per_move = 1
|
||||
butcher_results = list(/obj/item/reagent_containers/food/snacks/meat = 2)
|
||||
response_help = "pets the"
|
||||
response_disarm = "gently pushes aside the"
|
||||
response_harm = "hits the"
|
||||
stop_automated_movement_when_pulled = 0
|
||||
maxHealth = 25
|
||||
health = 25
|
||||
|
||||
emote_taunt = list("hisses wickedly")
|
||||
taunt_chance = 20
|
||||
|
||||
harm_intent_damage = 2
|
||||
melee_damage_lower = 3
|
||||
melee_damage_upper = 10
|
||||
attacktext = "bites"
|
||||
attack_sound = 'sound/weapons/bite.ogg'
|
||||
|
||||
layer = 3.1 //so they can stay hidde under the /obj/structure/bush
|
||||
var/stalk_tick_delay = 3
|
||||
gold_core_spawnable = HOSTILE_SPAWN
|
||||
|
||||
/mob/living/simple_animal/hostile/snake/AttackingTarget()
|
||||
. =..()
|
||||
if(.)
|
||||
if(iscarbon(target))
|
||||
var/mob/living/carbon/C = target
|
||||
C.apply_damage(rand(3, 12), TOX)
|
||||
C.visible_message("<span class='danger'>\the [src] knocks down \the [C]!</span>")
|
||||
@@ -299,6 +299,9 @@
|
||||
|
||||
/mob/living/simple_animal/slime/attack_hulk(mob/living/carbon/human/user)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='warning'>You don't want to hurt [src]!</span>")
|
||||
return FALSE
|
||||
discipline_slime(user)
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
layer = MOB_LAYER
|
||||
animate_movement = 2
|
||||
pressure_resistance = 8
|
||||
throwforce = 10
|
||||
dont_save = TRUE //to avoid it messing up in buildmode saving
|
||||
var/datum/mind/mind
|
||||
|
||||
|
||||
@@ -139,8 +139,9 @@
|
||||
hud.icon_state = "!reinforce"
|
||||
|
||||
if(state >= GRAB_AGGRESSIVE)
|
||||
affecting.drop_r_hand()
|
||||
affecting.drop_l_hand()
|
||||
if(!HAS_TRAIT(assailant, TRAIT_PACIFISM))
|
||||
affecting.drop_r_hand()
|
||||
affecting.drop_l_hand()
|
||||
|
||||
|
||||
//var/announce = 0
|
||||
@@ -235,6 +236,9 @@
|
||||
/obj/item/grab/proc/s_click(obj/screen/S)
|
||||
if(!affecting)
|
||||
return
|
||||
if(state >= GRAB_AGGRESSIVE && HAS_TRAIT(assailant, TRAIT_PACIFISM))
|
||||
to_chat(assailant, "<span class='warning'>You don't want to risk hurting [affecting]!</span>")
|
||||
return
|
||||
if(state == GRAB_UPGRADING)
|
||||
return
|
||||
if(assailant.next_move > world.time)
|
||||
|
||||
Reference in New Issue
Block a user