Mob size tweaks.

Merges the use of the is_small and mob_size into one.
Changes the species size handling to set the mob size instead of being yet another separate var to check.
This commit is contained in:
PsiOmegaDelta
2015-09-20 17:12:07 +02:00
parent 292c1545cb
commit d891fba1cc
33 changed files with 57 additions and 62 deletions

View File

@@ -107,3 +107,10 @@
#define COMPANY_ALIGNMENTS list(COMPANY_LOYAL,COMPANY_SUPPORTATIVE,COMPANY_NEUTRAL,COMPANY_SKEPTICAL,COMPANY_OPPOSED)
// Defines mob sizes, used by lockers and to determine what is considered a small sized mob, etc.
#define MOB_LARGE 40
#define MOB_MEDIUM 20
#define MOB_SMALL 10
#define MOB_TINY 5
#define MOB_MINISCULE 1

View File

@@ -99,7 +99,7 @@
var/mob/M = AM
if(world.time - M.last_bumped <= 10) return //Can bump-open one airlock per second. This is to prevent shock spam.
M.last_bumped = world.time
if(!M.restrained() && !M.small)
if(!M.restrained() && !issmall(M))
bumpopen(M)
return

View File

@@ -77,7 +77,7 @@
return
if (src.operating)
return
if (src.density && !M.small && src.allowed(AM))
if (src.density && !issmall(M) && src.allowed(AM))
open()
if(src.check_access(null))
sleep(50)

View File

@@ -43,7 +43,7 @@ var/list/floor_light_cache = list()
/obj/machinery/floor_light/attack_hand(var/mob/user)
if(user.a_intent == "hurt" && !user.small)
if(user.a_intent == I_HURT && !issmall(user))
if(!isnull(damaged) && !(stat & BROKEN))
visible_message("<span class='danger'>\The [user] smashes \the [src]!</span>")
playsound(src, "shatter", 70, 1)

View File

@@ -88,7 +88,7 @@
emagged = !emagged
user << "<span class='danger'>You [emagged ? "disable" : "enable"] the gibber safety guard.</span>"
return 1
/obj/machinery/gibber/attackby(var/obj/item/W, var/mob/user)
var/obj/item/weapon/grab/G = W
@@ -195,7 +195,7 @@
slab_type = H.species.meat_type
// Small mobs don't give as much nutrition.
if(src.occupant.small)
if(issmall(src.occupant))
slab_nutrition *= 0.5
slab_nutrition /= slab_count

View File

@@ -39,7 +39,7 @@
close_sound = 'sound/items/zip.ogg'
var/item_path = /obj/item/bodybag
density = 0
storage_capacity = (default_mob_size * 2) - 1
storage_capacity = (MOB_MEDIUM * 2) - 1
var/contains_body = 0
/obj/structure/closet/body_bag/attackby(W as obj, mob/user as mob)

View File

@@ -92,7 +92,7 @@
if(istype(user, /mob/living/carbon/human))
var/mob/living/carbon/human/H = user
if(H.species.is_small)
if(issmall(H))
user << "<span class='warning'>It's too heavy for you to wield fully.</span>"
return
else
@@ -175,7 +175,7 @@
else if(istype(A,/obj/effect/plant))
var/obj/effect/plant/P = A
P.die_off()
//spears, bay edition
/obj/item/weapon/material/twohanded/spear
icon_state = "spearglass0"

View File

@@ -9,7 +9,7 @@
name = master_item.name
verbs -= /obj/item/verb/verb_pickup //make sure this is never picked up.
..()
/obj/item/weapon/storage/internal/Destroy()
master_item = null
..()

View File

