This commit is contained in:
Spamcat
2012-10-23 17:56:00 +04:00
576 changed files with 28568 additions and 16305 deletions
+3 -2
View File
@@ -18,7 +18,7 @@
return
. = src.say_dead(message)
/*
for (var/mob/M in hearers(null, null))
if (!M.stat)
if(M.job == "Chaplain")
@@ -41,4 +41,5 @@
else
M.show_message("<span class='game'><i>You hear muffled speech... you can almost make out some words...</i></span>", 2)
// M.show_message("<span class='game'><i>[stutter(message)]</i></span>", 2)
playsound(src.loc, pick('sound/effects/ghost.ogg','sound/effects/ghost2.ogg'), 10, 1)
playsound(src.loc, pick('sound/effects/ghost.ogg','sound/effects/ghost2.ogg'), 10, 1)
*/
+16 -11
View File
@@ -35,11 +35,10 @@
return
/mob/living/carbon/alien/adjustFireLoss(amount) // Weak to Fire
..(amount * 1.5)
return
/mob/living/carbon/alien/adjustBruteLoss(amount) // Strong against melee weapons
..(amount * 0.5)
if(amount > 0)
..(amount * 1.5)
else
..(amount)
return
/mob/living/carbon/alien/proc/getPlasma()
@@ -48,6 +47,15 @@
/mob/living/carbon/alien/eyecheck()
return 2
/mob/living/carbon/alien/updatehealth()
if(nodamage)
health = maxHealth
stat = CONSCIOUS
else
//oxyloss is only used for suicide
//toxloss isn't used for aliens, its actually used as alien powers!!
health = maxHealth - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
/mob/living/carbon/alien/proc/handle_environment(var/datum/gas_mixture/environment)
//If there are alien weeds on the ground then heal if needed or give some toxins
@@ -106,12 +114,8 @@
/mob/living/carbon/alien/proc/handle_mutations_and_radiation()
if(getFireLoss())
if((COLD_RESISTANCE in mutations) || prob(50))
switch(getFireLoss())
if(1 to 50)
adjustFireLoss(-1)
if(51 to 100)
adjustFireLoss(-5)
if((COLD_RESISTANCE in mutations) || prob(5))
adjustFireLoss(-1)
// Aliens love radiation nom nom nom
if (radiation)
@@ -145,6 +149,7 @@
/mob/living/carbon/alien/Stat()
statpanel("Status")
stat(null, "Intent: [a_intent]")
stat(null, "Move Mode: [m_intent]")
@@ -524,13 +524,4 @@ In all, this is a lot like the monkey code. /N
onclose(user, "mob[name]")
return
/mob/living/carbon/alien/humanoid/updatehealth()
if(nodamage)
health = maxHealth
stat = CONSCIOUS
else
//oxyloss is only used for suicide
//toxloss isn't used for aliens, its actually used as alien powers!!
health = maxHealth - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
@@ -222,17 +222,17 @@
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
if(health < -25 || brain_op_stage == 4.0)
death()
blinded = 1
silent = 0
return 1
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 50) || (config.health_threshold_crit > health) )
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if( (getOxyLoss() > 50) || (0 > health) )
//if( health <= 20 && prob(1) )
// spawn(0)
// emote("gasp")
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
Paralyse(3)
@@ -11,6 +11,7 @@ var/const/MAX_ACTIVE_TIME = 400
/obj/item/clothing/mask/facehugger
name = "alien"
desc = "It has some sort of a tube at the end of its tail."
icon = 'icons/mob/alien.dmi'
icon_state = "facehugger"
item_state = "facehugger"
w_class = 1 //note: can be picked up by aliens unlike most other items of w_class below 4
@@ -167,6 +168,7 @@ var/const/MAX_ACTIVE_TIME = 400
return
stat = CONSCIOUS
icon_state = "[initial(icon_state)]"
/* for(var/mob/living/carbon/alien/alien in world)
var/image/activeIndicator = image('icons/mob/alien.dmi', loc = src, icon_state = "facehugger_active")
@@ -183,6 +185,7 @@ var/const/MAX_ACTIVE_TIME = 400
/* RemoveActiveIndicators() */
stat = UNCONSCIOUS
icon_state = "[initial(icon_state)]_inactive"
spawn(rand(MIN_ACTIVE_TIME,MAX_ACTIVE_TIME))
GoActive()
@@ -194,7 +197,7 @@ var/const/MAX_ACTIVE_TIME = 400
/* RemoveActiveIndicators() */
icon_state = "facehugger_dead"
icon_state = "[initial(icon_state)]_dead"
stat = DEAD
for(var/mob/O in viewers(src, null))
+5 -3
View File
@@ -10,6 +10,8 @@
return
else
message = Gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher
..()
else
..()
if(istype(container, /obj/item/device/mmi/radio_enabled))
var/obj/item/device/mmi/radio_enabled/R = container
if(R.radio)
spawn(0) R.radio.hear_talk(src, sanitize(message))
..()
+5 -1
View File
@@ -432,5 +432,9 @@
*/
item.throw_at(target, item.throw_range, item.throw_speed)
/mob/living/carbon/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > CARBON_LIFEFORM_FIRE_RESISTANCE)
adjustFireLoss(CARBON_LIFEFORM_FIRE_DAMAGE)
..()
@@ -169,7 +169,7 @@
//ID
if(wear_id)
var/id
/*var/id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.owner
@@ -178,8 +178,8 @@
id = idcard.registered_name
if(id && (id != real_name) && (get_dist(src, usr) <= 1) && prob(10))
msg += "<span class='warning'>[t_He] [t_is] wearing \icon[wear_id] \a [wear_id] yet something doesn't seem right...</span>\n"
else
msg += "[t_He] [t_is] wearing \icon[wear_id] \a [wear_id].\n"
else*/
msg += "[t_He] [t_is] wearing \icon[wear_id] \a [wear_id].\n"
//Jitters
if(is_jittery)
@@ -743,10 +743,14 @@
number += 2
if(istype(src.head, /obj/item/clothing/head/helmet/space))
number += 2
if(istype(src.glasses, /obj/item/clothing/glasses/sunglasses))
number += 1
if(istype(src.glasses, /obj/item/clothing/glasses/thermal))
number -= 1
if(istype(src.glasses, /obj/item/clothing/glasses/sunglasses))
number += 1
if(istype(src.glasses, /obj/item/clothing/glasses/welding))
var/obj/item/clothing/glasses/welding/W = src.glasses
if(!W.up)
number += 2
return number
+12 -3
View File
@@ -38,13 +38,14 @@
..()
/*
//This code is here to try to determine what causes the gender switch to plural error. Once the error is tracked down and fixed, this code should be deleted
//Also delete var/prev_gender once this is removed.
if(prev_gender != gender)
prev_gender = gender
if(gender in list(PLURAL, NEUTER))
message_admins("[src] ([ckey]) gender has been changed to plural or neuter. Please record what has happened recently to the person and then notify coders. (<A HREF='?src=%holder_ref%;adminmoreinfo=\ref[src]'>?</A>) (<A HREF='?src=%holder_ref%;adminplayervars=\ref[src]'>VV</A>) (<A HREF='?src=%admin_ref%;priv_msg=\ref[src]'>PM</A>) (<A HREF='?src=%holder_ref%;adminplayerobservejump=\ref[src]'>JMP</A>)",1,1) //The 1,1 at the end is there to make '%holder_ref%' get replaced with the actual ref object
*/
//Apparently, the person who wrote this code designed it so that
//blinded get reset each cycle and then get activated later in the
//code. Very ugly. I dont care. Moving this stuff here so its easy
@@ -309,7 +310,7 @@
proc/handle_mutations_and_radiation()
if(getFireLoss())
if((COLD_RESISTANCE in mutations) || (prob(1) && prob(75)))
if((COLD_RESISTANCE in mutations) || (prob(1)))
heal_organ_damage(0,1)
// Make nanoregen heal youu, -3 all damage types
@@ -552,7 +553,7 @@
if(Toxins_pp > safe_toxins_max) // Too much toxins
var/ratio = breath.toxins/safe_toxins_max
adjustToxLoss(min(ratio, 10)) //Limit amount of damage toxin exposure can do per second
adjustToxLoss(min(ratio, MIN_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
toxins_alert = max(toxins_alert, 1)
else
toxins_alert = 0
@@ -1305,10 +1306,18 @@
if(eye_blurry) client.screen += global_hud.blurry
if(druggy) client.screen += global_hud.druggy
var/masked = 0
if( istype(head, /obj/item/clothing/head/welding) )
var/obj/item/clothing/head/welding/O = head
if(!O.up && tinted_weldhelh)
client.screen += global_hud.darkMask
masked = 1
if(!masked && istype(glasses, /obj/item/clothing/glasses/welding) )
var/obj/item/clothing/glasses/welding/O = glasses
if(!O.up && tinted_weldhelh)
client.screen += global_hud.darkMask
if(eye_stat > 20)
if(eye_stat > 30) client.screen += global_hud.darkMask
+16 -2
View File
@@ -11,6 +11,8 @@
return
else
return ..(message)
if(stat == DEAD)
return ..(message)
if(length(message) >= 1) //In case people forget the '*help' command, this will slow them the message and prevent people from saying one letter at a time
if (copytext(message, 1, 2) != "*")
@@ -32,7 +34,7 @@
for(var/i = 0,i<imax,i++)
message += "E"
if(stat != 2)
if(stat != DEAD)
for(var/datum/disease/pierrot_throat/D in viruses)
var/list/temp_message = dd_text2list(message, " ") //List each word in the message
var/list/pick_list = list()
@@ -132,4 +134,16 @@
return 1
if (istype(other, /mob/living/carbon/metroid))
return 1
return ..()
return ..()
/mob/living/carbon/human/GetVoice()
if(istype(src.wear_mask, /obj/item/clothing/mask/gas/voice))
var/obj/item/clothing/mask/gas/voice/V = src.wear_mask
if(V.vchange)
return V.voice
else
return name
if(mind && mind.changeling && mind.changeling.mimicing)
return mind.changeling.mimicing
return real_name
@@ -221,26 +221,24 @@ proc/get_damage_icon_part(damage_state, body_part)
if(lying_icon) del(lying_icon)
if(dna && dna.mutantrace) return
var/husk = (HUSK in src.mutations) //100% unnecessary -Agouri //nope, do you really want to iterate through src.mutations repeatedly? -Pete
var/fat = (FAT in src.mutations)
var/skeleton = (SKELETON in src.mutations)
var/g = "m"
if(gender == FEMALE) g = "f"
var/husk = (HUSK in src.mutations)
var/obese = (FAT in src.mutations)
// whether to draw the individual limbs
var/individual_limbs = 1
//Base mob icon
if(obese)
// Sorry, no dismemberment for fat people.
if(husk)
stand_icon = new /icon('icons/mob/human.dmi', "husk_s")
lying_icon = new /icon('icons/mob/human.dmi', "husk_l")
else if(fat)
stand_icon = new /icon('icons/mob/human.dmi', "fatbody_s")
lying_icon = new /icon('icons/mob/human.dmi', "fatbody_l")
individual_limbs = 0
// If dismemberment is on, draw individual limbs
else if(config.limbs_can_break)
stand_icon = new /icon('icons/mob/human.dmi', "torso_[g]_s")
lying_icon = new /icon('icons/mob/human.dmi', "torso_[g]_l")
// Otherwise just draw the full body.
else if(SKELETON in src.mutations)
else if(skeleton)
stand_icon = new /icon('icons/mob/human.dmi', "skeleton_s")
lying_icon = new /icon('icons/mob/human.dmi', "skeleton_l")
else
@@ -289,7 +287,7 @@ proc/get_damage_icon_part(damage_state, body_part)
lying_icon.Blend(husk_l, ICON_OVERLAY)
//Skin tone
if((SKELETON in src.mutations) == 0)
if(!skeleton)
if(s_tone >= 0)
stand_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
lying_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
@@ -298,7 +296,7 @@ proc/get_damage_icon_part(damage_state, body_part)
lying_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
//Eyes
if((SKELETON in src.mutations) == 0)
if(!skeleton)
var/icon/eyes_s = new/icon('icons/mob/human_face.dmi', "eyes_s")
var/icon/eyes_l = new/icon('icons/mob/human_face.dmi', "eyes_l")
eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD)
@@ -314,17 +312,19 @@ proc/get_damage_icon_part(damage_state, body_part)
lying_icon.Blend(eyes_l, ICON_OVERLAY)
//Mouth (lipstick!)
if(lip_style && (SKELETON in src.mutations) == 0)
if(lip_style) //skeletons are allowed to wear lipstick no matter what you think, agouri.
stand_icon.Blend(new/icon('icons/mob/human_face.dmi', "lips_[lip_style]_s"), ICON_OVERLAY)
lying_icon.Blend(new/icon('icons/mob/human_face.dmi', "lips_[lip_style]_l"), ICON_OVERLAY)
//Underwear
if(underwear >0 && underwear < 12)
if(!obese)
stand_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_s"), ICON_OVERLAY)
lying_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_l"), ICON_OVERLAY)
if(update_icons) update_icons()
//tail update_tail_showing(0)
if(!fat && !skeleton)
stand_icon.Blend(new /icon('icons/mob/human.dmi', "underwear[underwear]_[g]_s"), ICON_OVERLAY)
if(update_icons)
update_icons()
//tail
update_tail_showing(0)
//HAIR OVERLAY
@@ -375,7 +375,7 @@ proc/get_damage_icon_part(damage_state, body_part)
/mob/living/carbon/human/update_mutations(var/update_icons=1)
var/fat
if( FAT in mutations )
if(FAT in mutations)
fat = "fat"
var/image/lying = image("icon" = 'icons/effects/genetics.dmi')
@@ -23,7 +23,7 @@
return
var/alt_name = ""
if (istype(src, /mob/living/carbon/human) && src.name != src.real_name)
if (istype(src, /mob/living/carbon/human) && src.name != GetVoice())
var/mob/living/carbon/human/H = src
alt_name = " (as [H.get_id_name("Unknown")])"
// Mute disability
@@ -98,15 +98,7 @@
if (italics)
message_a = "<i>[message_a]</i>"
//This appears copied from carbon/living say.dm so the istype check for mob is probably not needed. Appending for src is also not needed as the game will check that automatically.
if (!istype(src, /mob/living/carbon/human))
rendered = "<span class='game say'><span class='name'>[name]</span> whispers, <span class='message'>\"[message_a]\"</span></span>"
else if (istype(wear_mask, /obj/item/clothing/mask/gas/voice))
if (wear_mask:vchange)
rendered = "<span class='game say'><span class='name'>[wear_mask:voice]</span> whispers, <span class='message'>\"[message_a]\"</span></span>"
else
rendered = "<span class='game say'><span class='name'>[name]</span> whispers, <span class='message'>\"[message_a]\"</span></span>"
else
rendered = "<span class='game say'><span class='name'>[real_name]</span>[alt_name] whispers, <span class='message'>\"[message_a]\"</span></span>"
rendered = "<span class='game say'><span class='name'>[GetVoice()]</span>[alt_name] whispers, <span class='message'>\"[message_a]\"</span></span>"
for (var/mob/M in heard_a)
M.show_message(rendered, 2)
@@ -131,15 +123,7 @@
if (M.say_understands(src))
var/message_c
message_c = stars(message)
if (!istype(src, /mob/living/carbon/human))
rendered = "<span class='game say'><span class='name'>[name]</span> whispers, <span class='message'>\"[message_c]\"</span></span>"
else if(istype(wear_mask, /obj/item/clothing/mask/gas/voice))
if(wear_mask:vchange)
rendered = "<span class='game say'><span class='name'>[wear_mask:voice]</span> whispers, <span class='message'>\"[message_c]\"</span></span>"
else
rendered = "<span class='game say'><span class='name'>[name]</span> whispers, <span class='message'>\"[message_c]\"</span></span>"
else
rendered = "<span class='game say'><span class='name'>[real_name]</span>[alt_name] whispers, <span class='message'>\"[message_c]\"</span></span>"
rendered = "<span class='game say'><span class='name'>[GetVoice()]</span>[alt_name] whispers, <span class='message'>\"[message_c]\"</span></span>"
M.show_message(rendered, 2)
else
rendered = "<span class='game say'><span class='name'>[src.voice_name]</span> whispers something.</span>"
@@ -147,16 +131,7 @@
if (italics)
message = "<i>[message]</i>"
if (!istype(src, /mob/living/carbon/human))
rendered = "<span class='game say'><span class='name'>[name]</span> whispers, <span class='message'>\"[message]\"</span></span>"
else if (istype(src.wear_mask, /obj/item/clothing/mask/gas/voice))
if(wear_mask:vchange)
rendered = "<span class='game say'><span class='name'>[wear_mask:voice]</span> whispers, <span class='message'>\"[message]\"</span></span>"
else
rendered = "<span class='game say'><span class='name'>[name]</span> whispers, <span class='message'>\"[message]\"</span></span>"
else
rendered = "<span class='game say'><span class='name'>[real_name]</span>[alt_name] whispers, <span class='message'>\"[message]\"</span></span>"
rendered = "<span class='game say'><span class='name'>[GetVoice()]</span>[alt_name] whispers, <span class='message'>\"[message]\"</span></span>"
for (var/mob/M in dead_mob_list)
if (!(M.client))
+9 -14
View File
@@ -329,27 +329,22 @@
if(nutrition >= 800)
if(prob(40)) amount_grown++
//lay eggs or grow
if(amount_grown >= 10 && !Victim && !Target)
if(istype(src, /mob/living/carbon/metroid/adult))
if(!client)
var/number = pick(2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4)
for(var/i=1,i<=number,i++) // reproduce (has a small chance of producing 3 or 4 offspring)
var/mob/living/carbon/metroid/M = new/mob/living/carbon/metroid(loc)
// M.nutrition = round(nutrition * 0.9)
M.powerlevel = round(powerlevel/number)
M.Friends = Friends
M.tame = tame
M.rabid = rabid
M.Discipline = Discipline
if(i != 1) step_away(M,src)
del(src)
if(!client && nutrition >= 1000)
var/number = pick(1,1,1,1,1,1,2,2,2,3) //number of eggs laid
var/obj/item/weapon/reagent_containers/food/snacks/roro_egg/E
for(var/i=1,i<=number,i++)
E = new/obj/item/weapon/reagent_containers/food/snacks/roro_egg(loc)
src.nutrition -= 200
step_away(E,src)
else
if(!client)
var/mob/living/carbon/metroid/adult/A = new/mob/living/carbon/metroid/adult(src.loc)
A.nutrition = nutrition
// A.nutrition += 100
A.nutrition += 100
A.powerlevel = max(0, powerlevel-1)
A.Friends = Friends
A.tame = tame
@@ -770,4 +770,81 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
return 0
return 1
return 1
// Basically this Metroid Core catalyzes reactions that normally wouldn't happen anywhere
/obj/item/metroid_core
name = "roro core"
desc = "A very slimy and tender part of a Rorobeast. Legends claim these to have \"magical powers\"."
icon = 'icons/obj/surgery.dmi'
icon_state = "roro core"
flags = TABLEPASS
force = 1.0
w_class = 1.0
throwforce = 1.0
throw_speed = 3
throw_range = 6
origin_tech = "biotech=4"
var/POWERFLAG = 0 // sshhhhhhh
var/Flush = 30
var/Uses = 5 // uses before it goes inert
New()
..()
var/datum/reagents/R = new/datum/reagents(100)
reagents = R
R.my_atom = src
POWERFLAG = rand(1,10)
Uses = rand(7, 25)
//flags |= NOREACT
spawn()
Life()
proc/Life()
while(src)
sleep(25)
Flush--
if(Flush <= 0)
reagents.clear_reagents()
Flush = 30
/obj/item/weapon/reagent_containers/food/snacks/roro_egg
name = "roro egg"
desc = "A small, gelatinous egg."
icon = 'icons/mob/mob.dmi'
icon_state = "roro egg-growing"
bitesize = 12
origin_tech = "biotech=4"
var/grown = 0
New()
..()
reagents.add_reagent("nutriment", 5)
spawn(rand(1200,1500))//the egg takes a while to "ripen"
Grow()
proc/Grow()
grown = 1
icon_state = "roro egg-grown"
processing_objects.Add(src)
return
proc/Hatch()
processing_objects.Remove(src)
var/turf/T = get_turf(src)
for(var/mob/O in hearers(T))
O.show_message("\blue The [name] pulsates and quivers!")
spawn(rand(50,100))
for(var/mob/O in hearers(T))
O.show_message("\blue The [name] bursts open!")
new/mob/living/carbon/metroid(T)
del(src)
/obj/item/weapon/reagent_containers/food/snacks/roro_egg/process()
var/turf/location = get_turf(src)
var/datum/gas_mixture/environment = location.return_air()
if (environment.toxins > MOLES_PLASMA_VISIBLE)//plasma exposure causes the egg to hatch
src.Hatch()
@@ -187,7 +187,7 @@
/mob/living/carbon/metroid/verb/Reproduce()
set category = "Roro"
set desc = "This will make you split into a random number of Metroids (usually 2). NOTE: this will KILL you, but you will be transferred into one of the babies."
set desc = "This will make you lay an egg. NOTE: This decreases your nutrition."
if(stat)
src << "<i>I must be conscious to do this...</i>"
@@ -195,32 +195,15 @@
if(istype(src, /mob/living/carbon/metroid/adult))
if(amount_grown >= 10)
if(input("Are you absolutely sure you want to reproduce? Your current body will cease to be, but your consciousness will be transferred into a produced rorobeast.") in list("Yes","No")=="Yes")
if(stat)
src << "<i>I must be conscious to do this...</i>"
return
var/list/babies = list()
var/number = pick(14;2,3,4)
var/new_nutrition = round(nutrition * 0.9)
var/new_powerlevel = round(powerlevel / number)
for(var/i=1,i<=number,i++) // reproduce (has a small chance of producing 3 or 4 offspring)
var/mob/living/carbon/metroid/M = new/mob/living/carbon/metroid(loc)
M.nutrition = new_nutrition
M.powerlevel = new_powerlevel
if(i != 1) step_away(M,src)
babies += M
var/mob/living/carbon/metroid/new_metroid = pick(babies)
new_metroid.a_intent = "hurt"
new_metroid.key = key
new_metroid << "<B>You are now a Rorobeast. Skree!</B>"
del(src)
if(src.nutrition >= 300)
new/obj/item/weapon/reagent_containers/food/snacks/roro_egg(loc)
src.nutrition -= 200
else
src << "<i>I have not fed enough...</i>"
else
src << "<i>I am not ready to reproduce yet...</i>"
else
src << "<i>I am not old enough to reproduce yet...</i>"
src << "<i>I am not old enough to lay eggs yet...</i>"
@@ -288,7 +288,7 @@
if(Toxins_pp > safe_toxins_max) // Too much toxins
var/ratio = breath.toxins/safe_toxins_max
adjustToxLoss(min(ratio, 10)) //Limit amount of damage toxin exposure can do per second
adjustToxLoss(min(ratio, MIN_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
toxins_alert = max(toxins_alert, 1)
else
toxins_alert = 0
+11 -13
View File
@@ -108,7 +108,7 @@ var/list/department_radio_keys = list(
return emote(copytext(message, 2))
var/alt_name = ""
if (istype(src, /mob/living/carbon/human) && name != real_name)
if (istype(src, /mob/living/carbon/human) && name != GetVoice())
var/mob/living/carbon/human/H = src
alt_name = " (as [H.get_id_name("Unknown")])"
var/italics = 0
@@ -306,7 +306,7 @@ var/list/department_radio_keys = list(
listening|=M
var/turf/T = get_turf(src)
var/list/W = view(message_range, T)
var/list/W = hear(message_range, T)
for (var/obj/O in ((W | contents)-used_radios))
W |= O
@@ -337,12 +337,13 @@ var/list/department_radio_keys = list(
if (O)
O.hear_talk(src, message)
*/
if(isbrain(src))//For brains to properly talk if they are in an MMI..or in a brain. Could be extended to other mobs I guess.
/* if(isbrain(src))//For brains to properly talk if they are in an MMI..or in a brain. Could be extended to other mobs I guess.
for(var/obj/O in loc)//Kinda ugly but whatever.
if(O)
spawn(0)
O.hear_talk(src, message)
*/
var/list/heard_a = list() // understood us
@@ -374,15 +375,8 @@ var/list/department_radio_keys = list(
if (italics)
message_a = "<i>[message_a]</i>"
if (!istype(src, /mob/living/carbon/human))
rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[message_a]</span></span>"
else if(istype(wear_mask, /obj/item/clothing/mask/gas/voice))
if(wear_mask:vchange)
rendered = "<span class='game say'><span class='name'>[wear_mask:voice]</span> <span class='message'>[message_a]</span></span>"
else
rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[message_a]</span></span>"
else
rendered = "<span class='game say'><span class='name'>[real_name]</span>[alt_name] <span class='message'>[message_a]</span></span>"
rendered = "<span class='game say'><span class='name'>[GetVoice()]</span>[alt_name] <span class='message'>[message_a]</span></span>"
for (var/M in heard_a)
if(hascall(M,"show_message"))
@@ -439,3 +433,7 @@ var/list/department_radio_keys = list(
/obj/effect/speech_bubble
var/mob/parent
/mob/living/proc/GetVoice()
return name
+1
View File
@@ -41,6 +41,7 @@
var/mob/living/silicon/ai/parent = null
var/camera_light_on = 0 //Defines if the AI toggled the light on the camera it's looking through.
var/datum/trackable/track = null
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
var/list/possibleNames = ai_names
@@ -73,7 +73,8 @@ var/datum/cameranet/cameranet = new()
// Removes a camera from a chunk.
/datum/cameranet/proc/removeCamera(obj/machinery/camera/c)
majorChunkChange(c, 0)
if(c.can_use())
majorChunkChange(c, 0)
// Add a camera to a chunk.
@@ -81,15 +82,13 @@ var/datum/cameranet/cameranet = new()
if(c.can_use())
majorChunkChange(c, 1)
// Used for Cyborg cameras. It is the same as "add" but named differently for easier readability
// and to allow the user know what it is for. Since portable cameras can be in ANY chunk, we have to
// all it to be added to all chunks. If the camera is disabled, it will instead remove.
// Used for Cyborg cameras. Since portable cameras can be in ANY chunk.
/datum/cameranet/proc/updatePortableCamera(obj/machinery/camera/c)
if(c.can_use())
majorChunkChange(c, 1)
else
majorChunkChange(c, 0)
//else
// majorChunkChange(c, 0)
// Never access this proc directly!!!!
// This will update the chunk and all the surrounding chunks.
@@ -15,6 +15,9 @@
var/visible = 0
var/changed = 0
var/updating = 0
var/x = 0
var/y = 0
var/z = 0
// Add an AI eye to the chunk, then update if changed.
@@ -69,10 +72,19 @@
var/list/newVisibleTurfs = list()
for(var/obj/machinery/camera/c in cameras)
for(var/camera in cameras)
var/obj/machinery/camera/c = camera
if(!c)
continue
if(!c.can_use())
continue
var/turf/point = locate(src.x + 8, src.y + 8, src.z)
if(get_dist(point, c) > 24)
continue
for(var/turf/t in c.can_see())
newVisibleTurfs += t
@@ -85,7 +97,6 @@
visibleTurfs = newVisibleTurfs
obscuredTurfs = turfs - newVisibleTurfs
for(var/turf in visAdded)
var/turf/t = turf
if(t.obscured)
@@ -120,17 +131,23 @@
x &= ~0xf
y &= ~0xf
src.x = x
src.y = y
src.z = z
for(var/obj/machinery/camera/c in range(16, locate(x + 8, y + 8, z)))
if(c.can_use())
cameras += c
for(var/turf/t in range(10, locate(x + 8, y + 8, z)))
if(t.x >= x && t.y >= y && t.x < x + 16 && t.y < y + 16)
turfs += t
for(var/camera in cameras)
var/obj/machinery/camera/c = camera
if(!c)
continue
if(!c.can_use())
continue
@@ -94,7 +94,7 @@
// This will move the AIEye. It will also cause lights near the eye to light up, if toggled.
// This is handled in the proc below this one.
/client/AIMove(n, direct, var/mob/living/silicon/ai/user)
/client/proc/AIMove(n, direct, var/mob/living/silicon/ai/user)
var/initial = initial(user.sprint)
var/max_sprint = 50
@@ -64,13 +64,15 @@
/mob/living/silicon/robot/var/updating = 0
/mob/living/silicon/robot/Move()
var/oldLoc = src.loc
. = ..()
if(.)
if(src.camera)
if(!updating)
updating = 1
spawn(BORG_CAMERA_BUFFER)
cameranet.updatePortableCamera(src.camera)
if(oldLoc != src.loc)
cameranet.updatePortableCamera(src.camera)
updating = 0
// CAMERA
@@ -1,71 +0,0 @@
/var/const/SHARED_TYPES_WEIGHT = 5
/var/const/CAMERA_PROXIMITY_PREFERENCE = 0.2
// the smaller this is, the more a straight line will be preferred over a closer camera when changing cameras
// if you set this to 0 the game will crash. don't do that.
// if you set it to be negative the algorithm will do completely nonsensical things (like choosing the camera that's
// the farthest away). don't do that.
/client/proc/AIMove(n,direct,var/mob/living/silicon/ai/user)
if(!user) return
if(user.control_disabled) return
var/min_dist = 1e8
var/obj/machinery/camera/closest = null
var/atom/old = (user.current?user.current : user.loc)
if(!old) return
var/dx = 0
var/dy = 0
if(direct & NORTH)
dy = 1
else if(direct & SOUTH)
dy = -1
if(direct & EAST)
dx = 1
else if(direct & WEST)
dx = -1
var/area/A = get_area(old)
var/list/old_types = dd_text2list("[A.type]", "/")
for(var/obj/machinery/camera/current in cameranet.cameras)
if(user.network != current.network) continue
if(!current.status) continue // ignore disabled cameras
//make sure it's the right direction
if(dx && (current.x * dx <= old.x * dx))
continue
if(dy && (current.y * dy <= old.y * dy))
continue
var/shared_types = 0 //how many levels deep the old camera and the closest camera's areas share
//for instance, /area/A and /area/B would have shared_types = 2 (because of how dd_text2list works)
//whereas area/A/B and /area/A/C would have it as 3
var/area/cur_area = get_area(current)
if(!cur_area) continue
var/list/new_types = dd_text2list("[cur_area.type]", "/")
for(var/i = 1; i <= old_types.len && i <= new_types.len; i++)
if(old_types[i] == new_types[i])
shared_types++
else
break
//don't let it be too far from the current one in the axis perpindicular to the direction of travel,
//but let it be farther from that if it's in the same area
//something in the same hallway but farther away beats something in the same hallway
var/distance = abs((current.y - old.y)/(CAMERA_PROXIMITY_PREFERENCE + abs(dy))) + abs((current.x - old.x)/(CAMERA_PROXIMITY_PREFERENCE + abs(dx)))
distance -= SHARED_TYPES_WEIGHT * shared_types
//weight things in the same area as this so they count as being closer - makes you stay in the same area
//when possible
if(distance < min_dist)
//closer, or this is in the same area and the current closest isn't
min_dist = distance
closest = current
if(!closest)
return
user.switchCamera(closest)
@@ -99,6 +99,9 @@
camera.status = 0
..()
playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
//Improved /N
/mob/living/silicon/robot/Del()
@@ -1,172 +0,0 @@
#define BEAR_STANCE_IDLE 1
#define BEAR_STANCE_ALERT 2
#define BEAR_STANCE_ATTACK 3
#define BEAR_STANCE_ATTACKING 4
#define BEAR_STANCE_TIRED 5
//Space bears!
/mob/living/simple_animal/bear
name = "space bear"
desc = "RawrRawr!!"
icon_state = "bear"
icon_living = "bear"
icon_dead = "bear_dead"
icon_gib = "bear_gib"
speak = list("RAWR!","Rawr!","GRR!","Growl!")
speak_emote = list("growls", "roars")
emote_hear = list("rawrs","grumbles","grawls")
emote_see = list("stares ferociously", "stomps")
speak_chance = 1
turns_per_move = 5
see_in_dark = 6
meat_type = /obj/item/weapon/reagent_containers/food/snacks/meat
response_help = "pets the"
response_disarm = "gently pushes aside the"
response_harm = "pokes the"
stop_automated_movement_when_pulled = 0
maxHealth = 60
health = 60
melee_damage_lower = 20
melee_damage_upper = 30
//Space bears aren't affected by atmos.
min_oxy = 0
max_oxy = 0
min_tox = 0
max_tox = 0
min_co2 = 0
max_co2 = 0
min_n2 = 0
max_n2 = 0
minbodytemp = 0
var/stance = BEAR_STANCE_IDLE //Used to determine behavior
var/stance_step = 0 //Used to delay checks depending on what stance the bear is in
var/mob/living/target_mob //Once the bear enters attack stance, it will try to chase this mob. This it to prevent it changing it's mind between multiple mobs.
//SPACE BEARS! SQUEEEEEEEE~ OW! FUCK! IT BIT MY HAND OFF!!
/mob/living/simple_animal/bear/Hudson
name = "Hudson"
desc = ""
response_help = "pets"
response_disarm = "gently pushes aside"
response_harm = "pokes"
/mob/living/simple_animal/bear/Life()
..()
if(client) return //Player controlled bears shouldnt be processing AI stuff
if(stat)
walk(src,0)//Stops the movement
if(!stat)
if(loc && istype(loc,/turf/space))
icon_state = "bear"
else
icon_state = "bearfloor"
switch(stance)
if(BEAR_STANCE_IDLE)
stop_automated_movement = 0
stance_step++
if(stance_step > 5)
stance_step = 0
for( var/mob/living/L in viewers(7,src) )
if(isbear(L)) continue
if(!L.stat)
emote("stares alertly at [L]")
stance = BEAR_STANCE_ALERT
break
if(BEAR_STANCE_ALERT)
stop_automated_movement = 1
var/found_mob = 0
for( var/mob/living/L in viewers(7,src) )
if(isbear(L)) continue
if(!L.stat)
stance_step = max(0, stance_step) //If we have not seen a mob in a while, the stance_step will be negative, we need to reset it to 0 as soon as we see a mob again.
stance_step++
found_mob = 1
target_mob = L
src.dir = get_dir(src,target_mob) //Keep staring at the mob
if(stance_step in list(1,4,7)) //every 3 ticks
var/action = pick( list( "growls at [L]", "stares angrily at [L]", "prepares to attack [L]", "closely watches [L]" ) )
if(action)
emote(action)
break
if(!found_mob)
stance_step--
if(stance_step <= -20) //If we have not found a mob for 20-ish ticks, revert to idle mode
stance = BEAR_STANCE_IDLE
if(stance_step >= 7) //If we have been staring at a mob for 7 ticks,
stance = BEAR_STANCE_ATTACK
if(BEAR_STANCE_ATTACK) //This one should only be active for one tick,
stop_automated_movement = 1
if(!target_mob || target_mob.stat)
stance = BEAR_STANCE_ALERT
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
if(target_mob in viewers(7,src))
walk_to(src, target_mob, 1, 3)
stance = BEAR_STANCE_ATTACKING
stance_step = 0
if(BEAR_STANCE_ATTACKING)
stop_automated_movement = 1
stance_step++
if(!target_mob || target_mob.stat)
stance = BEAR_STANCE_ALERT
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
return
if(!(target_mob in viewers(7,src)))
stance = BEAR_STANCE_ALERT
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
target_mob = null
return
if(get_dist(src, target_mob) <= 1) //Attacking
emote( pick( list("slashes at [target_mob]", "bites [target_mob]") ) )
var/damage = rand(20,30)
if(ishuman(target_mob))
var/mob/living/carbon/human/H = target_mob
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
var/datum/organ/external/affecting = H.get_organ(ran_zone(dam_zone))
H.apply_damage(damage, BRUTE, affecting, H.run_armor_check(affecting, "melee"))
else if(isliving(target_mob))
var/mob/living/L = target_mob
L.adjustBruteLoss(damage)
if(stance_step >= 20) //attacks for 20 ticks, then it gets tired and needs to rest
emote( "is worn out and needs to rest" )
stance = BEAR_STANCE_TIRED
stance_step = 0
walk(src, 0) //This stops the bear's walking
return
if(BEAR_STANCE_TIRED)
stop_automated_movement = 1
stance_step++
if(stance_step >= 10) //rests for 10 ticks
if(target_mob && target_mob in viewers(7,src))
stance = BEAR_STANCE_ATTACK //If the mob he was chasing is still nearby, resume the attack, otherwise go idle.
else
stance = BEAR_STANCE_IDLE
/mob/living/simple_animal/bear/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(stance != BEAR_STANCE_ATTACK && stance != BEAR_STANCE_ATTACKING)
stance = BEAR_STANCE_ALERT
stance_step = 6
target_mob = user
..()
/mob/living/simple_animal/bear/attack_hand(mob/living/carbon/human/M as mob)
if(stance != BEAR_STANCE_ATTACK && stance != BEAR_STANCE_ATTACKING)
stance = BEAR_STANCE_ALERT
stance_step = 6
target_mob = M
..()
/mob/living/simple_animal/bear/Process_Spacemove(var/check_drift = 0)
return //No drifting in space for space bears!
@@ -1,117 +0,0 @@
#define CARP_STANCE_IDLE 1
#define CARP_STANCE_ATTACK 2
#define CARP_STANCE_ATTACKING 3
/mob/living/simple_animal/carp
name = "space carp"
desc = "A ferocious, fang-bearing creature that resembles a fish."
icon_state = "carp"
icon_living = "carp"
icon_dead = "carp_dead"
icon_gib = "carp_gib"
speak_chance = 0
turns_per_move = 5
meat_type = /obj/item/weapon/reagent_containers/food/snacks/carpmeat
response_help = "pets the"
response_disarm = "gently pushes aside the"
response_harm = "hits the"
speed = -1
stop_automated_movement_when_pulled = 0
maxHealth = 25
health = 25
harm_intent_damage = 8
melee_damage_lower = 15
melee_damage_upper = 15
attacktext = "bites"
attack_sound = 'sound/weapons/bite.ogg'
//Space carp aren't affected by atmos.
min_oxy = 0
max_oxy = 0
min_tox = 0
max_tox = 0
min_co2 = 0
max_co2 = 0
min_n2 = 0
max_n2 = 0
minbodytemp = 0
var/stance = CARP_STANCE_IDLE //Used to determine behavior
var/stance_step = 0 //Used to delay checks depending on what stance the bear is in
var/mob/living/target_mob //Once the bear enters attack stance, it will try to chase this mob. This it to prevent it changing it's mind between multiple mobs.
/mob/living/simple_animal/carp/Life()
if(stat == DEAD)
walk(src,0)//STOP FUCKING MOVING GODDAMN
if(health > 0)
icon_state = icon_living
dead_mob_list -= src
living_mob_list += src
stat = CONSCIOUS
density = 1
return
if(health < 1)
Die()
if(health > maxHealth)
health = maxHealth
if(!ckey && !stop_automated_movement)
if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc.
turns_since_move++
if(turns_since_move >= turns_per_move)
if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
if(!stat)
switch(stance)
if(CARP_STANCE_IDLE)
stop_automated_movement = 0
stance_step++
if(stance_step > 5)
stance_step = 0
for( var/mob/living/L in viewers(7,src) )
if(iscarp(L)) continue
if(!L.stat)
emote("gnashes at [L]")
stance = CARP_STANCE_ATTACK
target_mob = L
break
if(CARP_STANCE_ATTACK) //This one should only be active for one tick
stop_automated_movement = 1
if(!target_mob || target_mob.stat)
stance = CARP_STANCE_IDLE
stance_step = 5 //Make it very alert, so it quickly attacks again if a mob returns
if(target_mob in viewers(7,src))
walk_to(src, target_mob, 1, 3)
stance = CARP_STANCE_ATTACKING
stance_step = 0
if(CARP_STANCE_ATTACKING)
stop_automated_movement = 1
stance_step++
if(!target_mob || target_mob.stat)
stance = CARP_STANCE_IDLE
stance_step = 3 //Make it very alert, so it quickly attacks again if a mob returns
target_mob = null
return
if(!(target_mob in viewers(7,src)))
stance = CARP_STANCE_IDLE
stance_step = 1
target_mob = null
return
if(get_dist(src, target_mob) <= 1) //Attacking
if(isliving(target_mob))
var/mob/living/L = target_mob
L.attack_animal(src)
if(prob(10))
L.Weaken(5)
L.visible_message("<span class='danger'>\the [src] knocks down \the [L]!</span>")
/mob/living/simple_animal/carp/Process_Spacemove(var/check_drift = 0)
return //No drifting in space for space carp! //original comments do not steal
+33 -14
View File
@@ -69,29 +69,41 @@
switch(stance)
if(CLOWN_STANCE_IDLE)
if (src.hostile == 0) return
for( var/mob/living/L in viewers(7,src) )
if(isclown(L)) continue
if(!L.stat)
emote("honks menacingly at [L]")
stance = CLOWN_STANCE_ATTACK
target_mob = L
break
for(var/atom/A in view(7,src))
if(isclown(A))
continue
if(isliving(A))
var/mob/living/L = A
if(!L.stat)
stance = CLOWN_STANCE_ATTACK
target_mob = L
break
if(istype(A, /obj/mecha))
var/obj/mecha/M = A
if (M.occupant)
stance = CLOWN_STANCE_ATTACK
target_mob = M
break
if (target_mob)
emote("honks menacingly at [target_mob]")
if(CLOWN_STANCE_ATTACK) //This one should only be active for one tick
stop_automated_movement = 1
if(!target_mob || target_mob.stat)
if(!target_mob || SA_attackable(target_mob))
stance = CLOWN_STANCE_IDLE
if(target_mob in viewers(7,src))
if(target_mob in view(7,src))
walk_to(src, target_mob, 1, 3)
stance = CLOWN_STANCE_ATTACKING
if(CLOWN_STANCE_ATTACKING)
stop_automated_movement = 1
if(!target_mob || target_mob.stat)
if(!target_mob || SA_attackable(target_mob))
stance = CLOWN_STANCE_IDLE
target_mob = null
return
if(!(target_mob in viewers(7,src)))
if(!(target_mob in view(7,src)))
stance = CLOWN_STANCE_IDLE
target_mob = null
return
@@ -102,9 +114,16 @@
if(prob(10))
L.Weaken(5)
L.visible_message("<span class='danger'>\the [src] slips \the [L]!</span>")
for(var/mob/M in viewers(src, null))
if(istype(M, /mob/living/simple_animal/clown))
var/mob/living/simple_animal/clown/C = M
for(var/mob/H in viewers(src, null))
if(istype(H, /mob/living/simple_animal/clown))
var/mob/living/simple_animal/clown/C = H
C.hostile = 1
if(istype(target_mob,/obj/mecha))
var/obj/mecha/M = target_mob
M.attack_animal(src)
for(var/mob/H in viewers(src, null))
if(istype(H, /mob/living/simple_animal/clown))
var/mob/living/simple_animal/clown/C = H
C.hostile = 1
/mob/living/simple_animal/clown/bullet_act(var/obj/item/projectile/Proj)
@@ -107,7 +107,10 @@
/mob/living/simple_animal/construct/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(O.force)
health -= O.force
var/damage = O.force
if (O.damtype == HALLOSS)
damage = 0
health -= damage
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
@@ -145,7 +148,10 @@
/mob/living/simple_animal/construct/armoured/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(O.force)
if(O.force >= 11)
health -= O.force
var/damage = O.force
if (O.damtype == HALLOSS)
damage = 0
health -= damage
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
@@ -238,7 +244,10 @@
/mob/living/simple_animal/constructbehemoth/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(O.force)
if(O.force >= 11)
health -= O.force
var/damage = O.force
if (O.damtype == HALLOSS)
damage = 0
health -= damage
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
@@ -367,4 +367,43 @@
dir = i
sleep(1)
else
..()
..()
/mob/living/simple_animal/corgi/regenerate_icons()
overlays = list()
if(inventory_head)
var/head_icon_state = inventory_head.icon_state
if(health <= 0)
head_icon_state += "2"
var/icon/head_icon = icon('icons/mob/corgi_head.dmi',head_icon_state)
if(head_icon)
overlays += head_icon
if(inventory_back)
var/back_icon_state = inventory_back.icon_state
if(health <= 0)
back_icon_state += "2"
var/icon/back_icon = icon('icons/mob/corgi_back.dmi',back_icon_state)
if(back_icon)
overlays += back_icon
return
/mob/living/simple_animal/corgi/puppy
name = "\improper corgi puppy"
real_name = "corgi"
desc = "It's a corgi puppy."
icon_state = "puppy"
icon_living = "puppy"
icon_dead = "puppy_dead"
//pupplies cannot wear anything.
/mob/living/simple_animal/corgi/puppy/Topic(href, href_list)
if(href_list["remove_inv"] || href_list["add_inv"])
usr << "\red You can't fit this on [src]"
return
..()
@@ -0,0 +1,167 @@
//Space bears!
/mob/living/simple_animal/hostile/bear
name = "space bear"
desc = "RawrRawr!!"
icon_state = "bear"
icon_living = "bear"
icon_dead = "bear_dead"
icon_gib = "bear_gib"
speak = list("RAWR!","Rawr!","GRR!","Growl!")
speak_emote = list("growls", "roars")
emote_hear = list("rawrs","grumbles","grawls")
emote_see = list("stares ferociously", "stomps")
speak_chance = 1
turns_per_move = 5
see_in_dark = 6
meat_type = /obj/item/weapon/reagent_containers/food/snacks/meat
response_help = "pets the"
response_disarm = "gently pushes aside the"
response_harm = "pokes the"
stop_automated_movement_when_pulled = 0
maxHealth = 60
health = 60
melee_damage_lower = 20
melee_damage_upper = 30
//Space bears aren't affected by atmos.
min_oxy = 0
max_oxy = 0
min_tox = 0
max_tox = 0
min_co2 = 0
max_co2 = 0
min_n2 = 0
max_n2 = 0
minbodytemp = 0
//SPACE BEARS! SQUEEEEEEEE~ OW! FUCK! IT BIT MY HAND OFF!!
/mob/living/simple_animal/hostile/bear/Hudson
name = "Hudson"
desc = ""
response_help = "pets"
response_disarm = "gently pushes aside"
response_harm = "pokes"
/mob/living/simple_animal/hostile/bear/Life()
. =..()
if(!.)
return
if(loc && istype(loc,/turf/space))
icon_state = "bear"
else
icon_state = "bearfloor"
switch(stance)
if(HOSTILE_STANCE_TIRED)
stop_automated_movement = 1
stance_step++
if(stance_step >= 10) //rests for 10 ticks
if(target_mob && target_mob in ListTargets())
stance = HOSTILE_STANCE_ATTACK //If the mob he was chasing is still nearby, resume the attack, otherwise go idle.
else
stance = HOSTILE_STANCE_IDLE
if(HOSTILE_STANCE_ALERT)
stop_automated_movement = 1
var/found_mob = 0
if(target_mob && target_mob in ListTargets())
if(!(SA_attackable(target_mob)))
stance_step = max(0, stance_step) //If we have not seen a mob in a while, the stance_step will be negative, we need to reset it to 0 as soon as we see a mob again.
stance_step++
found_mob = 1
src.dir = get_dir(src,target_mob) //Keep staring at the mob
if(stance_step in list(1,4,7)) //every 3 ticks
var/action = pick( list( "growls at [target_mob]", "stares angrily at [target_mob]", "prepares to attack [target_mob]", "closely watches [target_mob]" ) )
if(action)
emote(action)
if(!found_mob)
stance_step--
if(stance_step <= -20) //If we have not found a mob for 20-ish ticks, revert to idle mode
stance = HOSTILE_STANCE_IDLE
if(stance_step >= 7) //If we have been staring at a mob for 7 ticks,
stance = HOSTILE_STANCE_ATTACK
if(HOSTILE_STANCE_ATTACKING)
if(stance_step >= 20) //attacks for 20 ticks, then it gets tired and needs to rest
emote( "is worn out and needs to rest" )
stance = HOSTILE_STANCE_TIRED
stance_step = 0
walk(src, 0) //This stops the bear's walking
return
/mob/living/simple_animal/hostile/bear/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(stance != HOSTILE_STANCE_ATTACK && stance != HOSTILE_STANCE_ATTACKING)
stance = HOSTILE_STANCE_ALERT
stance_step = 6
target_mob = user
..()
/mob/living/simple_animal/hostile/bear/attack_hand(mob/living/carbon/human/M as mob)
if(stance != HOSTILE_STANCE_ATTACK && stance != HOSTILE_STANCE_ATTACKING)
stance = HOSTILE_STANCE_ALERT
stance_step = 6
target_mob = M
..()
/mob/living/simple_animal/hostile/bear/Process_Spacemove(var/check_drift = 0)
return //No drifting in space for space bears!
/mob/living/simple_animal/hostile/bear/FindTarget()
. = ..()
if(.)
emote("stares alertly at [.]")
stance = HOSTILE_STANCE_ALERT
/mob/living/simple_animal/hostile/bear/LoseTarget()
..(5)
/mob/living/simple_animal/hostile/bear/AttackingTarget()
emote( pick( list("slashes at [target_mob]", "bites [target_mob]") ) )
var/damage = rand(20,30)
if(ishuman(target_mob))
var/mob/living/carbon/human/H = target_mob
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
var/datum/organ/external/affecting = H.get_organ(ran_zone(dam_zone))
H.apply_damage(damage, BRUTE, affecting, H.run_armor_check(affecting, "melee"))
return H
else if(isliving(target_mob))
var/mob/living/L = target_mob
L.adjustBruteLoss(damage)
return L
else if(istype(target_mob,/obj/mecha))
var/obj/mecha/M = target_mob
M.attack_animal(src)
return M
@@ -0,0 +1,52 @@
/mob/living/simple_animal/hostile/carp
name = "space carp"
desc = "A ferocious, fang-bearing creature that resembles a fish."
icon_state = "carp"
icon_living = "carp"
icon_dead = "carp_dead"
icon_gib = "carp_gib"
speak_chance = 0
turns_per_move = 5
meat_type = /obj/item/weapon/reagent_containers/food/snacks/carpmeat
response_help = "pets the"
response_disarm = "gently pushes aside the"
response_harm = "hits the"
speed = -1
stop_automated_movement_when_pulled = 0
maxHealth = 25
health = 25
harm_intent_damage = 8
melee_damage_lower = 15
melee_damage_upper = 15
attacktext = "bites"
attack_sound = 'sound/weapons/bite.ogg'
//Space carp aren't affected by atmos.
min_oxy = 0
max_oxy = 0
min_tox = 0
max_tox = 0
min_co2 = 0
max_co2 = 0
min_n2 = 0
max_n2 = 0
minbodytemp = 0
/mob/living/simple_animal/hostile/carp/Process_Spacemove(var/check_drift = 0)
return //No drifting in space for space carp! //original comments do not steal
/mob/living/simple_animal/hostile/carp/FindTarget()
. = ..()
if(.)
emote("nashes at [.]")
/mob/living/simple_animal/hostile/carp/AttackingTarget()
. =..()
var/mob/living/L = .
if(istype(L))
if(prob(15))
L.Weaken(3)
L.visible_message("<span class='danger'>\the [src] knocks down \the [L]!</span>")
@@ -0,0 +1,103 @@
/mob/living/simple_animal/hostile
var/stance = HOSTILE_STANCE_IDLE //Used to determine behavior
var/stance_step = 0 //Used to delay checks depending on what stance the hostile
var/mob/living/target_mob //Once the bear enters attack stance, it will try to chase this mob. This it to prevent it changing it's mind between multiple mobs.
var/attack_same = 0
/mob/living/simple_animal/hostile/proc/FindTarget()
var/atom/T = null
stop_automated_movement = 0
stance_step++
if(stance_step > 5)
stance_step = 0
for(var/atom/A in ListTargets())
if(!attack_same && istype(A, src.type))
continue
if(isliving(A))
var/mob/living/L = A
if(!L.stat)
stance = HOSTILE_STANCE_ATTACK
T = L
break
if(istype(A, /obj/mecha))
var/obj/mecha/M = A
if (M.occupant)
stance = HOSTILE_STANCE_ATTACK
T = M
break
return T
/mob/living/simple_animal/hostile/proc/MoveToTarget(var/step = 5)
stop_automated_movement = 1
if(!target_mob || SA_attackable(target_mob))
stance = HOSTILE_STANCE_IDLE
stance_step = step //Make it very alert, so it quickly attacks again if a mob returns
if(target_mob in ListTargets())
walk_to(src, target_mob, 1, 3)
stance = HOSTILE_STANCE_ATTACKING
stance_step = 0
/mob/living/simple_animal/hostile/proc/AttackTarget()
stop_automated_movement = 1
stance_step++
if(!target_mob || SA_attackable(target_mob))
LoseTarget()
return
if(!(target_mob in ListTargets()))
LostTarget()
return
if(get_dist(src, target_mob) <= 1) //Attacking
AttackingTarget()
/mob/living/simple_animal/hostile/proc/AttackingTarget()
if(isliving(target_mob))
var/mob/living/L = target_mob
L.attack_animal(src)
return L
if(istype(target_mob,/obj/mecha))
var/obj/mecha/M = target_mob
M.attack_animal(src)
return M
/mob/living/simple_animal/hostile/proc/LoseTarget(var/step = 3)
stance = HOSTILE_STANCE_IDLE
stance_step = step
target_mob = null
walk(src, 0)
/mob/living/simple_animal/hostile/proc/LostTarget(var/step = 1)
stance = HOSTILE_STANCE_IDLE
stance_step = step
walk(src, 0)
/mob/living/simple_animal/hostile/proc/ListTargets()
return view(src, 7)
/mob/living/simple_animal/hostile/Die()
..()
walk(src, 0)
/mob/living/simple_animal/hostile/Life()
. = ..()
if(!.)
walk(src, 0)
return 0
if(client)
return 0
if(!stat)
switch(stance)
if(HOSTILE_STANCE_IDLE)
target_mob = FindTarget()
if(HOSTILE_STANCE_ATTACK) //This one should only be active for one tick
MoveToTarget()
if(HOSTILE_STANCE_ATTACKING)
AttackTarget()
@@ -1,417 +0,0 @@
/mob/living/simple_animal
name = "animal"
icon = 'icons/mob/animal.dmi'
health = 20
maxHealth = 20
var/icon_living = ""
var/icon_dead = ""
var/icon_gib = null //We only try to show a gibbing animation if this exists.
var/list/speak = list()
var/list/speak_emote = list()// Emotes while speaking IE: Ian [emote], [text] -- Ian barks, "WOOF!". Spoken text is generated from the speak variable.
var/speak_chance = 0
var/list/emote_hear = list() //Hearable emotes
var/list/emote_see = list() //Unlike speak_emote, the list of things in this variable only show by themselves with no spoken text. IE: Ian barks, Ian yaps
var/turns_per_move = 1
var/turns_since_move = 0
universal_speak = 1
var/meat_amount = 0
var/meat_type
var/stop_automated_movement = 0 //Use this to temporarely stop random movement or to if you write special movement code for animals.
var/stop_automated_movement_when_pulled = 1 //When set to 1 this stops the animal from moving when someone is pulling it.
//Interaction
var/response_help = "You try to help"
var/response_disarm = "You try to disarm"
var/response_harm = "You try to hurt"
var/harm_intent_damage = 3
//Temperature effect
var/minbodytemp = 250
var/maxbodytemp = 350
var/heat_damage_per_tick = 3 //amount of damage applied if animal's body temperature is higher than maxbodytemp
var/cold_damage_per_tick = 2 //same as heat_damage_per_tick, only if the bodytemperature it's lower than minbodytemp
//Atmos effect - Yes, you can make creatures that require plasma or co2 to survive. N2O is a trace gas and handled separately, hence why it isn't here. It'd be hard to add it. Hard and me don't mix (Yes, yes make all the dick jokes you want with that.) - Errorage
var/min_oxy = 5
var/max_oxy = 0 //Leaving something at 0 means it's off - has no maximum
var/min_tox = 0
var/max_tox = 1
var/min_co2 = 0
var/max_co2 = 5
var/min_n2 = 0
var/max_n2 = 0
var/unsuitable_atoms_damage = 2 //This damage is taken when atmos doesn't fit all the requirements above
//LETTING SIMPLE ANIMALS ATTACK? WHAT COULD GO WRONG. Defaults to zero so Ian can still be cuddly
var/melee_damage_lower = 0
var/melee_damage_upper = 0
var/attacktext = "attacks"
var/attack_sound = null
var/friendly = "nuzzles" //If the mob does no damage with it's attack
var/wall_smash = 0 //if they can smash walls
var/speed = 0 //LETS SEE IF I CAN SET SPEEDS FOR SIMPLE MOBS WITHOUT DESTROYING EVERYTHING. Higher speed is slower, negative speed is faster
/mob/living/simple_animal/New()
..()
verbs -= /mob/verb/observe
/mob/living/simple_animal/Login()
if(src && src.client)
src.client.screen = null
..()
/mob/living/simple_animal/Life()
//Health
if(stat == DEAD)
if(health > 0)
icon_state = icon_living
dead_mob_list -= src
living_mob_list += src
stat = CONSCIOUS
density = 1
return
if(health < 1)
Die()
if(health > maxHealth)
health = maxHealth
if(stunned)
AdjustStunned(-1)
if(weakened)
AdjustWeakened(-1)
if(paralysis)
AdjustParalysis(-1)
//Movement
if(!client && !stop_automated_movement)
if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc.
turns_since_move++
if(turns_since_move >= turns_per_move)
if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
//Speaking
if(!client && speak_chance)
if(rand(0,200) < speak_chance)
if(speak && speak.len)
if((emote_hear && emote_hear.len) || (emote_see && emote_see.len))
var/length = speak.len
if(emote_hear && emote_hear.len)
length += emote_hear.len
if(emote_see && emote_see.len)
length += emote_see.len
var/randomValue = rand(1,length)
if(randomValue <= speak.len)
say(pick(speak))
else
randomValue -= speak.len
if(emote_see && randomValue <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
else
say(pick(speak))
else
if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len))
emote(pick(emote_see),1)
if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len))
emote(pick(emote_hear),2)
if((emote_hear && emote_hear.len) && (emote_see && emote_see.len))
var/length = emote_hear.len + emote_see.len
var/pick = rand(1,length)
if(pick <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
//Atmos
var/atmos_suitable = 1
var/atom/A = src.loc
if(isturf(A))
var/turf/T = A
var/areatemp = T.temperature
if( abs(areatemp - bodytemperature) > 40 )
var/diff = areatemp - bodytemperature
diff = diff / 5
//world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]"
bodytemperature += diff
if(istype(T,/turf/simulated))
var/turf/simulated/ST = T
if(ST.air)
var/tox = ST.air.toxins
var/oxy = ST.air.oxygen
var/n2 = ST.air.nitrogen
var/co2 = ST.air.carbon_dioxide
if(min_oxy)
if(oxy < min_oxy)
atmos_suitable = 0
if(max_oxy)
if(oxy > max_oxy)
atmos_suitable = 0
if(min_tox)
if(tox < min_tox)
atmos_suitable = 0
if(max_tox)
if(tox > max_tox)
atmos_suitable = 0
if(min_n2)
if(n2 < min_n2)
atmos_suitable = 0
if(max_n2)
if(n2 > max_n2)
atmos_suitable = 0
if(min_co2)
if(co2 < min_co2)
atmos_suitable = 0
if(max_co2)
if(co2 > max_co2)
atmos_suitable = 0
//Atmos effect
if(bodytemperature < minbodytemp)
health -= cold_damage_per_tick
else if(bodytemperature > maxbodytemp)
health -= heat_damage_per_tick
if(!atmos_suitable)
health -= unsuitable_atoms_damage
/mob/living/simple_animal/Bumped(AM as mob|obj)
if(!AM) return
if(resting || buckled)
return
if(isturf(src.loc))
if(ismob(AM))
var/newamloc = src.loc
src.loc = AM:loc
AM:loc = newamloc
else
..()
/mob/living/simple_animal/gib()
if(icon_gib)
flick(icon_gib, src)
if(meat_amount && meat_type)
for(var/i = 0; i < meat_amount; i++)
new meat_type(src.loc)
..()
/mob/living/simple_animal/say_quote(var/text)
if(speak_emote && speak_emote.len)
var/emote = pick(speak_emote)
if(emote)
return "[emote], \"[text]\""
return "says, \"[text]\"";
/mob/living/simple_animal/emote(var/act)
if(act)
if(act == "scream") act = "makes a loud and pained whimper" //ugly hack to stop animals screaming when crushed :P
for (var/mob/O in viewers(src, null))
O.show_message("<B>[src]</B> [act].")
/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob)
if(M.melee_damage_upper == 0)
M.emote("[M.friendly] [src]")
else
if(M.attack_sound)
playsound(loc, M.attack_sound, 50, 1, 1)
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[M]</B> [M.attacktext] [src]!", 1)
M.attack_log += text("\[[time_stamp()]\] <font color='red'>attacked [src.name] ([src.ckey])</font>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>was attacked by [M.name] ([M.ckey])</font>")
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
health -= damage
/mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
if(!Proj) return
src.health -= Proj.damage
return 0
/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob)
..()
switch(M.a_intent)
if("help")
if (health > 0)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_help] [src]")
if("grab")
if (M == src)
return
if (nopush)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M, M, src )
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
LAssailant = M
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
if("hurt")
health -= harm_intent_damage
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\red [M] [response_harm] [src]")
if("disarm")
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_disarm] [src]")
return
/mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M as mob)
switch(M.a_intent)
if ("help")
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\blue [M] caresses [src] with its scythe like arm."), 1)
if ("grab")
if(M == src)
return
if (nopush)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M, M, src )
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
LAssailant = M
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
if("hurt")
var/damage = rand(15, 30)
visible_message("\red <B>[M] has slashed at [src]!</B>")
src.health -= damage
if("disarm")
var/damage = rand(15, 30)
visible_message("\red <B>[M] has slashed at [src]!</B>")
src.health -= damage
return
/mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L as mob)
switch(L.a_intent)
if("help")
visible_message("\blue [L] rubs it's head against [src]")
else
var/damage = rand(5, 10)
visible_message("\red <B>[L] bites [src]!</B>")
if(stat != DEAD)
src.health -= damage
L.amount_grown = min(L.amount_grown + damage, L.max_grown)
/mob/living/simple_animal/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
if(istype(O, /obj/item/stack/medical))
if(stat != DEAD)
var/obj/item/stack/medical/MED = O
if(health < maxHealth)
if(MED.amount >= 1)
health = min(maxHealth, health + MED.heal_brute)
MED.amount -= 1
if(MED.amount <= 0)
del(MED)
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\blue [user] applies the [MED] on [src]")
else
user << "\blue this [src] is dead, medical items won't bring it back to life."
if(meat_type && (stat == DEAD)) //if the animal has a meat, and if it is dead.
if(istype(O, /obj/item/weapon/kitchenknife) || istype(O, /obj/item/weapon/butch))
new meat_type (get_turf(src))
if(prob(95))
del(src)
return
gib()
else
if(O.force)
health -= O.force
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
else
usr << "\red This weapon is ineffective, it does no damage."
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red [user] gently taps [src] with the [O]. ")
/mob/living/simple_animal/movement_delay()
var/tally = 0 //Incase I need to add stuff other than "speed" later
tally = speed
return tally+config.animal_delay
/mob/living/simple_animal/Stat()
..()
statpanel("Status")
stat(null, "Health: [round((health / maxHealth) * 100)]%")
/mob/living/simple_animal/proc/Die()
living_mob_list -= src
dead_mob_list += src
icon_state = icon_dead
stat = DEAD
density = 0
return
/mob/living/simple_animal/ex_act(severity)
if(!blinded)
flick("flash", flash)
switch (severity)
if (1.0)
health -= 500
gib()
return
if (2.0)
health -= 60
if(3.0)
health -= 30
/mob/living/simple_animal/adjustBruteLoss(damage)
health -= damage
+17 -21
View File
@@ -48,12 +48,14 @@
response_harm = "swats the"
stop_automated_movement = 1
var/parrot_state = PARROT_WANDER //Hunt for a perch when created
var/parrot_sleep_max = 25 //The time the parrot sits while perched before looking around. Mosly a way to avoid the parrot's AI in life() being run every single tick.
var/parrot_sleep_dur = 25 //Same as above, this is the var that physically counts down
var/parrot_dam_zone = list("chest", "head", "l_arm", "l_leg", "r_arm", "r_leg") //For humans, select a bodypart to attack
var/parrot_speed = 5 //"Delay in world ticks between movement." Yeah, that's BS but it does directly affect movement. Higher number = slower.
var/parrot_been_shot = 0 //Parrots get a speed bonus after being shot. This will deincrement every Life() and at 0 the parrot will return to regular speed.
var/list/speech_buffer = list()
var/list/available_channels = list()
@@ -91,7 +93,6 @@
/mob/living/simple_animal/parrot/New()
usr << "\red Parrots are still a work in progress, use at your own risk."
..()
parrot_sleep_dur = parrot_sleep_max //In case someone decides to change the max without changing the duration var
verbs.Add(/mob/living/simple_animal/parrot/proc/steal_from_ground, \
@@ -267,6 +268,7 @@
parrot_interest = null
parrot_state = PARROT_WANDER //OWFUCK, Been shot! RUN LIKE HELL!
parrot_been_shot += 5
icon_state = "parrot_fly"
drop_held_item(0)
return
@@ -291,6 +293,7 @@
if(!isturf(src.loc) || !canmove || buckled)
return //If it can't move, dont let it move. (The buckled check probably isn't necessary thanks to canmove)
//-----SPEECH
/* Parrot speech mimickry!
Phrases that the parrot hears in mob/living/say() get added to speach_buffer.
@@ -304,7 +307,6 @@
clearlist(speech_buffer)
//Alright, here we go... down the slope
//-----SLEEPING
if(parrot_state == PARROT_PERCH)
@@ -419,11 +421,7 @@
parrot_state = PARROT_SWOOP | PARROT_RETURN
return
var/oldloc = src.loc
step_towards(src, get_step_towards(src,parrot_interest))
if(src.loc == oldloc) //Check if the mob is stuck
parrot_state = PARROT_WANDER //and demonstrate your amazing obstical avoidance AI
walk_to(src, parrot_interest, 1, parrot_speed)
return
//-----RETURNING TO PERCH
@@ -441,10 +439,7 @@
icon_state = "parrot_sit"
return
var/oldloc = src.loc
step_towards(src, get_step_towards(src,parrot_perch))
if(src.loc == oldloc) //Check if the mob is stuck
parrot_state = PARROT_WANDER //and demonstrate your amazing obstical avoidance AI
walk_to(src, parrot_perch, 1, parrot_speed)
return
//-----FLEEING
@@ -453,10 +448,9 @@
if(!parrot_interest || !isliving(parrot_interest)) //Sanity
parrot_state = PARROT_WANDER
var/oldloc = src.loc
step(src, get_step_away(src, parrot_interest))
if(src.loc == oldloc) //Check if the mob is stuck
parrot_state = PARROT_WANDER //and demonstrate your amazing obstical avoidance AI
walk_away(src, parrot_interest, 1, parrot_speed-parrot_been_shot)
parrot_been_shot--
return
//-----ATTACKING
else if(parrot_state == (PARROT_SWOOP | PARROT_ATTACK))
@@ -502,11 +496,8 @@
//Otherwise, fly towards the mob!
else
var/oldloc = src.loc
step_towards(src, get_step_towards(src,parrot_interest))
if(src.loc == oldloc) //Check if the mob is stuck
parrot_state = PARROT_WANDER //and demonstrate your amazing obstical avoidance AI
walk_to(src, parrot_interest, 1, parrot_speed)
return
//-----STATE MISHAP
else //This should not happen. If it does lets reset everything and try again
walk(src,0)
@@ -637,7 +628,11 @@
set category = "Parrot"
set desc = "Drop the item you're holding."
if(stat)
return
src.drop_held_item()
return
/mob/living/simple_animal/parrot/proc/drop_held_item(var/drop_gently = 1)
@@ -682,6 +677,7 @@
src.loc = AM.loc
icon_state = "parrot_sit"
return
src << "\red There is no perch nearby to sit on."
return
/*
@@ -43,7 +43,10 @@
O.transfer_soul("SHADE", src, user)
else
if(O.force)
health -= O.force
var/damage = O.force
if (O.damtype == HALLOSS)
damage = 0
health -= damage
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
@@ -1,2 +1,435 @@
/mob/living/simple_animal
name = "animal"
icon = 'icons/mob/animal.dmi'
health = 20
maxHealth = 20
var/icon_living = ""
var/icon_dead = ""
var/icon_gib = null //We only try to show a gibbing animation if this exists.
var/list/speak = list()
var/list/speak_emote = list()// Emotes while speaking IE: Ian [emote], [text] -- Ian barks, "WOOF!". Spoken text is generated from the speak variable.
var/speak_chance = 0
var/list/emote_hear = list() //Hearable emotes
var/list/emote_see = list() //Unlike speak_emote, the list of things in this variable only show by themselves with no spoken text. IE: Ian barks, Ian yaps
var/turns_per_move = 1
var/turns_since_move = 0
universal_speak = 1
var/meat_amount = 0
var/meat_type
var/stop_automated_movement = 0 //Use this to temporarely stop random movement or to if you write special movement code for animals.
var/stop_automated_movement_when_pulled = 1 //When set to 1 this stops the animal from moving when someone is pulling it.
//Interaction
var/response_help = "You try to help"
var/response_disarm = "You try to disarm"
var/response_harm = "You try to hurt"
var/harm_intent_damage = 3
//Temperature effect
var/minbodytemp = 250
var/maxbodytemp = 350
var/heat_damage_per_tick = 3 //amount of damage applied if animal's body temperature is higher than maxbodytemp
var/cold_damage_per_tick = 2 //same as heat_damage_per_tick, only if the bodytemperature it's lower than minbodytemp
//Atmos effect - Yes, you can make creatures that require plasma or co2 to survive. N2O is a trace gas and handled separately, hence why it isn't here. It'd be hard to add it. Hard and me don't mix (Yes, yes make all the dick jokes you want with that.) - Errorage
var/min_oxy = 5
var/max_oxy = 0 //Leaving something at 0 means it's off - has no maximum
var/min_tox = 0
var/max_tox = 1
var/min_co2 = 0
var/max_co2 = 5
var/min_n2 = 0
var/max_n2 = 0
var/unsuitable_atoms_damage = 2 //This damage is taken when atmos doesn't fit all the requirements above
//LETTING SIMPLE ANIMALS ATTACK? WHAT COULD GO WRONG. Defaults to zero so Ian can still be cuddly
var/melee_damage_lower = 0
var/melee_damage_upper = 0
var/attacktext = "attacks"
var/attack_sound = null
var/friendly = "nuzzles" //If the mob does no damage with it's attack
var/wall_smash = 0 //if they can smash walls
var/speed = 0 //LETS SEE IF I CAN SET SPEEDS FOR SIMPLE MOBS WITHOUT DESTROYING EVERYTHING. Higher speed is slower, negative speed is faster
/mob/living/simple_animal/New()
..()
verbs -= /mob/verb/observe
/mob/living/simple_animal/Login()
if(src && src.client)
src.client.screen = null
..()
/mob/living/simple_animal/updatehealth()
return
return
/mob/living/simple_animal/Life()
//Health
if(stat == DEAD)
if(health > 0)
icon_state = icon_living
dead_mob_list -= src
living_mob_list += src
stat = CONSCIOUS
density = 1
return 0
if(health < 1)
Die()
if(health > maxHealth)
health = maxHealth
if(stunned)
AdjustStunned(-1)
if(weakened)
AdjustWeakened(-1)
if(paralysis)
AdjustParalysis(-1)
//Movement
if(!client && !stop_automated_movement)
if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc.
turns_since_move++
if(turns_since_move >= turns_per_move)
if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
//Speaking
if(!client && speak_chance)
if(rand(0,200) < speak_chance)
if(speak && speak.len)
if((emote_hear && emote_hear.len) || (emote_see && emote_see.len))
var/length = speak.len
if(emote_hear && emote_hear.len)
length += emote_hear.len
if(emote_see && emote_see.len)
length += emote_see.len
var/randomValue = rand(1,length)
if(randomValue <= speak.len)
say(pick(speak))
else
randomValue -= speak.len
if(emote_see && randomValue <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
else
say(pick(speak))
else
if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len))
emote(pick(emote_see),1)
if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len))
emote(pick(emote_hear),2)
if((emote_hear && emote_hear.len) && (emote_see && emote_see.len))
var/length = emote_hear.len + emote_see.len
var/pick = rand(1,length)
if(pick <= emote_see.len)
emote(pick(emote_see),1)
else
emote(pick(emote_hear),2)
//Atmos
var/atmos_suitable = 1
var/atom/A = src.loc
if(isturf(A))
var/turf/T = A
var/areatemp = T.temperature
if( abs(areatemp - bodytemperature) > 40 )
var/diff = areatemp - bodytemperature
diff = diff / 5
//world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]"
bodytemperature += diff
if(istype(T,/turf/simulated))
var/turf/simulated/ST = T
if(ST.air)
var/tox = ST.air.toxins
var/oxy = ST.air.oxygen
var/n2 = ST.air.nitrogen
var/co2 = ST.air.carbon_dioxide
if(min_oxy)
if(oxy < min_oxy)
atmos_suitable = 0
if(max_oxy)
if(oxy > max_oxy)
atmos_suitable = 0
if(min_tox)
if(tox < min_tox)
atmos_suitable = 0
if(max_tox)
if(tox > max_tox)
atmos_suitable = 0
if(min_n2)
if(n2 < min_n2)
atmos_suitable = 0
if(max_n2)
if(n2 > max_n2)
atmos_suitable = 0
if(min_co2)
if(co2 < min_co2)
atmos_suitable = 0
if(max_co2)
if(co2 > max_co2)
atmos_suitable = 0
//Atmos effect
if(bodytemperature < minbodytemp)
health -= cold_damage_per_tick
else if(bodytemperature > maxbodytemp)
health -= heat_damage_per_tick
if(!atmos_suitable)
health -= unsuitable_atoms_damage
return 1
/mob/living/simple_animal/Bumped(AM as mob|obj)
if(!AM) return
if(resting || buckled)
return
if(isturf(src.loc))
if(ismob(AM))
var/newamloc = src.loc
src.loc = AM:loc
AM:loc = newamloc
else
..()
/mob/living/simple_animal/gib()
if(icon_gib)
flick(icon_gib, src)
if(meat_amount && meat_type)
for(var/i = 0; i < meat_amount; i++)
new meat_type(src.loc)
..()
/mob/living/simple_animal/say_quote(var/text)
if(speak_emote && speak_emote.len)
var/emote = pick(speak_emote)
if(emote)
return "[emote], \"[text]\""
return "says, \"[text]\"";
/mob/living/simple_animal/emote(var/act)
if(act)
if(act == "scream") act = "makes a loud and pained whimper" //ugly hack to stop animals screaming when crushed :P
for (var/mob/O in viewers(src, null))
O.show_message("<B>[src]</B> [act].")
/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob)
if(M.melee_damage_upper == 0)
M.emote("[M.friendly] [src]")
else
if(M.attack_sound)
playsound(loc, M.attack_sound, 50, 1, 1)
for(var/mob/O in viewers(src, null))
O.show_message("\red <B>[M]</B> [M.attacktext] [src]!", 1)
M.attack_log += text("\[[time_stamp()]\] <font color='red'>attacked [src.name] ([src.ckey])</font>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>was attacked by [M.name] ([M.ckey])</font>")
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
health -= damage
/mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
if(!Proj) return
src.health -= Proj.damage
return 0
/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob)
..()
switch(M.a_intent)
if("help")
if (health > 0)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_help] [src]")
if("grab")
if (M == src)
return
if (nopush)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M, M, src )
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
LAssailant = M
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
if("hurt")
health -= harm_intent_damage
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\red [M] [response_harm] [src]")
if("disarm")
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message("\blue [M] [response_disarm] [src]")
return
/mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M as mob)
switch(M.a_intent)
if ("help")
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\blue [M] caresses [src] with its scythe like arm."), 1)
if ("grab")
if(M == src)
return
if (nopush)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M, M, src )
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
LAssailant = M
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
if("hurt")
var/damage = rand(15, 30)
visible_message("\red <B>[M] has slashed at [src]!</B>")
src.health -= damage
if("disarm")
var/damage = rand(15, 30)
visible_message("\red <B>[M] has slashed at [src]!</B>")
src.health -= damage
return
/mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L as mob)
switch(L.a_intent)
if("help")
visible_message("\blue [L] rubs it's head against [src]")
else
var/damage = rand(5, 10)
visible_message("\red <B>[L] bites [src]!</B>")
if(stat != DEAD)
src.health -= damage
L.amount_grown = min(L.amount_grown + damage, L.max_grown)
/mob/living/simple_animal/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
if(istype(O, /obj/item/stack/medical))
if(stat != DEAD)
var/obj/item/stack/medical/MED = O
if(health < maxHealth)
if(MED.amount >= 1)
health = min(maxHealth, health + MED.heal_brute)
MED.amount -= 1
if(MED.amount <= 0)
del(MED)
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\blue [user] applies the [MED] on [src]")
else
user << "\blue this [src] is dead, medical items won't bring it back to life."
if(meat_type && (stat == DEAD)) //if the animal has a meat, and if it is dead.
if(istype(O, /obj/item/weapon/kitchenknife) || istype(O, /obj/item/weapon/butch))
new meat_type (get_turf(src))
if(prob(95))
del(src)
return
gib()
else
if(O.force)
var/damage = O.force
if (O.damtype == HALLOSS)
damage = 0
health -= damage
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
else
usr << "\red This weapon is ineffective, it does no damage."
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red [user] gently taps [src] with the [O]. ")
/mob/living/simple_animal/movement_delay()
var/tally = 0 //Incase I need to add stuff other than "speed" later
tally = speed
return tally+config.animal_delay
/mob/living/simple_animal/Stat()
..()
statpanel("Status")
stat(null, "Health: [round((health / maxHealth) * 100)]%")
/mob/living/simple_animal/proc/Die()
living_mob_list -= src
dead_mob_list += src
icon_state = icon_dead
stat = DEAD
density = 0
return
/mob/living/simple_animal/ex_act(severity)
if(!blinded)
flick("flash", flash)
switch (severity)
if (1.0)
health -= 500
gib()
return
if (2.0)
health -= 60
if(3.0)
health -= 30
/mob/living/simple_animal/adjustBruteLoss(damage)
health -= damage
/mob/living/simple_animal/proc/SA_attackable(target_mob)
if (isliving(target_mob))
var/mob/living/L = target_mob
if(!L.stat)
return (0)
if (istype(target_mob,/obj/mecha))
var/obj/mecha/M = target_mob
if (M.occupant)
return (0)
return (1)
@@ -16,8 +16,8 @@
response_harm = "hits the"
speed = -1
stop_automated_movement_when_pulled = 0
maxHealth = 75
health = 75
maxHealth = 100
health = 100
var/ranged = 0
var/target
var/rapid = 0
@@ -38,6 +38,7 @@
min_n2 = 0
max_n2 = 0
unsuitable_atoms_damage = 15
wall_smash = 1
var/stance = SYNDICATE_STANCE_IDLE //Used to determine behavior
var/mob/living/target_mob
@@ -53,6 +54,10 @@
del src
return
for(dir in list(NORTH,EAST,SOUTH,WEST))
var/obj/structure/obstacle = locate(/obj/structure, get_step(src, dir))
if(istype(obstacle, /obj/structure/window) || istype(obstacle, /obj/structure/closet) || istype(obstacle, /obj/structure/table) || istype(obstacle, /obj/structure/grille))
obstacle.attack_animal(src)
if(health < 1)
Die()
@@ -71,35 +76,48 @@
if(!stat)
switch(stance)
if(SYNDICATE_STANCE_IDLE)
stop_automated_movement = 0
for( var/mob/living/L in viewers(7,src) )
if(isSyndicate(L)) continue
if(!L.stat)
stance = SYNDICATE_STANCE_ATTACK
target_mob = L
break
for(var/atom/A in view(7,src))
if(isSyndicate(A))
continue
if(isliving(A))
var/mob/living/L = A
if(!L.stat)
stance = SYNDICATE_STANCE_ATTACK
target_mob = L
break
if(istype(A, /obj/mecha))
var/obj/mecha/M = A
if (M.occupant)
stance = SYNDICATE_STANCE_ATTACK
target_mob = M
break
if(SYNDICATE_STANCE_ATTACK) //This one should only be active for one tick
stop_automated_movement = 1
if(!target_mob || target_mob.stat)
if(!target_mob || SA_attackable(target_mob))
stance = SYNDICATE_STANCE_IDLE
if(target_mob in viewers(10,src))
if(target_mob in view(7, src))
if(ranged)
if(get_dist(src, target_mob) <= 6)
OpenFire(target_mob)
else
walk_to(src, target_mob, 1, 3)
walk_to(src, target_mob, 1, 2)
else
walk_to(src, target_mob, 1, 3)
walk_to(src, target_mob, 1, 2)
stance = SYNDICATE_STANCE_ATTACKING
if(SYNDICATE_STANCE_ATTACKING)
stop_automated_movement = 1
if(!target_mob || target_mob.stat)
if(!target_mob || SA_attackable(target_mob))
stance = SYNDICATE_STANCE_IDLE
target_mob = null
return
if(!(target_mob in viewers(7,src)))
if(!(target_mob in view(7, src)))
stance = SYNDICATE_STANCE_IDLE
target_mob = null
return
@@ -107,8 +125,9 @@
if(isliving(target_mob))
var/mob/living/L = target_mob
L.attack_animal(src)
if(istype(target_mob,/obj/mecha))
var/obj/mecha/M = target_mob
M.attack_animal(src)
/mob/living/simple_animal/syndicate/proc/OpenFire(target_mob)
src.target = target_mob
@@ -129,7 +148,8 @@
Shoot(tturf, src.loc, src)
new /obj/item/ammo_casing/a12mm(get_turf(src))
stance = SYNDICATE_STANCE_ATTACK
stance = SYNDICATE_STANCE_IDLE
target_mob = null
return
@@ -156,18 +176,22 @@
///////////////Sword and shield////////////
/mob/living/simple_animal/syndicate/melee
melee_damage_lower = 30
melee_damage_upper = 30
melee_damage_lower = 20
melee_damage_upper = 25
icon_state = "syndicatemelee"
icon_living = "syndicatemelee"
weapon1 = /obj/item/weapon/melee/energy/sword/red
weapon2 = /obj/item/weapon/shield/energy
attacktext = "slashes"
nopush = 1
/mob/living/simple_animal/syndicate/melee/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(O.force)
if(prob(35))
health -= O.force
if(prob(80))
var/damage = O.force
if (O.damtype == HALLOSS)
damage = 0
health -= damage
visible_message("\red \b [src] has been attacked with the [O] by [user]. ")
else
visible_message("\red \b [src] blocks the [O] with its shield! ")
@@ -178,7 +202,7 @@
/mob/living/simple_animal/syndicate/melee/bullet_act(var/obj/item/projectile/Proj)
if(!Proj) return
if(prob(35))
if(prob(65))
src.health -= Proj.damage
else
visible_message("\red <B>[src] blocks [Proj] with its shield!</B>")
@@ -199,6 +223,7 @@
icon_living = "syndicatemeleespace"
name = "Syndicate Commando"
corpse = /obj/effect/landmark/corpse/syndicatecommando
speed = 0
/mob/living/simple_animal/syndicate/melee/space/Process_Spacemove(var/check_drift = 0)
return
@@ -224,6 +249,7 @@
max_n2 = 0
minbodytemp = 0
corpse = /obj/effect/landmark/corpse/syndicatecommando
speed = 0
/mob/living/simple_animal/syndicate/ranged/space/Process_Spacemove(var/check_drift = 0)
return
@@ -1,21 +0,0 @@
/mob/living/simple_animal/corgi/regenerate_icons()
overlays = list()
if(inventory_head)
var/head_icon_state = inventory_head.icon_state
if(health <= 0)
head_icon_state += "2"
var/icon/head_icon = icon('icons/mob/corgi_head.dmi',head_icon_state)
if(head_icon)
overlays += head_icon
if(inventory_back)
var/back_icon_state = inventory_back.icon_state
if(health <= 0)
back_icon_state += "2"
var/icon/back_icon = icon('icons/mob/corgi_back.dmi',back_icon_state)
if(back_icon)
overlays += back_icon
return
+2 -2
View File
@@ -42,7 +42,7 @@ Put (mob/proc)s here that are in dire need of a code cleanup.
v.affected_mob = src
v.strain_data = v.strain_data.Copy()
v.holder = src
if(prob(5))
if(v.can_carry && prob(5))
v.carrier = 1
return
@@ -194,7 +194,7 @@ Put (mob/proc)s here that are in dire need of a code cleanup.
v.affected_mob = src
v.strain_data = v.strain_data.Copy()
v.holder = src
if(prob(5))
if(v.can_carry && prob(5))
v.carrier = 1
return
return
+2 -2
View File
@@ -66,12 +66,12 @@
return 0
/proc/isbear(A)
if(istype(A, /mob/living/simple_animal/bear))
if(istype(A, /mob/living/simple_animal/hostile/bear))
return 1
return 0
/proc/iscarp(A)
if(istype(A, /mob/living/simple_animal/carp))
if(istype(A, /mob/living/simple_animal/hostile/carp))
return 1
return 0
+47 -19
View File
@@ -53,7 +53,7 @@
var/isadmin = 0
if(src.client && src.client.holder)
isadmin = 1
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\")")
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM erro_poll_textreply WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
@@ -83,24 +83,33 @@
break
//shh ;)
var/music = ticker.login_music
if(ckey == "cajoes")
music = 'sound/music/dangerzone.ogg'
else if(ckey == "duntada")
music = 'sound/music/you_are_likely_to_be_eaten.ogg'
else if(ckey == "misterbook")
music = 'sound/music/dinosaur.ogg'
else if(ckey == "chinsky")
music = 'sound/music/soviet_anthem.ogg'
else if(ckey == "abi79")
music = 'sound/music/spinmeround.ogg'
else if(ckey == "mloc")
music = 'sound/music/cantina1_short.ogg'
else if(ckey == "applemaster")
music = 'sound/music/elektronik_supersonik.ogg'
else if(ckey == "wrongnumber")
music = 'sound/music/greenthumb.ogg'
src << sound(music, repeat = 0, wait = 0, volume = 85, channel = 1) //MAD JAMZ
switch(src.key)
if("caelaislinn")
src << sound('sound/music/drive_me_closer.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("daneesh")
src << sound('sound/music/ill_make_a_man_out_of_you.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("doughnuts")
src << sound('sound/music/ultimate_showdown.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("themij")
src << sound('sound/music/pegasus.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("searif")
src << sound('sound/music/pegasus.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("danny220")
src << sound('sound/music/dirty_hands.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("sparklysheep")
src << sound('sound/music/dirty_hands.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("pobiega")
src << sound('sound/music/the_gabber_robots.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("chinsky")
src << sound('sound/music/cotton_eye_joe.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("russkisam")
src << sound('sound/music/elektronik_supersonik.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("duntadaman")
src << sound('sound/music/spinmeround.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
if("misterbook")
src << sound('sound/music/down_with_the_sickness.ogg', repeat = 0, wait = 0, volume = 85, channel = 1)
else
src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS
proc/Stopmusic()
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jamsz
@@ -313,6 +322,25 @@
if("TEXT")
var/replytext = href_list["replytext"]
log_text_poll_reply(pollid, replytext)
if("NUMVAL")
var/id_min = text2num(href_list["minid"])
var/id_max = text2num(href_list["maxid"])
if( (id_max - id_min) > 100 ) //Basic exploit prevention
usr << "The option ID difference is too big. Please contact administration or the database admin."
return
for(var/optionid = id_min; optionid<= id_max; optionid++)
if(!isnull(href_list["o[optionid]"])) //Test if this optionid was replied to
var/rating
if(href_list["o[optionid]"] == "abstain")
rating = null
else
rating = text2num(href_list["o[optionid]"])
if(!isnum(rating))
return
vote_on_numval_poll(pollid, optionid, rating)
proc/IsJobAvailable(rank)
var/datum/job/job = job_master.GetJob(rank)
+141
View File
@@ -229,6 +229,77 @@
output += "[vote_text]"
src << browse(output,"window=playerpoll;size=500x500")
//Polls with a text input
if("NUMVAL")
var/DBQuery/voted_query = dbcon.NewQuery("SELECT o.text, v.rating FROM erro_poll_option o, erro_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[usr.ckey]' AND o.id = v.optionid")
voted_query.Execute()
var/output = "<div align='center'><B>Player poll</B>"
output +="<hr>"
output += "<b>Question: [pollquestion]</b><br>"
output += "<font size='2'>Poll runs from <b>[pollstarttime]</b> until <b>[pollendtime]</b></font><p>"
var/voted = 0
while(voted_query.NextRow())
voted = 1
var/optiontext = voted_query.item[1]
var/rating = voted_query.item[2]
output += "<br><b>[optiontext] - [rating]</b>"
if(!voted) //Only make this a form if we have not voted yet
output += "<form name='cardcomp' action='?src=\ref[src]' method='get'>"
output += "<input type='hidden' name='src' value='\ref[src]'>"
output += "<input type='hidden' name='votepollid' value='[pollid]'>"
output += "<input type='hidden' name='votetype' value='NUMVAL'>"
var/minid = 999999
var/maxid = 0
var/DBQuery/option_query = dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM erro_poll_option WHERE pollid = [pollid]")
option_query.Execute()
while(option_query.NextRow())
var/optionid = text2num(option_query.item[1])
var/optiontext = option_query.item[2]
var/minvalue = text2num(option_query.item[3])
var/maxvalue = text2num(option_query.item[4])
var/descmin = option_query.item[5]
var/descmid = option_query.item[6]
var/descmax = option_query.item[7]
if(optionid < minid)
minid = optionid
if(optionid > maxid)
maxid = optionid
var/midvalue = round( (maxvalue + minvalue) / 2)
if(isnull(minvalue) || isnull(maxvalue) || (minvalue == maxvalue))
continue
output += "<br>[optiontext]: <select name='o[optionid]'>"
output += "<option value='abstain'>abstain</option>"
for (var/j = minvalue; j <= maxvalue; j++)
if(j == minvalue && descmin)
output += "<option value='[j]'>[j] ([descmin])</option>"
else if (j == midvalue && descmid)
output += "<option value='[j]'>[j] ([descmid])</option>"
else if (j == maxvalue && descmax)
output += "<option value='[j]'>[j] ([descmax])</option>"
else
output += "<option value='[j]'>[j]</option>"
output += "</select>"
output += "<input type='hidden' name='minid' value='[minid]'>"
output += "<input type='hidden' name='maxid' value='[maxid]'>"
output += "<p><input type='submit' value='Submit'>"
output += "</form>"
src << browse(output,"window=playerpoll;size=500x500")
return
/mob/new_player/proc/vote_on_poll(var/pollid = -1, var/optionid = -1)
@@ -364,4 +435,74 @@
insert_query.Execute()
usr << "\blue Feedback logging successful."
usr << browse(null,"window=playerpoll")
/mob/new_player/proc/vote_on_numval_poll(var/pollid = -1, var/optionid = -1, var/rating = null)
if(pollid == -1 || optionid == -1)
return
if(!isnum(pollid) || !isnum(optionid))
return
var/user = sqlfdbklogin
var/pass = sqlfdbkpass
var/db = sqlfdbkdb
var/address = sqladdress
var/port = sqlport
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
if(dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM erro_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
select_query.Execute()
var/validpoll = 0
while(select_query.NextRow())
if(select_query.item[4] != "NUMVAL")
return
validpoll = 1
break
if(!validpoll)
usr << "\red Poll is not valid."
return
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM erro_poll_option WHERE id = [optionid] AND pollid = [pollid]")
select_query2.Execute()
var/validoption = 0
while(select_query2.NextRow())
validoption = 1
break
if(!validoption)
usr << "\red Poll option is not valid."
return
var/alreadyvoted = 0
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM erro_poll_vote WHERE optionid = [optionid] AND ckey = '[usr.ckey]'")
voted_query.Execute()
while(voted_query.NextRow())
alreadyvoted = 1
break
if(alreadyvoted)
usr << "\red You already voted in this poll."
return
var/adminrank = "Player"
if(usr && usr.client && usr.client.holder)
adminrank = usr.client.holder.rank
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO erro_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")
insert_query.Execute()
usr << "\blue Vote successful."
usr << browse(null,"window=playerpoll")
+2
View File
@@ -36,6 +36,8 @@
switch(owner.icon_action_button)
if("action_hardhat", "action_welding")
usr.update_inv_head()
if("action_welding_g")
usr.update_inv_glasses()
if("action_jetpack")
usr.update_inv_back()
+4 -5
View File
@@ -335,9 +335,6 @@
if(!MP)
return 0 //Sanity, this should never happen.
if(ispath(MP, /mob/living/simple_animal/parrot))
return 0 //Parrots are unfinished, they have no sprite, movement, ect...(Working on this - Nodrak)
if(ispath(MP, /mob/living/simple_animal/space_worm))
return 0 //Unfinished. Very buggy, they seem to just spawn additional space worms everywhere and eating your own tail results in new worms spawning.
@@ -360,7 +357,7 @@
return 1
if(ispath(MP, /mob/living/simple_animal/crab))
return 1
if(ispath(MP, /mob/living/simple_animal/carp))
if(ispath(MP, /mob/living/simple_animal/hostile/carp))
return 1
if(ispath(MP, /mob/living/simple_animal/mushroom))
return 1
@@ -370,8 +367,10 @@
return 1
if(ispath(MP, /mob/living/simple_animal/mouse))
return 1 //It is impossible to pull up the player panel for mice (Fixed! - Nodrak)
if(ispath(MP, /mob/living/simple_animal/bear))
if(ispath(MP, /mob/living/simple_animal/hostile/bear))
return 1 //Bears will auto-attack mobs, even if they're player controlled (Fixed! - Nodrak)
if(ispath(MP, /mob/living/simple_animal/parrot))
return 1 //Parrots are no longer unfinished! -Nodrak
//Not in here? Must be untested!
return 0