Speed in nograv works correctly now

Dismemberment support added as well as a way to use the limbs of another species for dismemberment for visually identical species
Flying var changed to species flag
This commit is contained in:
Shadowlight213
2016-05-08 16:39:54 -07:00
parent afb7a878d1
commit 9573fdec0e
11 changed files with 75 additions and 82 deletions
+2
View File
@@ -68,6 +68,8 @@
#define MUTCOLORS_PARTSONLY 32768 //Used if we want the mutant colour to be only used by mutant bodyparts. Don't combine this with MUTCOLORS, or it will be useless.
#define FLYING 65536
/*
These defines are used specifically with the atom/movable/languages bitmask.
They are used in atom/movable/Hear() and atom/movable/say() to determine whether hearers can understand a message.
+1 -1
View File
@@ -120,7 +120,7 @@
name = "magic mirror"
desc = "Turn and face the strange... face."
icon_state = "magic_mirror"
var/list/races_blacklist = list("skeleton", "agent")
var/list/races_blacklist = list("skeleton", "agent", "angel")
var/list/choosable_races = list()
/obj/structure/mirror/magic/New()
@@ -990,3 +990,7 @@
if(HM.quality != POSITIVE)
dna.remove_mutation(HM.name)
..()
/mob/living/carbon/human/update_gravity(has_gravity,override = 0)
override = dna.species.override_float
..()
@@ -372,4 +372,4 @@
/mob/living/carbon/human/Stun(amount, updating_canmove = 1)
amount = dna.species.spec_stun(src,amount)
..()
..()
+18 -23
View File
@@ -21,6 +21,7 @@
/datum/species
var/id = null // if the game needs to manually check your race to do something not included in a proc here, it will use this
var/limbs_id = null //this is used if you want to use a different species limb sprites. Mainly used for angels as they look like humans.
var/name = null // this is the fluff name. these will be left generic (such as 'Lizardperson' for the lizard race) so servers can change them to whatever
var/roundstart = 0 // can this mob be chosen at roundstart? (assuming the config option is checked?)
var/default_color = "#FFF" // if alien colors are disabled, this is the color that will be used by that race
@@ -86,11 +87,19 @@
var/has_dismemberment = 1 //Whether or not this species uses dismemberment for its limbs
//Flight and floating
var/override_float = 0
///////////
// PROCS //
///////////
var/flying = 0
/datum/species/New()
if(!limbs_id) //if we havent set a limbs id to use, just use our own id
limbs_id = id
..()
//Called when admins use the Set Species verb, let's species
//do some init stuff on the mob that got SS'd if necessary
@@ -452,7 +461,6 @@
else
icon_string = "m_[bodypart]_[S.icon_state]_[layer]"
world.log << icon_string
I = image("icon" = 'icons/mob/mutant_bodyparts.dmi', "icon_state" = icon_string, "layer" =- layer)
if(!(H.disabilities & HUSK))
@@ -848,6 +856,9 @@
if(!(H.status_flags & IGNORESLOWDOWN))
if(!has_gravity(H))
if(specflags & FLYING)
. += speedmod
return
// If there's no gravity we have the sanic speed of jetpack.
var/obj/item/weapon/tank/jetpack/J = H.back
var/obj/item/clothing/suit/space/hardsuit/C = H.wear_suit
@@ -886,10 +897,11 @@
if(H.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT)
. += (BODYTEMP_COLD_DAMAGE_LIMIT - H.bodytemperature) / COLD_SLOWDOWN_FACTOR
var/leg_amount = H.get_num_legs()
. += 6 - 3*leg_amount //the fewer the legs, the slower the mob
if(!leg_amount)
. += 6 - 3*H.get_num_arms() //crawling is harder with fewer arms
if(!(specflags & FLYING))
var/leg_amount = H.get_num_legs()
. += 6 - 3*leg_amount //the fewer the legs, the slower the mob
if(!leg_amount)
. += 6 - 3*H.get_num_arms() //crawling is harder with fewer arms
. += speedmod
@@ -1471,7 +1483,6 @@
/datum/species/proc/spec_stun(mob/living/carbon/human/H,amount)
. = stunmod * amount
//////////////
//Space Move//
//////////////
@@ -1483,22 +1494,6 @@
return 0
#undef HUMAN_MAX_OXYLOSS
#undef HUMAN_CRIT_MAX_OXYLOSS
@@ -742,41 +742,13 @@ SYNDICATE BLACK OPS
mutant_bodyparts = list("tail_human", "ears", "wings")
default_features = list("mcolor" = "FFF", "tail_human" = "None", "ears" = "None", "wings" = "Angel")
use_skintones = 1
flying = 0
no_equip = list(slot_back)
blacklisted = 1
limbs_id = "human"
skinned_type = /obj/item/stack/sheet/animalhide/human
var/datum/action/innate/flight/fly
/*
/datum/species/human/qualifies_for_rank(rank, list/features)
if((!features["tail_human"] || features["tail_human"] == "None") && (!features["ears"] || features["ears"] == "None"))
return 1 //Pure humans are always allowed in all roles.
//Mutants are not allowed in most roles.
if(rank in security_positions) //This list does not include lawyers.
return 0
if(rank in science_positions)
return 0
if(rank in medical_positions)
return 0
if(rank in engineering_positions)
return 0
if(rank == "Quartermaster") //QM is not contained in command_positions but we still want to bar mutants from it.
return 0
return ..()
/datum/species/human/handle_chemicals(datum/reagent/chem, mob/living/carbon/human/H)
if(chem.id == "mutationtoxin")
H << "<span class='danger'>Your flesh rapidly mutates!</span>"
H.set_species(/datum/species/jelly/slime)
H.reagents.del_reagent(chem.type)
H.faction |= "slime"
return 1
*/
/datum/species/angel/on_species_gain(mob/living/carbon/human/H)
..()
if(H.dna && H.dna.species &&((H.dna.features["wings"] != "Angel") && ("wings" in H.dna.species.mutant_bodyparts)))
@@ -790,7 +762,8 @@ SYNDICATE BLACK OPS
/datum/species/angel/on_species_loss(mob/living/carbon/human/H)
if(fly)
fly.Remove(H)
flying = 0
if(FLYING in specflags)
specflags -= FLYING
ToggleFlight(H,0)
if(H.dna && H.dna.species &&((H.dna.features["wings"] != "None") && ("wings" in H.dna.species.mutant_bodyparts)))
H.dna.features["wings"] = "None"
@@ -801,7 +774,7 @@ SYNDICATE BLACK OPS
HandleFlight(H)
/datum/species/angel/proc/HandleFlight(mob/living/carbon/human/H)
if(flying)
if(FLYING in specflags)
if(!CanFly(H))
ToggleFlight(H,0)
H.float(0)
@@ -812,22 +785,26 @@ SYNDICATE BLACK OPS
H.float(0)
return 0
/datum/species/angel/proc/CanFly(mob/living/carbon/human/H)
if(H.stat || H.stunned || H.weakened)
return 0
if(H.wear_suit && (H.wear_suit.flags_inv & HIDEJUMPSUIT)) //Jumpsuits have tail holes, so it makes sense they have wing holes too
H << "Your suit blocks your wings from extending!"
return 0
var/turf/T = get_turf(H)
if(!T)
return 0
var/datum/gas_mixture/environment = T.return_air()
if(environment && !(environment.return_pressure() > 30))
H << "<span class='warning'>The atmosphere is too thin for you to fly!</span>"
return 0
else
return 1
/datum/action/innate/flight
name = "Toggle Flight"
check_flags = AB_CHECK_CONSCIOUS|AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING
check_flags = AB_CHECK_CONSCIOUS|AB_CHECK_RESTRAINED|AB_CHECK_STUNNED
button_icon_state = "slimesplit"
background_icon_state = "bg_alien"
@@ -835,14 +812,17 @@ SYNDICATE BLACK OPS
var/mob/living/carbon/human/H = owner
var/datum/species/angel/A = H.dna.species
if(A.CanFly(H))
A.flying = !A.flying
if(A.flying)
H << "<span class='notice'>You beat your wings and begin to hover gently above the ground...</span>"
A.ToggleFlight(H,A.flying)
else
if(FLYING in A.specflags)
H << "<span class='notice'>You settle gently back onto the ground...</span>"
A.ToggleFlight(H,A.flying)
A.specflags -= FLYING
A.ToggleFlight(H,0)
H.update_canmove()
else
H << "<span class='notice'>You beat your wings and begin to hover gently above the ground...</span>"
A.specflags += FLYING
H.resting = 0
A.ToggleFlight(H,1)
H.update_canmove()
/datum/species/angel/proc/flyslip(mob/living/carbon/human/H)
var/obj/buckled_obj
@@ -871,27 +851,30 @@ SYNDICATE BLACK OPS
/datum/species/angel/spec_stun(mob/living/carbon/human/H,amount)
if(flying)
if(FLYING in specflags)
flyslip(H)
ToggleFlight(H,0)
..()
. = ..()
/datum/species/angel/negates_gravity()
return flying
if(FLYING in specflags)
return 1
/datum/species/angel/space_move()
return flying
if(FLYING in specflags)
return 1
/datum/species/angel/proc/ToggleFlight(mob/living/carbon/human/H,flight)
if(flight)
flying = 1
if(flight && CanFly(H))
stunmod = 2
speedmod = -1
specflags += FLYING
override_float = 1
H.pass_flags |= PASSTABLE
H.OpenWings()
else
flying = 0
stunmod = 1
speedmod = 0
specflags -= FLYING
override_float = 0
H.pass_flags &= ~PASSTABLE
H.CloseWings()
@@ -583,7 +583,7 @@ var/global/list/limb_icon_cache = list()
//produces a key based on the human's limbs
/mob/living/carbon/human/proc/generate_icon_render_key()
. = "[dna.species.id]"
. = "[dna.species.limbs_id]"
if(dna.check_mutation(HULK))
. += "-coloured-hulk"
+3 -2
View File
@@ -716,14 +716,15 @@ Sorry Giacom. Please don't be mad :(
/mob/living/proc/get_visible_name()
return name
/mob/living/update_gravity(has_gravity)
/mob/living/update_gravity(has_gravity,override = 0)
if(!ticker || !ticker.mode)
return
if(has_gravity)
clear_alert("weightless")
else
throw_alert("weightless", /obj/screen/alert/weightless)
float(!has_gravity)
if(!override)
float(!has_gravity)
/mob/living/proc/float(on)
if(throwing)
+4 -3
View File
@@ -678,21 +678,22 @@ var/next_mob_id = 0
var/buckle_lying = !(buckled && !buckled.buckle_lying)
var/has_legs = get_num_legs()
var/has_arms = get_num_arms()
var/ignore_legs = get_leg_ignore()
if(ko || resting || stunned)
drop_r_hand()
drop_l_hand()
unset_machine()
if(pulling)
stop_pulling()
else if(has_legs)
else if(has_legs || ignore_legs)
lying = 0
if(buckled)
lying = 90*buckle_lying
else
if((ko || resting || !has_legs) && !lying)
if((ko || resting || (!has_legs && !ignore_legs)) && !lying)
fall(ko)
canmove = !(ko || resting || stunned || buckled || (!has_legs && !has_arms))
canmove = !(ko || resting || stunned || buckled || (!has_legs && !ignore_legs && !has_arms))
density = !lying
if(lying)
if(layer == initial(layer)) //to avoid special cases like hiding larvas.
+1 -1
View File
@@ -174,7 +174,7 @@
should_draw_greyscale = FALSE
var/datum/species/S = H.dna.species
species_id = S.id
species_id = S.limbs_id
if(S.use_skintones)
skin_tone = H.skin_tone
@@ -51,6 +51,13 @@
/mob/proc/get_num_legs()
return 2
/mob/proc/get_leg_ignore()
return 0
/mob/living/carbon/human/get_leg_ignore()
if(FLYING in dna.species.specflags)
return 1
/mob/living/carbon/human/get_num_arms()
. = 0
for(var/X in bodyparts)