Unfuck the statue code.

This commit is contained in:
phil235
2016-10-14 21:04:52 +02:00
committed by phil235
parent 53bcc3a60a
commit cd825493cf
4 changed files with 107 additions and 163 deletions
@@ -1,146 +1,106 @@
/obj/structure/closet/statue
/obj/structure/statue/petrified
name = "statue"
desc = "An incredibly lifelike marble carving."
icon = 'icons/obj/statue.dmi'
icon_state = "human_male"
density = 1
anchored = 1
obj_integrity = 200
max_integrity = 200
var/intialTox = 0 //these are here to keep the mob from taking damage from things that logically wouldn't affect a rock
var/intialFire = 0 //it's a little sloppy I know but it was this or the GODMODE flag. Lesser of two evils.
var/intialBrute = 0
var/intialOxy = 0
var/timer = 240 //eventually the person will be freed
var/mob/living/petrified_mob
/obj/structure/closet/statue/New(loc, var/mob/living/L)
if(ishuman(L) || ismonkey(L) || iscorgi(L))
/obj/structure/statue/petrified/New(loc, mob/living/L, statue_timer)
if(statue_timer)
timer = statue_timer
if(L)
petrified_mob = L
if(L.buckled)
L.buckled.unbuckle_mob(L,force=1)
L.reset_perspective(src)
L.loc = src
L.disabilities += MUTE
L.faction += "mimic" //Stops mimics from instaqdeling people in statues
L.visible_message("<span class='warning'>[L]'s skin rapidly turns to marble!</span>", "<span class='userdanger'>Your body freezes up! Can't... move... can't... think...</span>")
L.forceMove(src)
L.disabilities |= MUTE
L.faction += "mimic" //Stops mimics from instaqdeling people in statues
L.status_flags |= GODMODE
obj_integrity = L.health + 100 //stoning damaged mobs will result in easier to shatter statues
max_integrity = obj_integrity
intialTox = L.getToxLoss()
intialFire = L.getFireLoss()
intialBrute = L.getBruteLoss()
intialOxy = L.getOxyLoss()
if(ishuman(L))
var/mob/living/carbon/human/H = L
name = "statue of [H.name]"
H.bleedsuppress = 1
if(H.gender == "female")
icon_state = "human_female"
else if(ismonkey(L))
name = "statue of a monkey"
icon_state = "monkey"
else if(iscorgi(L))
name = "statue of a corgi"
icon_state = "corgi"
desc = "If it takes forever, I will wait for you..."
if(obj_integrity == 0) //meaning if the statue didn't find a valid target
qdel(src)
return
START_PROCESSING(SSobj, src)
START_PROCESSING(SSobj, src)
..()
icon = L.icon
icon_state = L.icon_state
overlays = L.overlays
color = list(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0))
/obj/structure/closet/statue/process()
/obj/structure/statue/petrified/process()
if(!petrified_mob)
STOP_PROCESSING(SSobj, src)
timer--
for(var/mob/living/M in src) //Go-go gadget stasis field
M.setToxLoss(intialTox)
M.adjustFireLoss(intialFire - M.getFireLoss())
M.adjustBruteLoss(intialBrute - M.getBruteLoss())
M.setOxyLoss(intialOxy)
M.Stun(1) //So they can't do anything while petrified
petrified_mob.Stun(2) //So they can't do anything while petrified
if(timer <= 0)
dump_contents()
STOP_PROCESSING(SSobj, src)
qdel(src)
/obj/structure/closet/statue/dump_contents()
/obj/structure/statue/petrified/contents_explosion(severity, target)
return
/obj/structure/statue/petrified/handle_atom_del(atom/A)
if(A == petrified_mob)
petrified_mob = null
/obj/structure/statue/petrified/Destroy()
if(istype(src.loc, /mob/living/simple_animal/hostile/statue))
var/mob/living/simple_animal/hostile/statue/S = src.loc
src.loc = S.loc
forceMove(S.loc)
if(S.mind)
for(var/mob/M in contents)
S.mind.transfer_to(M)
M.Weaken(5)
M << "<span class='notice'>You slowly come back to your senses. You are in control of yourself again!</span>"
break
if(petrified_mob)
S.mind.transfer_to(petrified_mob)
petrified_mob.Weaken(5)
petrified_mob << "<span class='notice'>You slowly come back to your senses. You are in control of yourself again!</span>"
qdel(S)
for(var/obj/O in src)
O.loc = src.loc
O.forceMove(loc)
for(var/mob/living/M in src)
M.forceMove(loc)
M.disabilities -= MUTE
M.take_overall_damage((M.health - obj_integrity + 100)) //any new damage the statue incurred is transfered to the mob
M.faction -= "mimic"
M.reset_perspective(null)
if(petrified_mob)
petrified_mob.status_flags &= ~GODMODE
petrified_mob.forceMove(loc)
petrified_mob.disabilities -= MUTE
petrified_mob.take_overall_damage((petrified_mob.health - obj_integrity + 100)) //any new damage the statue incurred is transfered to the mob
petrified_mob.faction -= "mimic"
petrified_mob = null
return ..()
/obj/structure/closet/statue/take_contents()
return
/obj/structure/closet/statue/open()
return
/obj/structure/closet/statue/take_contents()
return
/obj/structure/closet/statue/open()
return
/obj/structure/closet/statue/insert()
return
/obj/structure/closet/statue/close()
return
/obj/structure/closet/statue/toggle()
return
/obj/structure/closet/statue/MouseDrop_T()
return
/obj/structure/closet/statue/relaymove()
return
/obj/structure/closet/statue/attack_hand()
return
/obj/structure/closet/statue/verb_toggleopen()
return
/obj/structure/closet/statue/update_icon()
return
/obj/structure/closet/statue/deconstruct(disassembled = TRUE)
/obj/structure/statue/petrified/deconstruct(disassembled = TRUE)
if(!disassembled)
for(var/mob/living/M in src)
M.dust()
dump_contents()
if(petrified_mob)
petrified_mob.dust()
visible_message("<span class='danger'>[src] shatters!.</span>")
qdel(src)
/obj/structure/closet/statue/container_resist()
return
/mob/living/proc/petrify()
if(istype(loc, /obj/structure/closet/statue)) //If they're already petrified
/mob/proc/petrify(statue_timer)
/mob/living/carbon/human/petrify(statue_timer)
if(!isturf(loc))
return 0
new /obj/structure/closet/statue(get_turf(src), src)
var/obj/structure/statue/petrified/S = new(loc, src, statue_timer)
S.name = "statue of [name]"
bleedsuppress = 1
S.icon = icon
S.icon_state = icon_state
S.overlays = overlays
S.color = list(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0))
return 1
/mob/living/carbon/monkey/petrify(statue_timer)
if(!isturf(loc))
return 0
var/obj/structure/statue/petrified/S = new(loc, src, statue_timer)
S.name = "statue of a monkey"
S.icon_state = "monkey"
return 1
/mob/living/simple_animal/pet/dog/corgi/petrify(statue_timer)
if(!isturf(loc))
return 0
var/obj/structure/statue/petrified/S = new (loc, src, statue_timer)
S.name = "statue of a corgi"
S.icon_state = "corgi"
S.desc = "If it takes forever, I will wait for you..."
return 1
+18 -33
View File
@@ -9,12 +9,9 @@
density = 1
anchored = 0
obj_integrity = 100
max_integrity = 100
var/oreAmount = 7
var/mineralType = "metal"
/obj/structure/statue/Destroy()
density = 0
return ..()
var/material_drop_type = /obj/item/stack/sheet/metal
/obj/structure/statue/attackby(obj/item/weapon/W, mob/living/user, params)
add_fingerprint(user)
@@ -53,7 +50,7 @@
return
user.visible_message("[user] slices apart the [name].", \
"<span class='notice'>You slice apart the [name].</span>")
deconstruct(FALSE)
deconstruct(TRUE)
else if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
@@ -74,7 +71,7 @@
playsound(loc, 'sound/items/Welder2.ogg', 50, 1)
user.visible_message("[user] slices apart the [name].", \
"<span class='notice'>You slice apart the [name]!</span>")
deconstruct(FALSE)
deconstruct(TRUE)
else
return ..()
@@ -89,24 +86,12 @@
/obj/structure/statue/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
if(disassembled)
if (mineralType == "metal")
var/ore = /obj/item/stack/sheet/metal
for(var/i = 1, i <= oreAmount, i++)
new ore(get_turf(src))
else
var/ore = text2path("/obj/item/stack/sheet/mineral/[mineralType]")
for(var/i = 1, i <= oreAmount, i++)
new ore(get_turf(src))
else
if (mineralType == "metal")
var/ore = /obj/item/stack/sheet/metal
for(var/i = 3, i <= oreAmount, i++)
new ore(get_turf(src))
else
var/ore = text2path("/obj/item/stack/sheet/mineral/[mineralType]")
for(var/i = 3, i <= oreAmount, i++)
new ore(get_turf(src))
if(material_drop_type)
var/drop_amt = oreAmount
if(!disassembled)
drop_amt -= 2
if(drop_amt > 0)
new material_drop_type(get_turf(src), drop_amt)
qdel(src)
//////////////////////////////////////STATUES/////////////////////////////////////////////////////////////
@@ -115,7 +100,7 @@
/obj/structure/statue/uranium
obj_integrity = 300
luminosity = 2
mineralType = "uranium"
material_drop_type = /obj/item/stack/sheet/mineral/uranium
var/last_event = 0
var/active = null
@@ -159,7 +144,7 @@
/obj/structure/statue/plasma
obj_integrity = 200
mineralType = "plasma"
material_drop_type = /obj/item/stack/sheet/mineral/plasma
desc = "This statue is suitably made from plasma."
/obj/structure/statue/plasma/scientist
@@ -208,7 +193,7 @@
/obj/structure/statue/gold
obj_integrity = 300
mineralType = "gold"
material_drop_type = /obj/item/stack/sheet/mineral/gold
desc = "This is a highly valuable statue made from gold."
/obj/structure/statue/gold/hos
@@ -235,7 +220,7 @@
/obj/structure/statue/silver
obj_integrity = 300
mineralType = "silver"
material_drop_type = /obj/item/stack/sheet/mineral/silver
desc = "This is a valuable statue made from silver."
/obj/structure/statue/silver/md
@@ -262,7 +247,7 @@
/obj/structure/statue/diamond
obj_integrity = 1000
mineralType = "diamond"
material_drop_type = /obj/item/stack/sheet/mineral/diamond
desc = "This is a very expensive diamond statue"
/obj/structure/statue/diamond/captain
@@ -281,7 +266,7 @@
/obj/structure/statue/bananium
obj_integrity = 300
mineralType = "bananium"
material_drop_type = /obj/item/stack/sheet/mineral/bananium
desc = "A bananium statue with a small engraving:'HOOOOOOONK'."
var/spam_flag = 0
@@ -316,7 +301,7 @@
/obj/structure/statue/sandstone
obj_integrity = 50
mineralType = "sandstone"
material_drop_type = /obj/item/stack/sheet/mineral/sandstone
/obj/structure/statue/sandstone/assistant
name = "statue of an assistant"
@@ -334,7 +319,7 @@
/obj/structure/statue/snow
obj_integrity = 50
mineralType = "snow"
material_drop_type = /obj/item/stack/sheet/mineral/snow
/obj/structure/statue/snow/snowman
name = "snowman"