Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. #def SUMMON 1
  2.  
  3.  
  4. /obj/item/griffening_single
  5. name = "Griffening Single Card"
  6. desc = "A single griffening card, this probably shouldn't exist in this state."
  7. ////TODO: Vars to make things easier or better to play
  8.  
  9.  
  10. /obj/item/cthtool
  11. name = "Card-To-Hologram Tool"
  12. desc = "Makes playing cards become holograms somehow."
  13. icon_state = "gangtool-white"
  14. item_state = "electronic"
  15. lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
  16. righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
  17. icon = 'icons/obj/device.dmi'
  18. w_class = WEIGHT_CLASS_TINY
  19. var/mode = SUMMON
  20. var/obj/item/griffening_single/loadedcard
  21. var/ckey //The last person that used this device, good to know who played the card
  22.  
  23. /obj/item/cthtool/attackby(obj/item/I, mob/user, params)
  24. if(istype(I, obj/item/griffening_single))
  25. if(loadedcard)
  26. to_chat(user, "The [src] already has a card loaded in it.")
  27. else
  28. loadedcard = I
  29. to_chat(user, "You insert the [I] into the [src].")
  30. else
  31. if(!user.put_in_hands(loadedcard))
  32. to_chat(user, "It's a bit hard to take the card out inside if you are holding something.")
  33. return
  34. to_chat(user, "You take the [loadedcard] out of the [src].")
  35.  
  36. /obj/item/cthtool/examine(mob/user)
  37. if(loadedcard)
  38. to_chat(user, "The [src] has a [loadedcard] inserted into it.")
  39.  
  40. /obj/item/cthtool/afterattack(/obj/structure/cardtile/C, mob/user)
  41. if(!istype(C))
  42. return
  43. if(C.cardshowing) && if(loadedcard.card_type == "creature")
  44. to_chat(user, "That tile already has a creature summoned on it!")
  45. return
  46. if(!C.cardshowing)
  47. if(loadedcard.card_type == "equipment")
  48. to_chat(user, "There's nothing to equip to!")
  49. return
  50. if(C.ckey) && if(!C.ckey == ckey)
  51. to_chat(user, "That isn't your tile!")
  52. return
  53. C.display_card(loadedcard, TRUE) //This is probably a summon
  54. user.visible_message("[user] points the [src] at the [C], summoning a [loadedcard]!", "<span class='notice'>You summon the [loadedcard[ on the [C]!</span>")
  55. if(!C.ckey)
  56. C.ckey = user.ckey //If no owner, make the player of the card the owner
  57.  
  58. /obj/structure/cardtile
  59. name = "Griffening Card Tile"
  60. desc = "A tile where you can summon holograms on. Useful for playing some interactive Griffening."
  61. anchored = FALSE
  62. var/cardshowing //The card it currently has loaded into it
  63. var/outfit //If the card is something like a job giver, then it will put the outfit thingy on the dummy
  64. var/weapon //What weapon the creature is currently holding.
  65. var/ckey //The player that owns this thing
  66. var/hologramoverlay
  67.  
  68. /obj/structure/cardtile/attackby(obj/item/I, mob/user, params)
  69. if(istype(I, /obj/item/wrench))
  70. if(!anchored)
  71. anchored = TRUE
  72. to_chat(user, "You fasten the bolts of the [src] in place.")
  73. else
  74. anchored = FALSE
  75. to_chat(user, "You loosen the bolts of the [src].")
  76.  
  77. /obj/structure/cardtile/proc/display_card(/obj/item/griffening_single/card, IsSummon)
  78. if(!istype(card)) //No runtimes
  79. return
  80. if(cardshowing)
  81. return //Prevents a new card from overriding another card
  82. cardshowing == card
  83. hologramoverlay = updategraphic() //The proc returns the fancy hologram
  84. if(IsSummon)
  85. if(card.summonsound)
  86. playsound(src, summonsound, 50, 1)
  87. visible_message("A [card] is summoned on [src]!")
  88.  
  89. /obj/structure/cardtile/proc/updategraphic() //Making a new, random looking dummy every proc call is probably a bad idea.
  90. qdel(hologramobject)
  91. hologramobject = null //This is probably overkill
  92. var/mob/living/carbon/human/dummy/holo = generate_or_wait_for_human_dummy("holo")
  93. if(outfit)
  94. holo.equipOutfit(outfit) //If they have a specific job, equip the outfit. Useful for identifying certain creatures easier
  95. if(weapon)
  96. var/obj/item/weapon = new weapon(src)
  97. if(holo.put_in_hands(weapon)) //Put weapons into hands, pretty fancy
  98. holo.setDir(SOUTH) //Gotta have that full frontal view of stuff
  99. COMPILE_OVERLAYS(holo)
  100. unset_busy_human_dummy("holo")
  101. . = getFlatIcon(dummy)
  102.  
  103. #undef SUMMON
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement