mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Cleans up food slicing
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
edge = 0
|
edge = 0
|
||||||
flags = FPRINT | TABLEPASS | NOBLOODY
|
flags = FPRINT | TABLEPASS | NOBLOODY
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/proc/activate()
|
/obj/item/weapon/melee/energy/proc/activate(mob/living/user)
|
||||||
active = 1
|
active = 1
|
||||||
force = active_force
|
force = active_force
|
||||||
throwforce = active_throwforce
|
throwforce = active_throwforce
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
w_class = active_w_class
|
w_class = active_w_class
|
||||||
playsound(user, 'sound/weapons/saberon.ogg', 50, 1)
|
playsound(user, 'sound/weapons/saberon.ogg', 50, 1)
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/proc/deactivate()
|
/obj/item/weapon/melee/energy/proc/deactivate(mob/living/user)
|
||||||
active = 0
|
active = 0
|
||||||
force = initial(force)
|
force = initial(force)
|
||||||
throwforce = initial(throwforce)
|
throwforce = initial(throwforce)
|
||||||
@@ -30,9 +30,9 @@
|
|||||||
if ((CLUMSY in user.mutations) && prob(50))
|
if ((CLUMSY in user.mutations) && prob(50))
|
||||||
user.visible_message("\red [user] accidentally cuts \himself with \the [src].", "\red You accidentally cut yourself with \the [src].")
|
user.visible_message("\red [user] accidentally cuts \himself with \the [src].", "\red You accidentally cut yourself with \the [src].")
|
||||||
user.take_organ_damage(5,5)
|
user.take_organ_damage(5,5)
|
||||||
deactivate()
|
deactivate(user)
|
||||||
else
|
else
|
||||||
activate()
|
activate(user)
|
||||||
|
|
||||||
if(istype(user,/mob/living/carbon/human))
|
if(istype(user,/mob/living/carbon/human))
|
||||||
var/mob/living/carbon/human/H = user
|
var/mob/living/carbon/human/H = user
|
||||||
@@ -72,12 +72,12 @@
|
|||||||
sharp = 1
|
sharp = 1
|
||||||
edge = 1
|
edge = 1
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/axe/activate()
|
/obj/item/weapon/melee/energy/axe/activate(mob/living/user)
|
||||||
..()
|
..()
|
||||||
icon_state = "axe1"
|
icon_state = "axe1"
|
||||||
user << "\blue \The [src] is now energised."
|
user << "\blue \The [src] is now energised."
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/axe/deactivate()
|
/obj/item/weapon/melee/energy/axe/deactivate(mob/living/user)
|
||||||
..()
|
..()
|
||||||
icon_state = initial(icon_state)
|
icon_state = initial(icon_state)
|
||||||
user << "\blue \The [src] is de-energised. It's just a regular axe now."
|
user << "\blue \The [src] is de-energised. It's just a regular axe now."
|
||||||
@@ -104,7 +104,6 @@
|
|||||||
w_class = 2
|
w_class = 2
|
||||||
flags = FPRINT | TABLEPASS | NOSHIELD | NOBLOODY
|
flags = FPRINT | TABLEPASS | NOSHIELD | NOBLOODY
|
||||||
origin_tech = "magnets=3;syndicate=4"
|
origin_tech = "magnets=3;syndicate=4"
|
||||||
var/attack_verb_active = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/sword/New()
|
/obj/item/weapon/melee/energy/sword/New()
|
||||||
item_color = pick("red","blue","green","purple")
|
item_color = pick("red","blue","green","purple")
|
||||||
@@ -121,15 +120,15 @@
|
|||||||
/obj/item/weapon/melee/energy/sword/purple/New()
|
/obj/item/weapon/melee/energy/sword/purple/New()
|
||||||
item_color = "purple"
|
item_color = "purple"
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/sword/activate()
|
/obj/item/weapon/melee/energy/sword/activate(mob/living/user)
|
||||||
..()
|
..()
|
||||||
attack_verb = attack_verb_active
|
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
||||||
icon_state = "sword[item_color]"
|
icon_state = "sword[item_color]"
|
||||||
user << "\blue \The [src] is now energised."
|
user << "\blue \The [src] is now energised."
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/sword/deactivate()
|
/obj/item/weapon/melee/energy/sword/deactivate(mob/living/user)
|
||||||
..()
|
..()
|
||||||
attack_verb = initial(attack_verb)
|
attack_verb = list()
|
||||||
icon_state = initial(icon_state)
|
icon_state = initial(icon_state)
|
||||||
user << "\blue It can now be concealed."
|
user << "\blue It can now be concealed."
|
||||||
|
|
||||||
@@ -143,7 +142,7 @@
|
|||||||
desc = "Arrrr matey."
|
desc = "Arrrr matey."
|
||||||
icon_state = "cutlass0"
|
icon_state = "cutlass0"
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy/sword/pirate/activate()
|
/obj/item/weapon/melee/energy/sword/pirate/activate(mob/living/user)
|
||||||
..()
|
..()
|
||||||
icon_state = "cutlass1"
|
icon_state = "cutlass1"
|
||||||
|
|
||||||
@@ -151,8 +150,8 @@
|
|||||||
*Energy Blade
|
*Energy Blade
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Can't be activated or deactivated, so not actually a subtype of energy
|
//Can't be activated or deactivated, so no reason to be a subtype of energy
|
||||||
/obj/item/weapon/melee/energy_blade
|
/obj/item/weapon/melee/energy/blade
|
||||||
name = "energy blade"
|
name = "energy blade"
|
||||||
desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
|
desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
|
||||||
icon_state = "blade"
|
icon_state = "blade"
|
||||||
@@ -167,13 +166,13 @@
|
|||||||
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
||||||
var/datum/effect/effect/system/spark_spread/spark_system
|
var/datum/effect/effect/system/spark_spread/spark_system
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy_blade/New()
|
/obj/item/weapon/melee/energy/blade/New()
|
||||||
spark_system = new /datum/effect/effect/system/spark_spread()
|
spark_system = new /datum/effect/effect/system/spark_spread()
|
||||||
spark_system.set_up(5, 0, src)
|
spark_system.set_up(5, 0, src)
|
||||||
spark_system.attach(src)
|
spark_system.attach(src)
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy_blade/dropped()
|
/obj/item/weapon/melee/energy/blade/dropped()
|
||||||
del(src)
|
del(src)
|
||||||
|
|
||||||
/obj/item/weapon/melee/energy_blade/proc/throw()
|
/obj/item/weapon/melee/energy/blade/proc/throw()
|
||||||
del(src)
|
del(src)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
var/slice_path
|
var/slice_path
|
||||||
var/slices_num
|
var/slices_num
|
||||||
center_of_mass = list("x"=15, "y"=15)
|
center_of_mass = list("x"=15, "y"=15)
|
||||||
|
w_class = 2
|
||||||
|
|
||||||
//Placeholder for effect that trigger on eating that aren't tied to reagents.
|
//Placeholder for effect that trigger on eating that aren't tied to reagents.
|
||||||
/obj/item/weapon/reagent_containers/food/snacks/proc/On_Consume(var/mob/M)
|
/obj/item/weapon/reagent_containers/food/snacks/proc/On_Consume(var/mob/M)
|
||||||
@@ -126,11 +127,10 @@
|
|||||||
/obj/item/weapon/reagent_containers/food/snacks/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
/obj/item/weapon/reagent_containers/food/snacks/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||||
if(istype(W,/obj/item/weapon/storage))
|
if(istype(W,/obj/item/weapon/storage))
|
||||||
..() // -> item/attackby()
|
..() // -> item/attackby()
|
||||||
if(istype(W,/obj/item/weapon/storage))
|
return
|
||||||
..() // -> item/attackby()
|
|
||||||
|
// Eating with forks
|
||||||
if(istype(W,/obj/item/weapon/kitchen/utensil))
|
if(istype(W,/obj/item/weapon/kitchen/utensil))
|
||||||
|
|
||||||
var/obj/item/weapon/kitchen/utensil/U = W
|
var/obj/item/weapon/kitchen/utensil/U = W
|
||||||
|
|
||||||
if(!U.reagents)
|
if(!U.reagents)
|
||||||
@@ -157,65 +157,46 @@
|
|||||||
if (reagents.total_volume <= 0)
|
if (reagents.total_volume <= 0)
|
||||||
del(src)
|
del(src)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (is_sliceable())
|
||||||
|
//these are used to allow hiding edge items in food that is not on a table/tray
|
||||||
|
var/can_slice_here = isturf(src.loc) && ((locate(/obj/structure/table) in src.loc) || (locate(/obj/machinery/optable) in src.loc) || (locate(/obj/item/weapon/tray) in src.loc))
|
||||||
|
var/hide_item = !has_edge(W) || !can_slice_here
|
||||||
|
|
||||||
|
if (hide_item)
|
||||||
|
if (W.w_class >= src.w_class || W.is_robot_module())
|
||||||
|
return
|
||||||
|
|
||||||
|
user << "\red You slip [W] inside [src]."
|
||||||
|
user.u_equip(W)
|
||||||
|
if ((user.client && user.s_active != src))
|
||||||
|
user.client.screen -= W
|
||||||
|
W.dropped(user)
|
||||||
|
add_fingerprint(user)
|
||||||
|
contents += W
|
||||||
|
return
|
||||||
|
|
||||||
|
if (has_edge(W))
|
||||||
|
if (!can_slice_here)
|
||||||
|
user << "\red You cannot slice [src] here! You need a table or at least a tray to do it."
|
||||||
|
return
|
||||||
|
|
||||||
|
var/slices_lost = 0
|
||||||
|
if (W.w_class > 3)
|
||||||
|
user.visible_message("\blue [user] crudely slices \the [src] with [W]!", "\blue You crudely slice \the [src] with your [W]!")
|
||||||
|
slices_lost = rand(1,min(1,round(slices_num/2)))
|
||||||
|
else
|
||||||
|
user.visible_message("\blue [user] slices \the [src]!", "\blue You slice \the [src]!")
|
||||||
|
|
||||||
|
var/reagents_per_slice = reagents.total_volume/slices_num
|
||||||
|
for(var/i=1 to (slices_num-slices_lost))
|
||||||
|
var/obj/slice = new slice_path (src.loc)
|
||||||
|
reagents.trans_to(slice,reagents_per_slice)
|
||||||
|
del(src)
|
||||||
|
return
|
||||||
|
|
||||||
if((slices_num <= 0 || !slices_num) || !slice_path)
|
/obj/item/weapon/reagent_containers/food/snacks/proc/is_sliceable()
|
||||||
return 0
|
return (slices_num <= 0 || !slices_num || !slice_path)
|
||||||
|
|
||||||
var/inaccurate = 0
|
|
||||||
if( \
|
|
||||||
istype(W, /obj/item/weapon/kitchenknife) || \
|
|
||||||
istype(W, /obj/item/weapon/butch) || \
|
|
||||||
istype(W, /obj/item/weapon/scalpel) || \
|
|
||||||
istype(W, /obj/item/weapon/kitchen/utensil/knife) \
|
|
||||||
)
|
|
||||||
else if( \
|
|
||||||
istype(W, /obj/item/weapon/circular_saw) || \
|
|
||||||
istype(W, /obj/item/weapon/melee/energy/sword) && W:active || \
|
|
||||||
istype(W, /obj/item/weapon/melee/energy/blade) || \
|
|
||||||
istype(W, /obj/item/weapon/shovel) || \
|
|
||||||
istype(W, /obj/item/weapon/hatchet) \
|
|
||||||
)
|
|
||||||
inaccurate = 1
|
|
||||||
else if(W.w_class <= 2 && istype(src,/obj/item/weapon/reagent_containers/food/snacks/sliceable))
|
|
||||||
if(!iscarbon(user))
|
|
||||||
return 1
|
|
||||||
user << "\red You slip [W] inside [src]."
|
|
||||||
user.u_equip(W)
|
|
||||||
if ((user.client && user.s_active != src))
|
|
||||||
user.client.screen -= W
|
|
||||||
W.dropped(user)
|
|
||||||
add_fingerprint(user)
|
|
||||||
contents += W
|
|
||||||
return
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
if ( \
|
|
||||||
!isturf(src.loc) || \
|
|
||||||
!(locate(/obj/structure/table) in src.loc) && \
|
|
||||||
!(locate(/obj/machinery/optable) in src.loc) && \
|
|
||||||
!(locate(/obj/item/weapon/tray) in src.loc) \
|
|
||||||
)
|
|
||||||
user << "\red You cannot slice [src] here! You need a table or at least a tray to do it."
|
|
||||||
return 1
|
|
||||||
var/slices_lost = 0
|
|
||||||
if (!inaccurate)
|
|
||||||
user.visible_message( \
|
|
||||||
"\blue [user] slices \the [src]!", \
|
|
||||||
"\blue You slice \the [src]!" \
|
|
||||||
)
|
|
||||||
else
|
|
||||||
user.visible_message( \
|
|
||||||
"\blue [user] crudely slices \the [src] with [W]!", \
|
|
||||||
"\blue You crudely slice \the [src] with your [W]!" \
|
|
||||||
)
|
|
||||||
slices_lost = rand(1,min(1,round(slices_num/2)))
|
|
||||||
var/reagents_per_slice = reagents.total_volume/slices_num
|
|
||||||
for(var/i=1 to (slices_num-slices_lost))
|
|
||||||
var/obj/slice = new slice_path (src.loc)
|
|
||||||
reagents.trans_to(slice,reagents_per_slice)
|
|
||||||
del(src)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/item/weapon/reagent_containers/food/snacks/Del()
|
/obj/item/weapon/reagent_containers/food/snacks/Del()
|
||||||
if(contents)
|
if(contents)
|
||||||
@@ -242,7 +223,6 @@
|
|||||||
//N.emote("nibbles away at the [src]")
|
//N.emote("nibbles away at the [src]")
|
||||||
N.health = min(N.health + 1, N.maxHealth)
|
N.health = min(N.health + 1, N.maxHealth)
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// FOOD END
|
/// FOOD END
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user