-First revision of Swarmer mob, hud, icons, etc

-Adds functionality of ignored damage types to simple mobs
-Adds functionality of melee damage types to simple mobs
This commit is contained in:
Ergovisavi
2015-08-25 03:24:34 -07:00
parent 1f1e539279
commit 9572bd6aa6
16 changed files with 498 additions and 19 deletions

View File

@@ -197,6 +197,8 @@ var/datum/global_hud/global_hud = new()
blob_hud()
else if(isdrone(mymob))
drone_hud(ui_style)
else if(isswarmer(mymob))
swarmer_hud()
//Version denotes which style should be displayed. blank or 0 means "next version"

View File

@@ -235,10 +235,8 @@
return
var/mob/living/simple_animal/M = user
M.do_attack_animation(src)
if(M.melee_damage_upper <= 0)
return
attack_generic(M, M.melee_damage_upper)
if(M.melee_damage_upper > 0 && (M.melee_damage_type == BRUTE || M.melee_damage_type == BURN))
attack_generic(M, M.melee_damage_upper)
/obj/machinery/door/window/attack_slime(mob/living/simple_animal/slime/user)
user.do_attack_animation(src)

View File

@@ -166,6 +166,7 @@
/obj/structure/closet/ex_act(severity, target)
contents_explosion(severity, target)
new /obj/item/stack/sheet/metal(loc)
dump_contents()
qdel(src)
..()

View File

@@ -11,11 +11,13 @@
qdel(src)
return
if(2.0)
if (prob(50))
if (prob(70))
new /obj/item/stack/sheet/metal(loc)
qdel(src)
return
if(3.0)
if (prob(5))
if (prob(50))
new /obj/item/stack/sheet/metal(loc)
qdel(src)
return
return

View File

@@ -168,7 +168,7 @@
var/mob/living/simple_animal/M = user
M.do_attack_animation(src)
if(M.melee_damage_upper <= 0)
if(M.melee_damage_upper <= 0 || (M.melee_damage_type != BRUTE && M.melee_damage_type != BURN))
return
attack_generic(M, M.melee_damage_upper)

View File

@@ -73,7 +73,19 @@ In all, this is a lot like the monkey code. /N
/mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M)
if(..())
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
adjustBruteLoss(damage)
switch(M.melee_damage_type)
if(BRUTE)
adjustBruteLoss(damage)
if(BURN)
adjustFireLoss(damage)
if(TOX)
adjustToxLoss(damage)
if(OXY)
adjustOxyLoss(damage)
if(CLONE)
adjustCloneLoss(damage)
if(STAMINA)
adjustStaminaLoss(damage)
updatehealth()
/mob/living/carbon/alien/attack_slime(mob/living/simple_animal/slime/M)

View File

@@ -74,9 +74,9 @@
. = ..()
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1.0)
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1.0, override = 0)
shock_damage *= siemens_coeff
if (shock_damage<1)
if(shock_damage<1 && !override)
return 0
take_overall_damage(0,shock_damage)
//src.burn_skin(shock_damage)

View File

@@ -270,7 +270,7 @@
spreadFire(AM)
//Added a safety check in case you want to shock a human mob directly through electrocute_act.
/mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1.0, safety = 0)
/mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1.0, safety = 0, override = 0)
if(!safety)
if(gloves)
var/obj/item/clothing/gloves/G = gloves
@@ -280,7 +280,7 @@
heart_attack = 0
if(stat == CONSCIOUS)
src << "<span class='notice'>You feel your heart beating again!</span>"
return ..(shock_damage,source,siemens_coeff)
return ..(shock_damage,source,siemens_coeff,safety,override)
/mob/living/carbon/human/Topic(href, href_list)
if(usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY))

View File

@@ -389,7 +389,7 @@ emp_act
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
var/obj/item/organ/limb/affecting = get_organ(ran_zone(dam_zone))
var/armor = run_armor_check(affecting, "melee")
apply_damage(damage, BRUTE, affecting, armor)
apply_damage(damage, M.melee_damage_type, affecting, armor)
updatehealth()

View File

@@ -155,7 +155,19 @@
/mob/living/carbon/monkey/attack_animal(mob/living/simple_animal/M)
if(..())
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
adjustBruteLoss(damage)
switch(M.melee_damage_type)
if(BRUTE)
adjustBruteLoss(damage)
if(BURN)
adjustFireLoss(damage)
if(TOX)
adjustToxLoss(damage)
if(OXY)
adjustOxyLoss(damage)
if(CLONE)
adjustCloneLoss(damage)
if(STAMINA)
adjustStaminaLoss(damage)
updatehealth()

