Skip to content

Commit

Permalink
Halloween lava dwarves
Browse files Browse the repository at this point in the history
  • Loading branch information
JTGSZ committed Oct 14, 2019
1 parent 304eae3 commit 9cac961
Show file tree
Hide file tree
Showing 6 changed files with 1,768 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#define ismoth(A) (is_species(A, /datum/species/insect))
#define ishumanbasic(A) (is_species(A, /datum/species/human))
#define iscatperson(A) (ishumanbasic(A) && istype(A.dna.species, /datum/species/human/felinid) )
#define isdwarf(A) (is_species(A, /datum/species/dwarf))

//more carbon mobs
#define ismonkey(A) (istype(A, /mob/living/carbon/monkey))
Expand Down
218 changes: 218 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/dwarves.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@

GLOBAL_LIST_INIT(dwarf_first, world.file2list("strings/names/dwarf_first.txt")) //Textfiles with first
GLOBAL_LIST_INIT(dwarf_last, world.file2list("strings/names/dwarf_last.txt")) //textfiles with last

/datum/species/dwarf //not to be confused with the genetic manlets
name = "Dwarf"
id = "dwarf" //Also called Homo sapiens pumilionis
default_color = "FFFFFF"
species_traits = list(EYECOLOR,HAIR,FACEHAIR,LIPS,NO_UNDERWEAR)
//they can grab burning objects and get hurt, and jump straight to aggro grab.
inherent_traits = list()
default_features = list("mcolor" = "FFF", "wings" = "None")
limbs_id = "human"
use_skintones = 1
say_mod = "bellows" //high energy, EXTRA BIOLOGICAL FUEL
damage_overlay_type = "human"
skinned_type = /obj/item/stack/sheet/animalhide/human
liked_food = ALCOHOL | MEAT | DAIRY //Dwarves like alcohol, meat, and dairy products.
disliked_food = JUNKFOOD | FRIED //Dwarves hate foods that have no nutrition other than alcohol.
mutant_organs = list(/obj/item/organ/dwarfgland) //Dwarven alcohol gland, literal gland warrior
mutantliver = /obj/item/organ/liver/dwarf //Dwarven super liver (Otherwise they r doomed)

//Pixel X, and Pixel Y offsets on mob drawing. It handles the offset in update_icons.dm
//X is Horizontal, Y is Vertical. These are general offsets, directional offsets do not exist.
offset_features = list(
OFFSET_UNIFORM = list(0,0),
OFFSET_ID = list(0,0),
OFFSET_GLOVES = list(0,0),
OFFSET_GLASSES = list(0,0),
OFFSET_EARS = list(0,0),
OFFSET_SHOES = list(0,0),
OFFSET_S_STORE = list(0,0),
OFFSET_FACEMASK = list(0,0),
OFFSET_HEAD = list(0,0),
OFFSET_HAIR = list(0,0),
OFFSET_FHAIR = list(0,0),
OFFSET_EYES = list(0,0),
OFFSET_LIPS = list(0,0),
OFFSET_BELT = list(0,0),
OFFSET_BACK = list(0,0),
OFFSET_SUIT = list(0,0),
OFFSET_NECK = list(0,0),
OFFSET_MUTPARTS = list(0,0)
)

/mob/living/carbon/human/species/dwarf //species admin spawn path
race = /datum/species/dwarf //and the race the path is set to.

/datum/species/dwarf/check_roundstart_eligible()
if(SSevents.holidays && SSevents.holidays[HALLOWEEN])
return TRUE
return ..()

/datum/species/dwarf/on_species_gain(mob/living/carbon/C, datum/species/old_species)
. = ..()
var/dwarf_hair = pick("Beard (Dwarf)", "Beard (Very Long)", "Beard (Moonshiner)") //beard roullette
var/mob/living/carbon/human/H = C
H.facial_hair_style = dwarf_hair
H.update_hair()
H.transform = H.transform.Scale(1, 0.8) //We use scale, and yeah. Dwarves can become gnomes with DWARFISM.
RegisterSignal(C, COMSIG_MOB_SAY, .proc/handle_speech) //We register handle_speech is being used.


/datum/species/dwarf/on_species_loss(mob/living/carbon/H, datum/species/new_species)
. = ..()
H.transform = H.transform.Scale(1, 1.25) //And we undo it.
UnregisterSignal(H, COMSIG_MOB_SAY) //We register handle_speech is not being used.