@@ -11,7 +11,7 @@
var/wall_mounted = 0 //never solid (You can always pass over it)
var/health = 100
var/breakout = 0 //if someone is currently breaking out. mutex
var/storage_capacity = 30 //This is so that someone can't pack hundreds of items in a locker/crate
var/storage_capacity = 2 * MOB_MEDIUM //This is so that someone can't pack hundreds of items in a locker/crate
//then open it in a populated area to crash clients.
var/open_sound = 'sound/machines/click.ogg'
var/close_sound = 'sound/machines/click.ogg'
@@ -20,8 +20,6 @@
var/store_items = 1
var/store_mobs = 1
var/const/default_mob_size = 15
/obj/structure/closet/initialize()
if(!opened) // if closed, any item at the crate's loc is put in the contents
var/obj/item/I
@@ -145,14 +143,13 @@
for(var/mob/living/M in src.loc)
if(M.buckled || M.pinned.len)
continue
var/current_mob_size = (M.mob_size ? M.mob_size : default_mob_size)
if(stored_units + added_units + current_mob_size > storage_capacity)
if(stored_units + added_units + M.mob_size > storage_capacity)
break
if(M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.forceMove(src)
added_units += current_mob_size
added_units += M.mob_size
return added_units
/obj/structure/closet/proc/toggle(mob/user as mob)

View File

@@ -32,7 +32,7 @@
if(istype(victim, /mob/living/carbon/human))
var/mob/living/carbon/human/H = victim
if(!H.species.is_small)
if(!issmall(H))
return 0
meat_type = H.species.meat_type
icon_state = "spikebloody"

View File

@@ -70,11 +70,7 @@ var/list/mechtoys = list(
for(var/mob_type in mobs_can_pass)
if(istype(A, mob_type))
return ..()
if(istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.is_small)
return ..()
return 0
return issmall(M)
return ..()

View File

@@ -7,7 +7,7 @@
if(!istype(M))
return
if(!buckled_mob && !M.buckled && !M.anchored && (M.small || prob(round(seed.get_trait(TRAIT_POTENCY)/6))))
if(!buckled_mob && !M.buckled && !M.anchored && (issmall(M) || prob(round(seed.get_trait(TRAIT_POTENCY)/6))))
//wait a tick for the Entered() proc that called HasProximity() to finish (and thus the moving animation),
//so we don't appear to teleport from two tiles away when moving into a turf adjacent to vines.
spawn(1)

View File

@@ -701,21 +701,21 @@
/mob/living/carbon/human/proc/headcheck(var/target_zone, var/brain_tag = "brain")
if(!species.has_organ[brain_tag])
return 0
var/obj/item/organ/affecting = internal_organs_by_name[brain_tag]
target_zone = check_zone(target_zone)
if(!affecting || affecting.parent_organ != target_zone)
return 0
//if the parent organ is significantly larger than the brain organ, then hitting it is not guaranteed
var/obj/item/organ/parent = get_organ(target_zone)
if(!parent)
return 0
if(parent.w_class > affecting.w_class + 1)
return prob(100 / 2**(parent.w_class - affecting.w_class - 1))
return 1
/mob/living/carbon/human/IsAdvancedToolUser(var/silent)

View File

@@ -28,7 +28,7 @@
var/tail_hair
var/race_key = 0 // Used for mob icon cache string.
var/icon/icon_template // Used for mob icon generation for non-32x32 species.
var/is_small
var/mob_size = MOB_MEDIUM
var/show_ssd = "fast asleep"
var/virus_immune
var/short_sighted
@@ -285,6 +285,7 @@
H.mob_swap_flags = swap_flags
H.mob_push_flags = push_flags
H.pass_flags = pass_flags
H.mob_size = mob_size
/datum/species/proc/handle_death(var/mob/living/carbon/human/H) //Handles any species-specific death events (such as dionaea nymph spawns).
return

View File

@@ -11,7 +11,7 @@
language = null
default_language = "Chimpanzee"
greater_form = "Human"
is_small = 1
mob_size = MOB_SMALL
has_fine_manipulation = 0
show_ssd = null

View File

@@ -27,7 +27,7 @@
total_health = 50
brute_mod = 1.35
burn_mod = 1.35
is_small = 1
mob_size = MOB_SMALL
holder_type = /obj/item/weapon/holder/human
short_sighted = 1
gluttonous = 1

View File

@@ -1,7 +1,7 @@
/datum/species/slime
name = "Slime"
name_plural = "slimes"
is_small = 1
mob_size = MOB_SMALL
icobase = 'icons/mob/human_races/r_slime.dmi'
deform = 'icons/mob/human_races/r_slime.dmi'

View File

@@ -39,10 +39,7 @@
var/tod = null // Time of death
var/update_slimes = 1
var/silent = null // Can't talk. Value goes down every life proc.
var/mob_size // Used by lockers.
var/on_fire = 0 //The "Are we on fire?" var
var/fire_stacks
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.

View File

@@ -4,8 +4,8 @@
icon_state = "repairbot"
emote_type = 2 // pAIs emotes are heard, not seen, so they can be seen through a container (eg. person)
small = 1
pass_flags = 1
mob_size = MOB_SMALL
var/network = "SS13"
var/obj/machinery/camera/current = null

View File

@@ -42,6 +42,8 @@ var/list/mob_hat_cache = list()
mob_push_flags = SIMPLE_ANIMAL
mob_always_swap = 1
mob_size = MOB_TINY
//Used for self-mailing.
var/mail_destination = ""
var/obj/machinery/drone_fabricator/master_fabricator
@@ -68,6 +70,7 @@ var/list/mob_hat_cache = list()
can_pull_mobs = 1
hat_x_offset = 1
hat_y_offset = -12
mob_size = MOB_SMALL
/mob/living/silicon/robot/drone/New()

View File

@@ -98,7 +98,7 @@
melee_damage_lower = 30
melee_damage_upper = 30
attacktext = "smashed their armoured gauntlet into"
mob_size = 20
mob_size = MOB_LARGE
speed = 3
environment_smash = 2
attack_sound = 'sound/weapons/heavysmash.ogg'

View File

@@ -23,7 +23,7 @@
minbodytemp = 223 //Below -50 Degrees Celcius
maxbodytemp = 323 //Above 50 Degrees Celcius
holder_type = /obj/item/weapon/holder/cat
mob_size = 5
mob_size = MOB_SMALL
/mob/living/simple_animal/cat/Life()
//MICE!

View File

@@ -5,7 +5,7 @@
icon_state = "crab"
icon_living = "crab"
icon_dead = "crab_dead"
small = 1
mob_size = MOB_SMALL
speak_emote = list("clicks")
emote_hear = list("clicks")
emote_see = list("clacks")

View File

@@ -55,9 +55,9 @@
if(!pulledby)
var/obj/effect/plant/food
food = locate(/obj/effect/plant) in oview(5,loc)
food = locate(/obj/effect/plant) in oview(5,loc)
if(food)
var/step = get_step_to(src, food, 0)
var/step = get_step_to(src, food, 0)
Move(step)
/mob/living/simple_animal/hostile/retaliate/goat/Retaliate()
@@ -167,7 +167,7 @@
health = 1
var/amount_grown = 0
pass_flags = PASSTABLE | PASSGRILLE
small = 1
mob_size = MOB_MINISCULE
/mob/living/simple_animal/chick/New()
..()
@@ -209,7 +209,7 @@ var/global/chicken_count = 0
var/eggsleft = 0
var/body_color
pass_flags = PASSTABLE
small = 1
mob_size = MOB_SMALL
/mob/living/simple_animal/chicken/New()
..()

View File

@@ -5,7 +5,6 @@
icon_state = "lizard"
icon_living = "lizard"
icon_dead = "lizard-dead"
small = 1
speak_emote = list("hisses")
health = 5
maxHealth = 5
@@ -15,4 +14,4 @@
response_help = "pets"
response_disarm = "shoos"
response_harm = "stomps on"
mob_size = 1
mob_size = MOB_MINISCULE

View File

@@ -10,7 +10,6 @@
emote_hear = list("squeeks","squeaks","squiks")
emote_see = list("runs in a circle", "shakes", "scritches at something")
pass_flags = PASSTABLE
small = 1
speak_chance = 1
turns_per_move = 5
see_in_dark = 6
@@ -29,7 +28,7 @@
universal_speak = 0
universal_understand = 1
holder_type = /obj/item/weapon/holder/mouse
mob_size = 1
mob_size = MOB_MINISCULE
/mob/living/simple_animal/mouse/Life()
..()

View File

@@ -4,7 +4,7 @@
icon_state = "mushroom"
icon_living = "mushroom"
icon_dead = "mushroom_dead"
small = 1
mob_size = MOB_SMALL
speak_chance = 0
turns_per_move = 1
maxHealth = 5

View File

@@ -5,7 +5,7 @@
max_co2 = 0
minbodytemp = 0
maxbodytemp = 500
mob_size = 5
mob_size = MOB_SMALL
var/obj/item/device/radio/borg/radio = null
var/mob/living/silicon/ai/connected_ai = null
@@ -39,7 +39,6 @@
var/obj/item/held_item = null //Storage for single item they can hold.
speed = -1 //Spiderbots gotta go fast.
pass_flags = PASSTABLE
small = 1
speak_emote = list("beeps","clicks","chirps")
/mob/living/simple_animal/spiderbot/New()
@@ -132,7 +131,7 @@
else
attacked_with_item(O, user)
/mob/living/simple_animal/spiderbot/emag_act(var/remaining_charges, var/mob/user)
if (emagged)
user << "<span class='warning'>[src] is already overloaded - better run.</span>"

View File

@@ -33,7 +33,7 @@
icon_living = "parrot_fly"
icon_dead = "parrot_dead"
pass_flags = PASSTABLE
small = 1
mob_size = MOB_SMALL
speak = list("Hi","Hello!","Cracker?","BAWWWWK george mellons griffing me")
speak_emote = list("squawks","says","yells")

View File

@@ -285,7 +285,7 @@
if(meat_type && (stat == DEAD)) //if the animal has a meat, and if it is dead.
if(istype(O, /obj/item/weapon/material/knife) || istype(O, /obj/item/weapon/material/knife/butch))
harvest(user)
else
else
attacked_with_item(O, user)
//TODO: refactor mob attackby(), attacked_by(), and friends.
@@ -307,7 +307,7 @@
usr << "<span class='danger'>This weapon is ineffective, it does no damage.</span>"
visible_message("<span class='danger'>\The [src] has been attacked with \the [O] by [user].</span>")
user.do_attack_animation(src)
user.do_attack_animation(src)
/mob/living/simple_animal/movement_delay()
var/tally = 0 //Incase I need to add stuff other than "speed" later
@@ -396,7 +396,7 @@
for(var/i=0;i<actual_meat_amount;i++)
var/obj/item/meat = new meat_type(get_turf(src))
meat.name = "[src.name] [meat.name]"
if(small)
if(issmall(src))
user.visible_message("<span class='danger'>[user] chops up \the [src]!</span>")
new/obj/effect/decal/cleanable/blood/splatter(get_turf(src))
qdel(src)

View File

@@ -88,7 +88,6 @@
var/incorporeal_move = 0 //0 is off, 1 is normal, 2 is for ninjas.
var/lastpuke = 0
var/unacidable = 0
var/small = 0
var/list/pinned = list() // List of things pinning this creature to walls (see living_defense.dm)
var/list/embedded = list() // Embedded items, since simple mobs don't have organs.
var/list/languages = list() // For speaking/listening.
@@ -221,5 +220,4 @@
var/list/shouldnt_see = list() //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes
var/list/active_genes=list()
var/mob_size = MOB_MEDIUM

View File

@@ -149,7 +149,7 @@
if(istype(H) && H.species.gluttonous)
if(H.species.gluttonous == 2)
can_eat = 2
else if(!ishuman(target) && !issmall(target) && (target.small || iscarbon(target)))
else if((H.mob_size > target.mob_size) && !ishuman(target) && iscarbon(target))
can_eat = 1
if(can_eat)

View File

@@ -6,10 +6,9 @@
return 0
/proc/issmall(A)
if(A && istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/H = A
if(H.species && H.species.is_small)
return 1
if(A && istype(A, /mob/living))
var/mob/living/L = A
return L.mob_size <= MOB_SMALL
return 0
/mob/living/proc/isSynthetic()