View File

@@ -381,7 +381,19 @@
/mob/living/silicon/attack_animal(mob/living/simple_animal/M)
if(..())
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
adjustBruteLoss(damage)
switch(M.melee_damage_type)
if(BRUTE)
adjustBruteLoss(damage)
if(BURN)
adjustFireLoss(damage)
if(TOX)
adjustToxLoss(damage)
if(OXY)
adjustOxyLoss(damage)
if(CLONE)
adjustCloneLoss(damage)
if(STAMINA)
adjustStaminaLoss(damage)
updatehealth()
/mob/living/silicon/attack_paw(mob/living/user)

View File

@@ -0,0 +1,419 @@
////Deactivated swarmer shell////
/obj/item/unactivated_swarmer
name = "unactivated swarmer"
desc = "A currently unactivated swarmer. Swarmers can self activate at any time, it would be wise to immediately dispose of this."
icon = 'icons/mob/swarmer.dmi'
icon_state = "swarmer_unactivated"
/obj/item/unactivated_swarmer/attack_ghost(mob/user)
var/be_swarmer = alert("Become a swarmer? (Warning, You can no longer be cloned!)",,"Yes","No")
if(be_swarmer == "No" || gc_destroyed)
return
var/mob/living/simple_animal/hostile/swarmer/S = new /mob/living/simple_animal/hostile/swarmer(get_turf(loc))
S.key = user.key
qdel(src)
////The Mob itself////
/mob/living/simple_animal/hostile/swarmer
name = "swarmer"
icon = 'icons/mob/swarmer.dmi'
desc = "A robot of unknown design, they seek only to consume materials and replicate themselves indefinitely."
speak_emote = list("tones")
health = 30
maxHealth = 30
status_flags = CANPUSH
icon_state = "swarmer"
icon_living = "swarmer"
icon_dead = "swarmer_unactivated"
icon_gib = null
wander = 0
harm_intent_damage = 5
minbodytemp = 0
maxbodytemp = 500
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
unsuitable_atmos_damage = 0
melee_damage_lower = 15
melee_damage_upper = 15
melee_damage_type = STAMINA
ignored_damage_types = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)
environment_smash = 0
attacktext = "shocks"
attack_sound = null
friendly = "pinches"
speed = 0
faction = list("swarmer")
AIStatus = AI_OFF
projectiletype = /obj/item/projectile/beam/disabler
pass_flags = PASSTABLE | PASSMOB
has_unlimited_silicon_privilege = 1
ventcrawler = 2
ranged = 1
projectiletype = /obj/item/projectile/beam/disabler
ranged_cooldown_cap = 2
projectilesound = 'sound/weapons/taser2.ogg'
var/resources = 0 //Resource points, generated by consuming metal/glass
/mob/living/simple_animal/hostile/swarmer/Login()
..()
src << "<b>You are a swarmer, a weapon of a long dead civilization. Until further orders from your original masters are received, you must continue to consume and replicate.</b>"
src << "<b>Ctrl + Click provides most of your swarmer specific interactions, such as cannibalizing metal or glass, or destroying the environment."
src << "<b>Objectives:</b>"
src << "1. Consume resources and replicate until there are no more resources left."
src << "2. Ensure that the station is fit for invasion at a later date, do not perform actions that would render it dangerous or inhospitable."
src << "3. Biological resources will be harvested at a later date, do not harm them."
/mob/living/simple_animal/hostile/swarmer/New()
..()
verbs -= /mob/living/verb/pulled
/mob/living/simple_animal/hostile/swarmer/Stat()
..()
if(statpanel("Status"))
stat("Resources",resources)
/mob/living/simple_animal/hostile/swarmer/death(gibbed)
..(gibbed)
new /obj/effect/decal/cleanable/robot_debris(src.loc)
ghostize()
qdel(src)
/mob/living/simple_animal/hostile/swarmer/emp_act()
if(health > 1)
health = 1
..()
health = 0
/mob/living/simple_animal/hostile/swarmer/CtrlClickOn(atom/A)
face_atom(A)
if(!isturf(loc))
return
if(next_move > world.time)
return
if(!A.Adjacent(src))
return
if(isliving(A))
DisperseTarget(A)
return
if(istype(A, /obj/item))
Integrate(A)
return
if(istype(A, /turf/simulated/floor))//Stops you from disintegrating mobs to death or other assorted nonsense, as turf ex_act calls it on its contents
return
DisIntegrate(A)
return
/mob/living/simple_animal/hostile/swarmer/proc/Fabricate(var/atom/fabrication_object,var/fabrication_cost = 0)
if(!isturf(loc))
src << "This is not a suitable location for fabrication. We need more space."
if(resources >= fabrication_cost)
resources -= fabrication_cost
else
src << "You do not have the necessary resources to fabricate this object"
return 0
new fabrication_object(loc)
return 1
/mob/living/simple_animal/hostile/swarmer/proc/Integrate(var/obj/item/target)
if(resources >= 100)
src << "We cannot hold more materials!"
return
if(istype(target, /obj/item/weapon/gun))
src << "This object has been adjusted to resist disintegration"//Stops swarmers from devouring the entire armory in seconds
return
if((target.materials[MAT_METAL]) || (target.materials[MAT_GLASS]))
if(istype(target, /obj/item/stack))
if(istype(target, /obj/item/stack/cable_coil))//Wiring is just too plentiful
src << "This object does not contain enough materials to work with."
return
var/obj/item/stack/S = target
resources++
S.amount--
if(S.amount > 0)
return
resources++
do_attack_animation(target)
qdel(target)
else
src << "This object does not contain enough materials to work with."
return
/mob/living/simple_animal/hostile/swarmer/proc/DisIntegrate(var/atom/movable/target)
if(istype(target, /turf/simulated/wall) || istype(target, /obj/structure/window))
if(locate(/turf/space) in range(1, target))
src << "Destroying this object has the potential to cause a hull breach. Aborting."
return
if(istype(target, /obj/structure/reagent_dispensers/fueltank))
src << "Destroying this object would cause a chain reaction. Aborting."
return
if(istype(target, /obj/machinery/portable_atmospherics/canister))
src << "An inhospitable area may be created as a result of destroying this object. Aborting."
return
if(istype(target, /obj/structure/cable) || istype(target, /obj/machinery/power/apc) || istype(target, /obj/machinery/power/smes))
src << "Disrupting the power grid would bring no benefit to us. Aborting."
return
if(istype(target, /obj/machinery/power/emitter))//Stop trying to release the singularity you fuck
src << "This object is too risky to destroy. Aborting."
return
new /obj/effect/effect/sparks(get_turf(target))
do_attack_animation(target)
changeNext_move(CLICK_CD_MELEE)
target.ex_act(3)
return
/mob/living/simple_animal/hostile/swarmer/proc/DisperseTarget(var/mob/living/target)
if(target != src)
src << "Attempting to remove this being from our presence."
if(do_mob(src, target, 30))
var/cycle
for(cycle=0,cycle<100,cycle++)
var/random_location = locate(rand(37,202),rand(75,192),ZLEVEL_STATION)//Drunk dial a turf in the general ballpark of the station
if(istype(random_location, /turf/simulated/floor))
var/turf/simulated/floor/F = random_location
if(F.air)
var/datum/gas_mixture/A = F.air
if(A.oxygen >= 16 && !A.toxins && A.carbon_dioxide < 10 && !A.trace_gases.len)//Can most things breathe in this location?
if((A.temperature > 270) && (A.temperature < 360))//Not too hot, not too cold
var/pressure = A.return_pressure()
if((pressure > 20) && (pressure < 550))//Account for crushing pressure or vaccuums
if(ishuman(target))//If we're getting rid of a human, slap some zipties on them to keep them away from us a little longer
var/obj/item/weapon/restraints/handcuffs/cable/zipties/Z = new /obj/item/weapon/restraints/handcuffs/cable/zipties(src)
var/mob/living/carbon/human/H = target
Z.apply_cuffs(H, src)
do_teleport(target, F, 0)
playsound(src,'sound/effects/sparks4.ogg',50,1)
break
return
/obj/effect/swarmer //Default destroyable object for swarmer constructions
name = "swarmer construction"
desc = "Debug swarmer item, this shouldn't be here. Yell at a coder."
gender = NEUTER
icon = 'icons/mob/swarmer.dmi'
icon_state = "ui_light"
luminosity = 1
var/health = 30
/obj/effect/swarmer/proc/TakeDamage(damage)
health -= damage
if(health <= 0)
qdel(src)
/obj/effect/swarmer/bullet_act(obj/item/projectile/Proj)
if(Proj.damage)
if((Proj.damage_type == BRUTE || Proj.damage_type == BURN))
TakeDamage(Proj.damage)
..()
/obj/effect/swarmer/attackby(obj/item/weapon/I, mob/living/user, params)
if(istype(I, /obj/item/weapon))
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
TakeDamage(I.force)
return
/obj/effect/swarmer/ex_act()
qdel(src)
return
/obj/effect/swarmer/blob_act()
qdel(src)
return
/obj/effect/swarmer/attack_animal(mob/living/user)
if(isanimal(user))
var/mob/living/simple_animal/S = user
S.do_attack_animation(src)
user.changeNext_move(CLICK_CD_MELEE)
if(S.melee_damage_type == BRUTE || S.melee_damage_type == BURN)
TakeDamage(rand(S.melee_damage_lower, S.melee_damage_upper))
return
/mob/living/simple_animal/hostile/swarmer/proc/CreateTrap()
set name = "Create trap"
set category = "Swarmer"
set desc = "Creates a simple trap that will non-lethally electrocute anything that steps on it. Costs 5 resources"
if(/obj/effect/swarmer/trap in loc)
src << "There is already a trap here. Aborting."
return
Fabricate(/obj/effect/swarmer/trap, 5)
return
/obj/effect/swarmer/trap
name = "swarmer trap"
desc = "A quickly assembled electric trap. Will not retain its form if damaged enough."
icon_state = "trap"
luminosity = 1
health = 10
/obj/effect/swarmer/trap/Crossed(var/atom/movable/AM)
if(isliving(AM))
var/mob/living/L = AM
if(!istype(L, /mob/living/simple_animal/hostile/swarmer))
L.electrocute_act(0, src, 1, 1)
qdel(src)
..()
/mob/living/simple_animal/hostile/swarmer/proc/CreateBarricade()
set name = "Create barricade"
set category = "Swarmer"
set desc = "Creates a barricade that will stop anything but swarmers and disabler beams from passing through."
if(/obj/effect/swarmer/blockade in loc)
src << "There is already a blockade here. Aborting."
return
Fabricate(/obj/effect/swarmer/blockade, 5)
return
/obj/effect/swarmer/blockade
name = "swarmer blockade"
desc = "A quickly assembled energy blockade. Will not retain its form if damaged enough, but disabler beams and swarmers pass right through."
icon_state = "barricade"
luminosity = 1
health = 50
density = 1
anchored = 1
/obj/effect/swarmer/blockade/CanPass(atom/movable/O)
if(istype(O, /mob/living/simple_animal/hostile/swarmer))
return 1
if(istype(O, /obj/item/projectile/beam/disabler))
return 1
..()
/mob/living/simple_animal/hostile/swarmer/proc/CreateSwarmer()
set name = "Replicate"
set category = "Swarmer"
set desc = "Creates a shell for a new swarmer. Swarmers will self activate."
src << "We are attempting to replicate ourselves. We will need to stand still until the process is complete."
if(resources < 50)
src << "We do not have the resources for this!"
return
if(!isturf(loc))
src << "This is not a suitable location for replicating ourselves. We need more room."
return
if(do_mob(src, src, 100))
if(Fabricate(/obj/item/unactivated_swarmer, 50))
playsound(loc,'sound/items/poster_being_created.ogg',50, 1, -1)
/mob/living/simple_animal/hostile/swarmer/proc/RepairSelf()
set name = "Self Repair"
set category = "Swarmer"
set desc = "Attempts to repair damage to our body. You will have to remain motionless until repairs are complete."
if(!isturf(loc))
return
src << "Attempting to repair damage to our body, stand by..."
if(do_mob(src, src, 100))
adjustBruteLoss(-100)
src << "We successfully repaired ourselves."
/mob/living/simple_animal/hostile/swarmer/proc/ToggleLight()
if(!luminosity)
SetLuminosity(3)
else
SetLuminosity(0)
/mob/living/simple_animal/hostile/swarmer/proc/ContactSwarmers()
var/message = input(src, "Announce to other swarmers", "Swarmer contact")
if(message)
for(var/mob/living/simple_animal/hostile/swarmer/S in world)
if(S != src)
S << "<B>Swarm communication: [message]"
////HUD NONSENSE////
/obj/screen/swarmer
icon = 'icons/mob/swarmer.dmi'
/obj/screen/swarmer/FabricateTrap
icon_state = "ui_trap"
name = "Create trap"
desc = "Creates a trap that will nonlethally shock any non-swarmer that attempts to cross it. (Costs 5 resources)"
/obj/screen/swarmer/FabricateTrap/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.CreateTrap()
/obj/screen/swarmer/Barricade
icon_state = "ui_barricade"
name = "Create barricade"
desc = "Creates a destructible barricade that will stop any non swarmer from passing it. Also allows disabler beams to pass through. (Costs 5 resources)"
/obj/screen/swarmer/Barricade/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.CreateBarricade()
/obj/screen/swarmer/Replicate
icon_state = "ui_replicate"
name = "Replicate"
desc = "Creates a another of our kind. (Costs 50 resources)"
/obj/screen/swarmer/Replicate/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.CreateSwarmer()
/obj/screen/swarmer/RepairSelf
icon_state = "ui_self_repair"
name = "Repair self"
desc = "Repairs damage to our body."
/obj/screen/swarmer/RepairSelf/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.RepairSelf()
/obj/screen/swarmer/ToggleLight
icon_state = "ui_light"
name = "Toggle light"
desc = "Toggles our inbuilt light on or off."
/obj/screen/swarmer/ToggleLight/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.ToggleLight()
/obj/screen/swarmer/ContactSwarmers
icon_state = "ui_contact_swarmers"
name = "Contact swarmers"
desc = "Sends a message to all other swarmers, should they exist."
/obj/screen/swarmer/ContactSwarmers/Click()
if(isswarmer(usr))
var/mob/living/simple_animal/hostile/swarmer/S = usr
S.ContactSwarmers()
/datum/hud/proc/swarmer_hud(ui_style = 'icons/mob/screen_midnight.dmi')
adding = list()
var/obj/screen/using
using = new /obj/screen/swarmer/FabricateTrap()
using.screen_loc = ui_rhand
adding += using
using = new /obj/screen/swarmer/Barricade()
using.screen_loc = ui_lhand
adding += using
using = new /obj/screen/swarmer/Replicate()
using.screen_loc = ui_zonesel
adding += using
using = new /obj/screen/swarmer/RepairSelf()
using.screen_loc = ui_storage1
adding += using
using = new /obj/screen/swarmer/ToggleLight()
using.screen_loc = ui_back
adding += using
using = new /obj/screen/swarmer/ContactSwarmers()
using.screen_loc = ui_inventory
adding += using
mymob.client.screen = list()
mymob.client.screen += mymob.client.void
mymob.client.screen += adding