//Dwarf Name stuff
/proc/dwarf_name() //hello caller: my name is urist mcuristurister
return "[pick(GLOB.dwarf_first)] [pick(GLOB.dwarf_last)]"

/datum/species/dwarf/random_name(gender,unique,lastname)
return dwarf_name() //hello, ill return the value from dwarf_name proc to you when called.

//Dwarf Speech handling - Basically a filter/forces them to say things. The IC helper
/datum/species/dwarf/proc/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message[1] != "*")
message = " [message]" //Credits to goonstation for the strings list.
var/list/dwarf_words = strings("dwarf_replacement.json", "dwarf") //thanks to regex too.

for(var/key in dwarf_words) //Theres like 1459 words or something man.
var/value = dwarf_words[key] //Thus they will always be in character.
if(islist(value)) //Whether they like it or not.
value = pick(value) //This could be drastically reduced if needed though.

message = replacetextEx(message, " [uppertext(key)]", " [uppertext(value)]")
message = replacetextEx(message, " [capitalize(key)]", " [capitalize(value)]")
message = replacetextEx(message, " [key]", " [value]") //Also its scottish.

if(prob(3))
message += pick(" By Armok!")
speech_args[SPEECH_MESSAGE] = trim(message)

//This mostly exists because my testdwarf's liver died while trying to also not die due to no alcohol.
/obj/item/organ/liver/dwarf
name = "dwarf liver"
icon_state = "liver"
desc = "A dwarven liver, theres something magical about seeing one of these up close."
alcohol_tolerance = 0 //dwarves really shouldn't be dying to alcohol.
toxTolerance = 5 //Shrugs off 5 units of toxins damage.
maxHealth = 150 //More health than the average liver, as you aren't going to be replacing this.
//If it does need replaced with a standard human liver, prepare for hell.

//alcohol gland
/obj/item/organ/dwarfgland
name = "dwarf alcohol gland"
icon_state = "plasma" //Yes this is a actual icon in icons/obj/surgery.dmi
desc = "A genetically engineered gland which is hopefully a step forward for humanity."
w_class = WEIGHT_CLASS_NORMAL
var/stored_alcohol = 250 //They start with 250 units, that ticks down and eventaully bad effects occur
var/max_alcohol = 500 //Max they can attain, easier than you think to OD on alcohol.
var/heal_rate = 0.5 //The rate they heal damages over 400 alcohol stored. Default is 0.5 so we times 3 since 3 seconds.
var/alcohol_rate = 10 //Its times 0.025 making it tick down by .25 per loop per 10. EX: 20 = .50
var/filth_counter = 0 //Holder for the filth check cycle, basically it compares against this.
//These count in on_life ticks which should be 2 seconds per every increment of 1 in a perfect world.
var/dwarf_filth_ticker = 0 //Currently set =< 4, that means this will fire the proc around every 4-8 seconds.
var/dwarf_eth_ticker = 0 //Currently set =< 1, that means this will fire the proc around every 2 seconds

/obj/item/organ/dwarfgland/prepare_eat()
var/obj/S = ..()
S.reagents.add_reagent("ethanol", stored_alcohol/10)
return S

/obj/item/organ/dwarfgland/on_life() //Primary loop to hook into to start delayed loops for other loops..
dwarf_cycle_ticker()

//Handles the delayed tick cycle by just adding on increments per each on_life() tick
/obj/item/organ/dwarfgland/proc/dwarf_cycle_ticker()
if(owner.stat != DEAD) //We make sure they are not dead, so they don't increment any tickers.
dwarf_eth_ticker++
dwarf_filth_ticker++
if(dwarf_filth_ticker >= 4) //Should be around 4-8 seconds since a tick is around 2 seconds.
dwarf_filth_cycle() //On_life will adjust regarding other factors, so we are along for the ride.
dwarf_filth_ticker = 0 //We set the ticker back to 0 to go again.
if(dwarf_eth_ticker >= 1) //Alcohol reagent check should be around 2 seconds, since a tick is around 2 seconds.
dwarf_eth_cycle()
dwarf_eth_ticker = 0
//Debug messages:
//to_chat(owner, "<span class = 'danger'>FILTH VIEW: [filth_counter], FILTH CYCLE TICKER: [dwarf_filth_ticker]</span>")
//to_chat(owner, "<span class = 'danger'>ALCOHOL COUNTER: [stored_alcohol], ETH CYCLE TICKER: [dwarf_eth_ticker].</span>")


