Files
Aurora.3/code/modules/assembly/holder.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

286 lines
7.1 KiB
Plaintext

/obj/item/device/assembly_holder
name = "Assembly"
icon = 'icons/obj/assemblies/new_assemblies.dmi'
icon_state = "holder"
item_state = "assembly"
flags = CONDUCT | PROXMOVE
throwforce = 5
w_class = 2.0
throw_speed = 3
throw_range = 10
var/secured = 0
var/obj/item/device/assembly/a_left = null
var/obj/item/device/assembly/a_right = null
var/obj/special_assembly = null
proc/attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user)
return
proc/attach_special(var/obj/O, var/mob/user)
return
proc/process_activation(var/obj/item/device/D)
return
proc/detached()
return
IsAssemblyHolder()
return 1
attach(var/obj/item/device/D, var/obj/item/device/D2, var/mob/user)
if((!D)||(!D2)) return 0
if((!isassembly(D))||(!isassembly(D2))) return 0
if((D:secured)||(D2:secured)) return 0
if(user)
user.remove_from_mob(D)
user.remove_from_mob(D2)
D:holder = src
D2:holder = src
D.loc = src
D2.loc = src
a_left = D
a_right = D2
name = "[D.name]-[D2.name] assembly"
update_icon()
usr.put_in_hands(src)
return 1
attach_special(var/obj/O, var/mob/user)
if(!O) return
if(!O.IsSpecialAssembly()) return 0
/* if(O:Attach_Holder())
special_assembly = O
update_icon()
src.name = "[a_left.name] [a_right.name] [special_assembly.name] assembly"
*/
return
update_icon()
cut_overlays()
if(a_left)
add_overlay("[a_left.icon_state]_left")
for(var/O in a_left.attached_overlays)
add_overlay("[O]_l")
if(a_right)
add_overlay("[a_right.icon_state]_right")
for(var/O in a_right.attached_overlays)
add_overlay("[O]_r")
if(master)
master.update_icon()
/* if(special_assembly)
special_assembly.update_icon()
if(special_assembly:small_icon_state)
src.overlays += special_assembly:small_icon_state
for(var/O in special_assembly:small_icon_state_overlays)
src.overlays += O
*/
examine(mob/user)
..(user)
if ((in_range(src, user) || src.loc == user))
if (src.secured)
user << "\The [src] is ready!"
else
user << "\The [src] can be attached!"
return
HasProximity(atom/movable/AM as mob|obj)
if(a_left)
a_left.HasProximity(AM)
if(a_right)
a_right.HasProximity(AM)
if(special_assembly)
special_assembly.HasProximity(AM)
Crossed(atom/movable/AM as mob|obj)
if(a_left)
a_left.Crossed(AM)
if(a_right)
a_right.Crossed(AM)
if(special_assembly)
special_assembly.Crossed(AM)
on_found(mob/finder as mob)
if(a_left)
a_left.on_found(finder)
if(a_right)
a_right.on_found(finder)
if(special_assembly)
if(istype(special_assembly, /obj/item))
var/obj/item/S = special_assembly
S.on_found(finder)
Move()
..()
if(a_left && a_right)
a_left.holder_movement()
a_right.holder_movement()
// if(special_assembly)
// special_assembly:holder_movement()
return
attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
if(a_left && a_right)
a_left.holder_movement()
a_right.holder_movement()
// if(special_assembly)
// special_assembly:Holder_Movement()
..()
return
attackby(obj/item/weapon/W as obj, mob/user as mob)
if(isscrewdriver(W))
if(!a_left || !a_right)
user << "\red BUG:Assembly part missing, please report this!"
return
a_left.toggle_secure()
a_right.toggle_secure()
secured = !secured
if(secured)
user << "\blue \The [src] is ready!"
else
user << "\blue \The [src] can now be taken apart!"
update_icon()
return
else if(W.IsSpecialAssembly())
attach_special(W, user)
else
..()
return
attack_self(mob/user as mob)
src.add_fingerprint(user)
if(src.secured)
if(!a_left || !a_right)
user << "\red Assembly part missing!"
return
if(istype(a_left,a_right.type))//If they are the same type it causes issues due to window code
switch(alert("Which side would you like to use?",,"Left","Right"))
if("Left") a_left.attack_self(user)
if("Right") a_right.attack_self(user)
return
else
if(!istype(a_left,/obj/item/device/assembly/igniter))
a_left.attack_self(user)
if(!istype(a_right,/obj/item/device/assembly/igniter))
a_right.attack_self(user)
else
var/turf/T = get_turf(src)
if(!T) return 0
if(a_left)
a_left:holder = null
a_left.loc = T
if(a_right)
a_right:holder = null
a_right.loc = T
QDEL_IN(src, 0)
return
process_activation(var/obj/D, var/normal = 1, var/special = 1)
if(!D) return 0
if(!secured)
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
if((normal) && (a_right) && (a_left))
if(a_right != D)
a_right.pulsed(0)
if(a_left != D)
a_left.pulsed(0)
if(master)
master.receive_signal()
// if(special && special_assembly)
// if(!special_assembly == D)
// special_assembly.dothings()
return 1
/obj/item/device/assembly_holder/New()
..()
listening_objects += src
/obj/item/device/assembly_holder/Destroy()
listening_objects -= src
return ..()
/obj/item/device/assembly_holder/hear_talk(mob/living/M as mob, msg, verb, datum/language/speaking)
if(a_right)
a_right.hear_talk(M,msg,verb,speaking)
if(a_left)
a_left.hear_talk(M,msg,verb,speaking)
/obj/item/device/assembly_holder/timer_igniter
name = "timer-igniter assembly"
New()
..()
var/obj/item/device/assembly/igniter/ign = new(src)
ign.secured = 1
ign.holder = src
var/obj/item/device/assembly/timer/tmr = new(src)
tmr.time=5
tmr.secured = 1
tmr.holder = src
processing_objects.Add(tmr)
a_left = tmr
a_right = ign
secured = 1
update_icon()
name = initial(name) + " ([tmr.time] secs)"
loc.verbs += /obj/item/device/assembly_holder/timer_igniter/verb/configure
detached()
loc.verbs -= /obj/item/device/assembly_holder/timer_igniter/verb/configure
..()
verb/configure()
set name = "Set Timer"
set category = "Object"
set src in usr
if ( !(usr.stat || usr.restrained()) )
var/obj/item/device/assembly_holder/holder
if(istype(src,/obj/item/weapon/grenade/chem_grenade))
var/obj/item/weapon/grenade/chem_grenade/gren = src
holder=gren.detonator
var/obj/item/device/assembly/timer/tmr = holder.a_left
if(!istype(tmr,/obj/item/device/assembly/timer))
tmr = holder.a_right
if(!istype(tmr,/obj/item/device/assembly/timer))
usr << "<span class='notice'>This detonator has no timer.</span>"
return
if(tmr.timing)
usr << "<span class='notice'>Clock is ticking already.</span>"
else
var/ntime = input("Enter desired time in seconds", "Time", "5") as num
if (ntime>0 && ntime<1000)
tmr.time = ntime
name = initial(name) + "([tmr.time] secs)"
usr << "<span class='notice'>Timer set to [tmr.time] seconds.</span>"
else
usr << "<span class='notice'>Timer can't be [ntime<=0?"negative":"more than 1000 seconds"].</span>"
else
usr << "<span class='notice'>You cannot do this while [usr.stat?"unconscious/dead":"restrained"].</span>"