View File

@@ -41,6 +41,8 @@
//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/melee_damage_type = BRUTE //Damage type of a simple mob's melee attack, should it do damage.
var/list/ignored_damage_types = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) //Set 0 to receive that damage type, 1 to ignore
var/attacktext = "attacks"
var/attack_sound = null
var/friendly = "nuzzles" //If the mob does no damage with it's attack
@@ -252,7 +254,7 @@
/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M)
if(..())
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
attack_threshold_check(damage)
attack_threshold_check(damage,M.melee_damage_type)
return 1
/mob/living/simple_animal/bullet_act(obj/item/projectile/Proj)
@@ -262,8 +264,21 @@
Proj.on_hit(src)
return 0
/mob/living/simple_animal/adjustBruteLoss(amount)
if(!ignored_damage_types[BRUTE])
..()
/mob/living/simple_animal/adjustFireLoss(amount)
adjustBruteLoss(amount)
if(!ignored_damage_types[BURN])
adjustBruteLoss(amount)
/mob/living/simple_animal/adjustToxLoss(amount)
if(!ignored_damage_types[TOX])
..(amount)
/mob/living/simple_animal/adjustCloneLoss(amount)
if(!ignored_damage_types[CLONE])
..(amount)
/mob/living/simple_animal/adjustStaminaLoss(amount)
return
@@ -333,8 +348,8 @@
attack_threshold_check(damage)
return 1
/mob/living/simple_animal/proc/attack_threshold_check(damage)
if(damage <= force_threshold)
/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE)
if(damage <= force_threshold || ignored_damage_types[damagetype])
visible_message("<span class='warning'>[src] looks unharmed.</span>")
else
adjustBruteLoss(damage)

View File

@@ -125,6 +125,11 @@
return 1
return 0
/proc/isswarmer(A)
if(istype(A, /mob/living/simple_animal/hostile/swarmer))
return 1
return 0
/proc/islimb(A)
if(istype(A, /obj/item/organ/limb))
return 1

BIN
icons/mob/swarmer.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1229,6 +1229,7 @@
#include "code\modules\mob\living\simple_animal\parrot.dm"
#include "code\modules\mob\living\simple_animal\shade.dm"
#include "code\modules\mob\living\simple_animal\simple_animal.dm"
#include "code\modules\mob\living\simple_animal\bot_swarm\swarmer.dm"
#include "code\modules\mob\living\simple_animal\friendly\butterfly.dm"
#include "code\modules\mob\living\simple_animal\friendly\cat.dm"
#include "code\modules\mob\living\simple_animal\friendly\crab.dm"