|
92 | 92 | for(var/mob/living/L in occupants)
|
93 | 93 | move_outside(L)
|
94 | 94 | L.gib()
|
| 95 | + if(ES && ES.cargo_system) |
| 96 | + QDEL_NULL(ES.cargo_system.stored) |
95 | 97 | QDEL_LIST_NULL(actions)
|
96 | 98 | QDEL_NULL(pr_int_temp_processor)
|
97 | 99 | QDEL_NULL(pr_give_air)
|
|
140 | 142 | spawn(0)
|
141 | 143 | var/mob/living/L = get_pilot()
|
142 | 144 | if(L)
|
143 |
| - |
144 | 145 | to_chat(L, "<big><span class='warning'>Critical damage to the vessel detected, core explosion imminent!</span></big>")
|
145 |
| - for(var/i = 10, i >= 0; --i) |
| 146 | + if(ES && ES.cargo_system && ES.cargo_system.stored) |
| 147 | + ES.cargo_system.stored.forceMove(get_turf(src)) |
146 | 148 | if(L)
|
| 149 | + to_chat(L, "<span class='warning'>Automatically jettisoning cargo.</span>") |
| 150 | + for(var/i = 10, i >= 0; --i) |
| 151 | + if(L && L == get_pilot()) |
147 | 152 | to_chat(L, "<span class='warning'>[i]</span>")
|
148 | 153 | if(i == 0)
|
149 | 154 | explosion(loc, 2, 4, 8)
|
|
164 | 169 | move_outside(H, get_turf(src))
|
165 | 170 | H.ex_act(severity + 1)
|
166 | 171 | to_chat(H, "<span class='warning'>You are forcefully thrown from \the [src]!</span>")
|
| 172 | + if(ES && ES.cargo_system && ES.cargo_system.stored) |
| 173 | + ES.cargo_system.stored.forceMove(get_turf(src)) |
| 174 | + ES.cargo_system.stored.ex_act(severity + 1) |
167 | 175 | QDEL_NULL(ion_trail) // Should be nulled by qdel src in next line but OH WELL
|
168 | 176 | qdel(src)
|
169 | 177 | if(2)
|
|
182 | 190 | if(istype(AM,/obj/item))
|
183 | 191 | if(AM == battery || istype(AM, /obj/item/device/spacepod_equipment))
|
184 | 192 | continue //don't eject this particular item!
|
| 193 | + if(ES && ES.cargo_system && istype(AM, ES.cargo_system.allowed_types)) |
| 194 | + continue //it's a crate, probably! |
185 | 195 | anyitem++
|
186 | 196 | AM.forceMove(get_turf(user))
|
187 | 197 | if(anyitem)
|
|
232 | 242 | ES.locking_system = W
|
233 | 243 | ES.locking_system.my_atom = src
|
234 | 244 | return
|
| 245 | + if(istype(W, /obj/item/device/spacepod_equipment/cargo)) |
| 246 | + if(ES.cargo_system) |
| 247 | + to_chat(user, "<span class = 'notice'>\The [src] already has a cargo system.</span>") |
| 248 | + return |
| 249 | + else if(user.drop_item(W, src)) |
| 250 | + to_chat(user, "<span class='notice'>You insert \the [W] into the equipment system.</span>") |
| 251 | + ES.cargo_system = W |
| 252 | + ES.cargo_system.my_atom = src |
| 253 | + return |
235 | 254 | if(W.force)
|
236 | 255 | visible_message("<span class = 'warning'>\The [user] hits \the [src] with \the [W]</span>")
|
237 | 256 | adjust_health(W.force)
|
|
260 | 279 | */
|
261 | 280 | if(ES.locking_system)
|
262 | 281 | possible.Add("Locking System")
|
| 282 | + if(ES.cargo_system) |
| 283 | + possible.Add("Cargo System") |
263 | 284 | var/obj/item/device/spacepod_equipment/SPE
|
264 | 285 | switch(input(user, "Remove which equipment?", null, null) as null|anything in possible)
|
265 | 286 | if("Energy Cell")
|
|
283 | 304 | ES.locking_system = null
|
284 | 305 | else
|
285 | 306 | to_chat(user, "<span class='warning'>You need an open hand to do that.</span>")
|
| 307 | + if("Cargo System") |
| 308 | + var/obj/item/device/spacepod_equipment/cargo/CARGOSYS = ES.cargo_system |
| 309 | + if(CARGOSYS.stored) |
| 310 | + to_chat(user, "<span class='warning'>The cargo bay is loaded, you need to empty it first.</span>") |
| 311 | + return |
| 312 | + if(user.put_in_any_hand_if_possible(CARGOSYS)) |
| 313 | + to_chat(user, "<span class='notice'>You remove \the [CARGOSYS] from the equipment system.</span>") |
| 314 | + CARGOSYS.my_atom = null |
| 315 | + ES.cargo_system = null |
| 316 | + else |
| 317 | + to_chat(user, "<span class='warning'>You need an open hand to do that.</span>") |
286 | 318 | /*
|
287 | 319 | if("engine system")
|
288 | 320 | SPE = ES.engine_system
|
|
393 | 425 | . = t_air.return_temperature()
|
394 | 426 | return
|
395 | 427 |
|
396 |
| -/obj/spacepod/MouseDropTo(mob/M, mob/user) |
397 |
| - if(M != user) |
| 428 | +/obj/spacepod/MouseDropTo(atom/moved, mob/user) |
| 429 | + if(!Adjacent(moved) || !Adjacent(user)) |
398 | 430 | return
|
399 |
| - if(!Adjacent(M) || !Adjacent(user)) |
| 431 | + if(ES && ES.cargo_system && is_type_in_list(moved, ES.cargo_system.allowed_types)) |
| 432 | + attempt_load_cargo(moved, user) |
| 433 | + if(moved != user) |
400 | 434 | return
|
401 |
| - attempt_move_inside(M, user) |
| 435 | + attempt_move_inside(moved, user) |
402 | 436 |
|
403 | 437 | /obj/spacepod/MouseDropFrom(atom/over)
|
404 | 438 | if(!usr || !over)
|
|
463 | 497 | to_chat(usr, "You stop entering the pod.")
|
464 | 498 | return
|
465 | 499 |
|
| 500 | +/obj/spacepod/proc/attempt_load_cargo(atom/movable/moved, mob/user) |
| 501 | + if(!ES || !istype(ES)) |
| 502 | + to_chat(user, "<span class='warning'>The pod has no equipment datum, or is the wrong type, yell at pomf.</span>") |
| 503 | + return |
| 504 | + if(!ES.cargo_system) |
| 505 | + to_chat(user, "<span class='warning'>The pod has no cargo system.</span>") |
| 506 | + return |
| 507 | + if(locked) |
| 508 | + to_chat(usr, "<span class = 'warning'>\The [src] is locked.</span>") |
| 509 | + return |
| 510 | + if(usr.incapacitated() || usr.lying) //are you cuffed, dying, lying, stunned or other |
| 511 | + return |
| 512 | + if (!ishigherbeing(usr)) |
| 513 | + return |
| 514 | + if(ES.cargo_system.stored) |
| 515 | + to_chat(user, "<span class='warning'>The pod has no room in its cargo bay.</span>") |
| 516 | + |
| 517 | + visible_message("<span class='notice'>[usr] starts to load \the [moved] into \the [src].</span>") |
| 518 | + |
| 519 | + if(do_after(usr, src, 4 SECONDS)) |
| 520 | + if(ES.cargo_system.stored) |
| 521 | + //Something loaded when you weren't looking! |
| 522 | + to_chat(user, "<span class='warning'>The pod has no room in its cargo bay.</span>") |
| 523 | + return |
| 524 | + moved.forceMove(src) |
| 525 | + ES.cargo_system.stored = moved |
| 526 | + src.add_fingerprint(usr) |
| 527 | + moved.add_fingerprint(usr) |
| 528 | + to_chat(usr, "<span class = 'notice'>You load \the [moved] into \the [src].</span>") |
| 529 | + else |
| 530 | + to_chat(usr, "You stop loading the pod.") |
| 531 | + return |
| 532 | + |
| 533 | +/obj/spacepod/verb/attempt_unload_cargo() |
| 534 | + set category = "Spacepod" |
| 535 | + set name = "Unload Cargo" |
| 536 | + set src in oview(1) |
| 537 | + |
| 538 | + if(!ES || !istype(ES)) |
| 539 | + to_chat(usr, "<span class='warning'>The pod has no equipment datum, or is the wrong type, yell at pomf.</span>") |
| 540 | + return |
| 541 | + if(!ES.cargo_system) |
| 542 | + to_chat(usr, "<span class='warning'>The pod has no cargo system.</span>") |
| 543 | + return |
| 544 | + if(locked) |
| 545 | + to_chat(usr, "<span class = 'warning'>\The [src] is locked.</span>") |
| 546 | + return |
| 547 | + if(usr.incapacitated() || usr.lying) //are you cuffed, dying, lying, stunned or other |
| 548 | + return |
| 549 | + if (!ishigherbeing(usr)) |
| 550 | + return |
| 551 | + if(!ES.cargo_system.stored) |
| 552 | + to_chat(usr, "<span class='warning'>The pod has nothing in the cargo bay.</span>") |
| 553 | + return |
| 554 | + |
| 555 | + visible_message("<span class='notice'>[usr] starts to unload \the [src].</span>") |
| 556 | + |
| 557 | + if(do_after(usr, src, 4 SECONDS)) |
| 558 | + if(!ES.cargo_system.stored) |
| 559 | + //Something unloaded when you weren't looking! |
| 560 | + return |
| 561 | + ES.cargo_system.stored.forceMove(get_turf(src)) |
| 562 | + src.add_fingerprint(usr) |
| 563 | + ES.cargo_system.stored.add_fingerprint(usr) |
| 564 | + to_chat(usr, "<span class = 'notice'>You unload \the [ES.cargo_system.stored] from \the [src].</span>") |
| 565 | + ES.cargo_system.stored = null |
| 566 | + else |
| 567 | + to_chat(usr, "You stop unloading the pod.") |
| 568 | + return |
| 569 | + |
| 570 | +/obj/spacepod/proc/attempt_cargo_resist(var/mob/living/user, var/obj/contained) |
| 571 | + if(!ES || !istype(ES)) |
| 572 | + to_chat(user, "<span class='warning'>The pod has no equipment datum, or is the wrong type, yell at pomf.</span>") |
| 573 | + return |
| 574 | + if(!ES.cargo_system) |
| 575 | + to_chat(user, "<span class='warning'>Something's resisting in a spacepod's cargo bay with no cargo bay. Tell your local coder...</span>") |
| 576 | + return |
| 577 | + user.visible_message("<span class='danger'>\The [src]'s cargo hatch begins to make banging sounds!</span>", |
| 578 | + "<span class='warning'>You slam on the back of \the [contained] and start trying to bust out of \the [src]'s cargo bay! (This will take about 30 seconds)</span>") |
| 579 | + if(do_after(user, src, 30 SECONDS)) |
| 580 | + if(!ES.cargo_system.stored) |
| 581 | + //Something unloaded when you weren't looking! |
| 582 | + return |
| 583 | + ES.cargo_system.stored.forceMove(get_turf(src)) |
| 584 | + user.visible_message("<span class='danger'>\The [src]'s cargo hatch pops open, and \the [contained] inside pops out!</span>", |
| 585 | + "<span class='warning'>You manage to pop \the [src]'s cargo door open!</span>") |
| 586 | + ES.cargo_system.stored = null |
| 587 | + |
466 | 588 | /datum/global_iterator/pod_preserve_temp //normalizing cabin air temperature to 20 degrees celsium
|
467 | 589 | delay = 20
|
468 | 590 | /datum/global_iterator/pod_preserve_temp/process(var/obj/spacepod/spacepod)
|
|
0 commit comments