Adds Deskbells as a demo

This commit is contained in:
Cassie
2019-05-21 23:12:36 +01:00
parent 0d2e2af355
commit 024c25b3d3
6 changed files with 96 additions and 2 deletions
+2 -2
View File
@@ -308,6 +308,6 @@ GLOBAL_LIST_EMPTY(radial_menus)
menu.show_to(user)
menu.wait(user, anchor, require_near)
var/answer = menu.selected_choice
qdel(menu)
QDEL_NULL(menu)
GLOB.radial_menus -= uniqueid
return answer
return answer
+90
View File
@@ -0,0 +1,90 @@
/obj/item/weapon/deskbell
name = "desk bell"
desc = "An annoying bell. Ring for service."
icon = 'icons/obj/items.dmi'
icon_state = "deskbell"
force = 2
throwforce = 2
w_class = 2.0
var/broken
attack_verb = list("annoyed")
var/static/radial_examine = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_examine")
var/static/radial_use = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_use")
/obj/item/weapon/deskbell/examine(mob/user)
..()
if(broken)
to_chat(user,"<b>It looks damaged, the ringer is stuck firmly inside.</b>")
/obj/item/weapon/deskbell/attack(mob/target as mob, mob/living/user as mob)
if(!broken)
ring()
..()
/obj/item/weapon/deskbell/attack_hand(mob/user)
//This defines the radials and what call we're assiging to them.
var/list/options = list()
options["examine"] = radial_examine
if(!broken)
options["use"] = radial_use
// Just an example, if the bell had no options, due to conditionals, nothing would happen here.
if(length(options) < 1)
return
// Right, if there's only one available radial...
// For example, say, the bell's broken so you can only examine, it just does that (doesn't show radial)..
var/list/choice = list()
if(length(options) == 1)
for(var/key in options)
choice = key
else
// If we have other options, it will show the radial menu for the player to decide.
choice = show_radial_menu(user, src, options, require_near = !issilicon(user))
// Once the player has decided their option, choose the behaviour that will happen under said option.
switch(choice)
if("examine")
examine(user)
if("use")
if(check_ability(user))
ring(user)
add_fingerprint(user)
/obj/item/weapon/deskbell/proc/ring(mob/user)
if(user.a_intent == "harm")
playsound(user.loc, 'sound/effects/deskbell_rude.ogg', 50, 1)
to_chat(user,"<span class='notice'>You hammer [src] rudely!</span>")
if (prob(2))
break_bell(user)
else
playsound(user.loc, 'sound/effects/deskbell.ogg', 50, 1)
to_chat(user,"<span class='notice'>You gracefully ring [src].</span>")
/obj/item/weapon/deskbell/proc/check_ability(mob/user)
if (ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if (H.hand)
temp = H.organs_by_name["l_hand"]
if(temp && !temp.is_usable())
to_chat(H,"<span class='notice'>You try to move your [temp.name], but cannot!</span>")
return 0
return 1
else
to_chat(user,"<span class='notice'>You are not able to ring [src].</span>")
return 0
/obj/item/weapon/deskbell/attackby(obj/item/i, mob/user, params)
if(!istype(i))
return
if(!broken)
ring(user)
/obj/item/weapon/deskbell/proc/break_bell(mob/user)
to_chat(user,"<span class='notice'>The ringing abruptly stops as [src]'s ringer gets jammed inside!</span>")
broken = 1
@@ -14,6 +14,7 @@
recipes += new/datum/stack_recipe("[display_name] grave marker", /obj/item/weapon/material/gravemarker, 5, time = 50, supplied_material = "[name]")
recipes += new/datum/stack_recipe("[display_name] ring", /obj/item/clothing/gloves/ring/material, 1, on_floor = 1, supplied_material = "[name]")
recipes += new/datum/stack_recipe("[display_name] bracelet", /obj/item/clothing/accessory/bracelet/material, 1, on_floor = 1, supplied_material = "[name]")
recipes += new/datum/stack_recipe("[display_name] deskbell", /obj/item/weapon/deskbell, 1, on_floor = 1, supplied_material = "[name]")
if(integrity>=50)
recipes += new/datum/stack_recipe("[display_name] door", /obj/structure/simple_door, 10, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
+3
View File
@@ -122,6 +122,8 @@
#include "code\_onclick\hud\human.dm"
#include "code\_onclick\hud\movable_screen_objects.dm"
#include "code\_onclick\hud\other_mobs.dm"
#include "code\_onclick\hud\radial.dm"
#include "code\_onclick\hud\radial_persistent.dm"
#include "code\_onclick\hud\robot.dm"
#include "code\_onclick\hud\screen_objects.dm"
#include "code\_onclick\hud\spell_screen_objects.dm"
@@ -844,6 +846,7 @@
#include "code\game\objects\effects\temporary_visuals\projectiles\tracer.dm"
#include "code\game\objects\items\antag_spawners.dm"
#include "code\game\objects\items\apc_frame.dm"
#include "code\game\objects\items\bells.dm"
#include "code\game\objects\items\blueprints.dm"
#include "code\game\objects\items\bodybag.dm"
#include "code\game\objects\items\contraband.dm"
Binary file not shown.
Binary file not shown.