Files
Aurora.3/code/game/objects/structures/grille.dm
Lohikar f6dc33a465 Newmap - SMC, Openturf, Arrivals Controller, and Mine Turf Improvements (#1958)
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.

* this is probably important

* Remove cascade disabling SSgarbage

* Fixed a bug where dust() did not qdel the target mob

* Misc fixes

* Fix decals surviving break-to-plating

* Subsystem flag tweaks

* Apparently subsystems are new'd before config is.

* Fix paper icons

* Speculative fix for insane lag

* Better machinery stat

* Make organs not use SSoverlay

* Misc bugfixes & tweaks

* Nightmode fixes

* Changelog for SMC

* Port /tg/'s improved MC crash handling

* Add some more SS Recover() procs

* supply_controller -> SScargo

* More New() -> Initialize()

* pAI and robot construction overlays

* Fix cargo unit tests

* Merge the DMM Suite's atom/New() into atoms_init

* Lighting pre-baking

* Lighting initialization logging

* Fix some bad SS init orders

* Fix SSlighting logging; rename Processes to MC

* Speculative fix for insane GC lag

* Prebaked openturf/icon_smooth & fix lighting prebake

* SS init status; SSatoms LATEQDEL

* Fix bug with MC init stat panel

* Fix parallax

* Misc

* Ignore SS_NO_DISPLAY during init

* apparently this is important

* REEEEEE

* Image GC fixes; broadcaster radio-new sanity

* RCON Cleanup

* Move pAI recruiter into subsystem

* Move global solars list into sun subsystem

* Make chickens not use a global

* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup

* Speed up space init a little

* Fix bad timer flags on floor drying

* Subsystem panic-restart verb for mins

* Explosion speedup

* Minor subsystem & MC logging tweaks

* SSopenturf improvements

* Make pipenet actually initialize (whoops)

* Minor tweaks

* Implement lighting rounding

* comments are hard okay

* Minor lattice tweaks

* Fix some timer issues & better closet init

* Timer sanity

* Request console tweaks + Storage init sanity

* Minor SSmachiner RCON improvements

* Further reduce world-start timer count

* Standardize subsystem logging

* Garbage hard delete profiling from /tg/

* Timer hang detection & recovery

* Log machines that sleep in process() and fuck up SSmachinery

* Fix an issue with external airlocks sleeping in process()

* Failsafe logging

* Minor tweaks

* Revert "Request console tweaks + Storage init sanity"

This reverts commit 98d3579e35.

* Re-implement RC changes

* Fix SQL FT saving

* Fix SSmachinery sleep in disposals

* Minor SS tweaks

* Paper fixes

* Blood drying fixes

* Merge gameticker and SSticker

* Minor global list init cleanup

* Lagcheck biogenerator & bags

* Tweak SScargo init order; RIG Initialize()

* Caching tweaks

* Remove rogue comma

* Initialize fixes

* Lighting destroy cleanup

* Fix emagging airlocks

* Initial SSicon implementation

* Tweaks & Fixes

* Fire + Air alarm queued icon updates

* Overlays + Queued icon cleanup

* Runtime & background fixes

* Kill some meaningless set statements

* Kill some image qdels

* Bump up lighting rounding val

* Fix adv. scanner destroy runtimes

* Remove unneeded icon update limiting

* Move icon smoothing into helpers

* Show a warning if DM 510 compiles without memory leak hack enabled

* Re-organize subsystems & MC defines a little

* Airlock SFX

* Log of Changes

* Make SSicon_update disable itself when not doing anything

* Fix respawn verb runtime when used early in server-init

* Add more information to MC's stat_entry()

* Replace direct refernces to gcDestroyed with QDEL* macros

* plant_controller -> SSplants

* More plant tweaks

* Add more humor to changelog

* Move parallax globals into SSparallax

* Lighting responsiveness tweaks

* Fix parallax init order & better MC init panel stat

* Make mobs GC

* More overlays + Remove intercom spawn()

* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.

* Update changelog

* Mob GC tweaks

* Del() cleanup

* Fix insomniac ZAS connection edges

* Minor pAI cleanup

* Convert more things to SSoverlay; fix duplicated overlay in field gens

* SM Bluespace turf tweaks

* Update SSgarbage debug globals list

* Human-type qdel tweaks

* Subsystem suspension; stat_entry improvements

* SQL Statistics cleanup

* Fix runtimes with ambrosia

* More disable() -> suspend(); fix nightmode again

* Human qdel fix; minor tweaks

* Update turbolift to work with StonedMC

* Make lifts use timers instead of a subsystem

* Make SSassets start earlier

* Convert the radio controller into a subsystem

* Fix some missing CHECK_TICKs in asteroid generation

* MC stat tweaks; make shouldnt_see a typecache

* Kill some redundant debug-controller entries

* radio_controller -> SSradio

* Better SSgarbage hard-del logging from /tg/ upstream

* Logging tweaks + GELF

* Misc client caching improvements

* Slime SSoverlay

* Oven icon fixes

* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.

* Holder tweaks + Welding tool Initialize()

* Fix some bad subsystem logging

* Fix suit cooling units spawning without cells

* Starlight tweaks

* Gibber infinite gib fix

* More SSoverlay stuff

* Make crates use CUT_OVERLAY_IN

* Make SSarrivals suspend instead of disable

* Make openturf use split/phased tick checks

* Speculative fix for unwet timer runtimes

* Blood overlay tweaks/fixes

* Update crusher to play nice with SMC + SSoverlay

* Openturf improvements and fixes

* Minor turbolift tweaks

* Lighting performance improvements + ChangeTurf tweaks

* this is probably important

* Fix wall weld noises on changeturf

* More ChangeTurf tweaks

* Explosion tweaks

* Pre-game lobby tweaks

* Openturf tweaks

* Prevent admins from starting the game before init finishes

* Fix Travis

* Kill an unused var

* Fix ChangeTurf runtimes on openturfs

* Fixes

* Browser datum fixes, asset caching

* Update changelog

* Changelog

* Lobby tweaks

* Ticker tweaks; kill ticker var

* Further lobby tweaks

* Cascade tweaks

* air_master -> SSair

* Reduce overhead from radio autosay

* alarm_manager -> SSalarm

* bomb_processor -> SSexplosives

* corp_regs -> SSlaw

* ZAS overlay fixes

* Small wall icon optimization

* Fix effects master

* Assembly tweaks

* Megavend fixes

* Shuttle fixes

* Camera alert performance improvements

* Fix some world.log spam from lighting overlays

* Fix some Initialize() procs

* Openspace responsiveness tweaks

* Make HE pipes animate through openturfs

* Kill a spawn
2017-05-02 14:40:40 -04:00

248 lines
7.7 KiB
Plaintext

/obj/structure/grille
name = "grille"
desc = "A flimsy lattice of metal rods, with screws to secure it to the floor."
icon = 'icons/obj/structures.dmi'
icon_state = "grille"
density = 1
anchored = 1
flags = CONDUCT
layer = 2.9
explosion_resistance = 1
var/health = 10
var/destroyed = 0
/obj/structure/grille/ex_act(severity)
qdel(src)
/obj/structure/grille/update_icon()
if(destroyed)
icon_state = "[initial(icon_state)]-b"
else
icon_state = initial(icon_state)
/obj/structure/grille/Bumped(atom/user)
if(ismob(user)) shock(user, 70)
/obj/structure/grille/attack_hand(mob/user as mob)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
user.do_attack_animation(src)
var/damage_dealt = 1
var/attack_message = "kicks"
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
if(H.species.can_shred(H))
attack_message = "mangles"
damage_dealt = 5
if(shock(user, 70))
return
if(HULK in user.mutations)
damage_dealt += 5
else
damage_dealt += 1
attack_generic(user,damage_dealt,attack_message)
/obj/structure/grille/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSGRILLE))
return 1
else
if(istype(mover, /obj/item/projectile))
return prob(30)
else
return !density
/obj/structure/grille/bullet_act(var/obj/item/projectile/Proj)
if(!Proj) return
//Flimsy grilles aren't so great at stopping projectiles. However they can absorb some of the impact
var/damage = Proj.get_structure_damage()
var/passthrough = 0
if(!damage) return
//20% chance that the grille provides a bit more cover than usual. Support structure for example might take up 20% of the grille's area.
//If they click on the grille itself then we assume they are aiming at the grille itself and the extra cover behaviour is always used.
switch(Proj.damage_type)
if(BRUTE)
//bullets
if(Proj.original == src || prob(20))
Proj.damage *= between(0, Proj.damage/60, 0.5)
if(prob(max((damage-10)/25, 0))*100)
passthrough = 1
else
Proj.damage *= between(0, Proj.damage/60, 1)
passthrough = 1
if(BURN)
//beams and other projectiles are either blocked completely by grilles or stop half the damage.
if(!(Proj.original == src || prob(20)))
Proj.damage *= 0.5
passthrough = 1
if(passthrough)
. = PROJECTILE_CONTINUE
damage = between(0, (damage - Proj.damage)*(Proj.damage_type == BRUTE? 0.4 : 1), 10) //if the bullet passes through then the grille avoids most of the damage
src.health -= damage*0.2
spawn(0) healthcheck() //spawn to make sure we return properly if the grille is deleted
/obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(iswirecutter(W))
if(!shock(user, 100))
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
new /obj/item/stack/rods(get_turf(src), destroyed ? 1 : 2)
qdel(src)
else if((isscrewdriver(W)) && (istype(loc, /turf/simulated) || anchored))
if(!shock(user, 90))
playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
anchored = !anchored
user.visible_message("<span class='notice'>[user] [anchored ? "fastens" : "unfastens"] the grille.</span>", \
"<span class='notice'>You have [anchored ? "fastened the grille to" : "unfastened the grill from"] the floor.</span>")
else if(istype(W,/obj/item/stack/rods) && destroyed == 1)
if(!shock(user, 90))
var/obj/item/stack/rods/ROD = W
health = 10
density = 1
destroyed = 0
icon_state = "grille"
ROD.use(1)
user.visible_message("<span class='notice'>[user] repairs the grille.</span>", \
"<span class='notice'>You have repaired the grille.</span>")
return
//window placing begin //TODO CONVERT PROPERLY TO MATERIAL DATUM
else if(istype(W,/obj/item/stack/material))
var/obj/item/stack/material/ST = W
if(!ST.material.created_window)
return 0
var/dir_to_set = 1
if(loc == user.loc)
dir_to_set = user.dir
else
if( ( x == user.x ) || (y == user.y) ) //Only supposed to work for cardinal directions.
if( x == user.x )
if( y > user.y )
dir_to_set = 2
else
dir_to_set = 1
else if( y == user.y )
if( x > user.x )
dir_to_set = 8
else
dir_to_set = 4
else
user << "<span class='notice'>You can't reach.</span>"
return //Only works for cardinal direcitons, diagonals aren't supposed to work like this.
for(var/obj/structure/window/WINDOW in loc)
if(WINDOW.dir == dir_to_set)
user << "<span class='notice'>There is already a window facing this way there.</span>"
return
user << "<span class='notice'>You start placing the window.</span>"
if(do_after(user,20))
for(var/obj/structure/window/WINDOW in loc)
if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting.
user << "<span class='notice'>There is already a window facing this way there.</span>"
return
var/wtype = ST.material.created_window
if (ST.use(1))
var/obj/structure/window/WD = new wtype(loc, dir_to_set, 1)
user << "<span class='notice'>You place the [WD] on [src].</span>"
WD.update_icon()
return
//window placing end
else if(!(W.flags & CONDUCT) || !shock(user, 70))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src)
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
switch(W.damtype)
if("fire")
health -= W.force
if("brute")
health -= W.force * 0.1
healthcheck()
..()
return
/obj/structure/grille/proc/healthcheck()
if(health <= 0)
if(!destroyed)
density = 0
destroyed = 1
update_icon()
new /obj/item/stack/rods(get_turf(src))
else
if(health <= -6)
new /obj/item/stack/rods(get_turf(src))
qdel(src)
return
return
// shock user with probability prb (if all connections & power are working)
// returns 1 if shocked, 0 otherwise
/obj/structure/grille/proc/shock(mob/user as mob, prb)
if(!anchored || destroyed) // anchored/destroyed grilles are never connected
return 0
if(!prob(prb))
return 0
if(!in_range(src, user))//To prevent TK and mech users from getting shocked
return 0
var/turf/T = get_turf(src)
var/obj/structure/cable/C = T.get_cable_node()
if(C)
if(electrocute_mob(user, C, src))
if(C.powernet)
C.powernet.trigger_warning()
spark(src, 3, alldirs)
if(user.stunned)
return 1
else
return 0
return 0
/obj/structure/grille/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(!destroyed)
if(exposed_temperature > T0C + 1500)
health -= 1
healthcheck()
..()
/obj/structure/grille/attack_generic(var/mob/user, var/damage, var/attack_verb)
visible_message("<span class='danger'>[user] [attack_verb] the [src]!</span>")
user.do_attack_animation(src)
health -= damage
spawn(1) healthcheck()
return 1
// Used in mapping to avoid
/obj/structure/grille/broken
destroyed = 1
icon_state = "grille-b"
density = 0
New()
..()
health = rand(-5, -1) //In the destroyed but not utterly threshold.
healthcheck() //Send this to healthcheck just in case we want to do something else with it.
/obj/structure/grille/cult
name = "cult grille"
desc = "A matrice built out of an unknown material, with some sort of force field blocking air around it"
icon_state = "grillecult"
health = 40 //Make it strong enough to avoid people breaking in too easily
/obj/structure/grille/cult/CanPass(atom/movable/mover, turf/target, height = 1.5, air_group = 0)
if(air_group)
return 0 //Make sure air doesn't drain
..()