//If this still friggin uses too much CPU, I'll make a for view subsystem If I have to.
/obj/item/organ/dwarfgland/proc/dwarf_filth_cycle()
if(!owner?.client || !owner?.mind)
return
//Filth Reactions - Since miasma now exists
for(var/fuck in view(owner,7)) //hello byond for view loop.
if(istype(fuck, /mob/living/carbon/human))
var/mob/living/carbon/human/H = fuck
if(H.stat == DEAD)
filth_counter += 10
if(istype(fuck, /obj/effect/decal/cleanable/blood))
if(istype(fuck, /obj/effect/decal/cleanable/blood/gibs))
filth_counter += 1
else
filth_counter += 0.1
if(istype(fuck,/obj/effect/decal/cleanable/vomit)) //They are disgusted by their own vomit too.
filth_counter += 10 //Dwarves could technically chainstun each other in a vomit tantrum spiral.
switch(filth_counter)
if(11 to 25)
if(prob(25))
to_chat(owner, "<span class = 'danger'>Someone should really clean up in here!</span>")
if(26 to 50)
if(prob(30)) //Probability the message appears
to_chat(owner, "<span class = 'danger'>The stench makes you queasy.</span>")
if(prob(20)) //And then the probability they vomit along with it.
owner.vomit(20) //I think vomit should stay over a disgust adjustment.
if(51 to 75)
if(prob(35))
to_chat(owner, "<span class = 'danger'>By Armok! You won't be able to keep alcohol down at all!</span>")
if(prob(25))
owner.vomit(20) //Its more funny
if(76 to 100)
if(prob(40))
to_chat(owner, "<span class = 'userdanger'>You can't live in such FILTH!</span>")
if(prob(25))
owner.adjustToxLoss(10) //Now they start dying.
owner.vomit(20)
if(101 to INFINITY) //Now they will really start dying
if(prob(40))
to_chat(owner, "<span class = 'userdanger'> THERES TOO MUCH FILTH, OH GODS THE FILTH!</span>")
owner.adjustToxLoss(15)
owner.vomit(40)
CHECK_TICK //Check_tick right here, its motherfuckin magic. (To me at least)


//Handles the dwarf alcohol cycle tied to on_life, it ticks in dwarf_cycle_ticker.
/obj/item/organ/dwarfgland/proc/dwarf_eth_cycle()
//BOOZE POWER
for(var/datum/reagent/R in owner.reagents.reagent_list)
if(istype(R, /datum/reagent/consumable/ethanol))
var/datum/reagent/consumable/ethanol/E = R
stored_alcohol += (E.boozepwr / 50)
if(stored_alcohol > max_alcohol) //Dwarves technically start at 250 alcohol stored.
stored_alcohol = max_alcohol
var/heal_amt = heal_rate
stored_alcohol -= alcohol_rate * 0.025 //The rate it decreases from the gland
if(stored_alcohol > 400) //If they are over 400 they start regenerating
owner.adjustBruteLoss(-heal_amt) //But its alcohol, there will be other issues here.
owner.adjustFireLoss(-heal_amt) //Unless they drink casually all the time.
owner.adjustOxyLoss(-heal_amt)
owner.adjustCloneLoss(-heal_amt) //Also they will probably get brain damage if thats a thing here.
if(prob(25))
switch(stored_alcohol)
if(0 to 24)
to_chat(owner, "<span class='userdanger'>DAMNATION INCARNATE, WHY AM I CURSED WITH THIS DRY-SPELL? I MUST DRINK.</span>")
owner.adjustToxLoss(35)
if(25 to 50)
to_chat(owner, "<span class='danger'>Oh DAMN, I need some brew!</span>")
if(51 to 75)
to_chat(owner, "<span class='warning'>Your body aches, you need to get ahold of some booze...</span>")
if(76 to 100)
to_chat(owner, "<span class='notice'>A pint of anything would really hit the spot right now.</span>")
if(101 to 150)
to_chat(owner, "<span class='notice'>You feel like you could use a good brew.</span>")
Loading

0 comments on commit 9cac961

Please sign in to comment.