Skip to content

Commit

Permalink
Throwing tweaks (#806)
Browse files Browse the repository at this point in the history
* throw speed reduction

* spinning improvement

* linterino

* remove the drop animation from throwing

* oops
  • Loading branch information
Kapu1178 authored Feb 12, 2024
1 parent 9125c0a commit b514af7
Show file tree
Hide file tree
Showing 125 changed files with 120 additions and 174 deletions.
6 changes: 4 additions & 2 deletions code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,11 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."

if(!living_owner.can_resist())
return
living_owner.changeNext_move(CLICK_CD_RESIST)

if(living_owner.last_special <= world.time)
return living_owner.resist_buckle()
. = living_owner.resist_buckle()
if(!.)
living_owner.changeNext_move(CLICK_CD_RESIST)

/atom/movable/screen/alert/shoes/untied
name = "Untied Shoes"
Expand Down
15 changes: 12 additions & 3 deletions code/controllers/subsystem/throwing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ SUBSYSTEM_DEF(throwing)
var/delayed_time = 0
///The last world.time value stored when the thrownthing was moving.
var/last_move = 0
/// If the thrown object is spinning
var/is_spinning = FALSE


/datum/thrownthing/New(thrownthing, target, init_dir, maxrange, speed, thrower, diagonals_first, force, gentle, callback, target_zone)
/datum/thrownthing/New(thrownthing, target, init_dir, maxrange, speed, thrower, diagonals_first, force, gentle, callback, target_zone, spin)
. = ..()
src.thrownthing = thrownthing
RegisterSignal(thrownthing, COMSIG_PARENT_QDELETING, PROC_REF(on_thrownthing_qdel))
Expand All @@ -102,9 +103,10 @@ SUBSYSTEM_DEF(throwing)
src.gentle = gentle
src.callback = callback
src.target_zone = target_zone

src.is_spinning = spin

/datum/thrownthing/Destroy()
stop_spinning()
SSthrowing.processing -= thrownthing
SSthrowing.currentrun -= thrownthing
thrownthing.throwing = null
Expand Down Expand Up @@ -189,7 +191,10 @@ SUBSYSTEM_DEF(throwing)
//done throwing, either because it hit something or it finished moving
if(!thrownthing)
return

thrownthing.throwing = null
stop_spinning()

if (!hit)
for (var/atom/movable/obstacle as anything in get_turf(thrownthing)) //looking for our target on the turf we land on.
if (obstacle == target)
Expand Down Expand Up @@ -221,3 +226,7 @@ SUBSYSTEM_DEF(throwing)
SEND_SIGNAL(thrownthing, COMSIG_MOVABLE_THROW_LANDED, src)

qdel(src)

/// Remove the spinning animation from the thrown object
/datum/thrownthing/proc/stop_spinning()
animate(thrownthing)
4 changes: 2 additions & 2 deletions code/datums/martial/sleeping_carp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@

force = 10
force_wielded = 20
throwforce = 20
throw_speed = 2
throwforce = 2
throw_speed = 1.5

block_chance = 50

Expand Down
2 changes: 1 addition & 1 deletion code/datums/mutations/tongue_spike.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
icon_state = "tonguespike"
force = 2
throwforce = 15 //15 + 2 (WEIGHT_CLASS_SMALL) * 4 (EMBEDDED_IMPACT_PAIN_MULTIPLIER) = i didnt do the math
throw_speed = 4
throw_speed = 1.5
embedding = list(
"embedded_pain_multiplier" = 4,
"embed_chance" = 100,
Expand Down
14 changes: 10 additions & 4 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,23 @@
///A lazylist of grab objects gripping us
var/tmp/list/grabbed_by

/// A ref to the throwing datum belonging to us.
var/tmp/datum/thrownthing/throwing = null

/// Look, we're defining this here so it doesn't need to be redefined 4 times, okay? Sorry.
var/tmp/germ_level = GERM_LEVEL_AMBIENT

var/anchored = FALSE
var/move_resist = MOVE_RESIST_DEFAULT
var/move_force = MOVE_FORCE_DEFAULT
var/pull_force = PULL_FORCE_DEFAULT
var/datum/thrownthing/throwing = null
var/throw_speed = 2 //How many tiles to move per ds when being thrown. Float values are fully supported

//How many tiles to move per ds when being thrown. Float values are fully supported.
var/throw_speed = 1
var/throw_range = 7
/// How much damage the object deals when impacting something else.
var/throwforce = 0

///Max range this atom can be thrown via telekinesis
var/tk_throw_range = 10
var/initial_language_holder = /datum/language_holder
Expand Down Expand Up @@ -1017,7 +1023,7 @@
else
target_zone = thrower.zone_selected

var/datum/thrownthing/thrown_thing = new(src, target, get_dir(src, target), range, speed, thrower, diagonals_first, force, gentle, callback, target_zone)
var/datum/thrownthing/thrown_thing = new(src, target, get_dir(src, target), range, speed, thrower, diagonals_first, force, gentle, callback, target_zone, spin)

var/dist_x = abs(target.x - src.x)
var/dist_y = abs(target.y - src.y)
Expand Down Expand Up @@ -1048,7 +1054,7 @@
quickstart = FALSE
throwing = thrown_thing
if(spin)
SpinAnimation(5, 1)
SpinAnimation(2)

SEND_SIGNAL(src, COMSIG_MOVABLE_POST_THROW, thrown_thing, spin)
SSthrowing.processing[src] = thrown_thing
Expand Down
8 changes: 6 additions & 2 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1358,12 +1358,16 @@ DEFINE_INTERACTABLE(/obj/item)

///Called by the carbon throw_item() proc. Returns null if the item negates the throw, or a reference to the thing to suffer the throw else.
/obj/item/proc/on_thrown(mob/living/carbon/user, atom/target)
if((item_flags & ABSTRACT) || HAS_TRAIT(src, TRAIT_NODROP))
if((item_flags & ABSTRACT))
return
user.dropItemToGround(src, silent = TRUE)

if(!user.dropItemToGround(src, silent = TRUE, animate = FALSE))
return

if(throwforce && HAS_TRAIT(user, TRAIT_PACIFISM))
to_chat(user, span_notice("You set [src] down gently on the ground."))
return

return src

/**
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/AI_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AI MODULES
force = 5
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
throw_speed = 3
throw_speed = 1.5
throw_range = 7
var/list/laws = list()
var/bypass_law_amt_check = 0
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/RCD.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RLD
item_flags = NOBLUDGEON
force = 0
throwforce = 10
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_NORMAL
custom_materials = list(/datum/material/iron=100000)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/broom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
force = 8
force_wielded = 12
throwforce = 10
throw_speed = 3
throw_speed = 1.5
throw_range = 7

w_class = WEIGHT_CLASS_NORMAL
Expand Down
4 changes: 3 additions & 1 deletion code/game/objects/items/chainsaw.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
force = 13
var/force_on = 24
w_class = WEIGHT_CLASS_HUGE

throwforce = 13
throw_speed = 2
throw_speed = 1
throw_range = 4

custom_materials = list(/datum/material/iron=13000)
attack_verb_continuous = list("saws", "tears", "lacerates", "cuts", "chops", "dices")
attack_verb_simple = list("saw", "tear", "lacerate", "cut", "chop", "dice")
Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/items/clown_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
w_class = WEIGHT_CLASS_TINY
item_flags = NOBLUDGEON
throwforce = 0
throw_speed = 3
throw_range = 7
grind_results = list(/datum/reagent/lye = 10)
var/cleanspeed = 3.5 SECONDS //slower than mop
Expand Down Expand Up @@ -206,7 +205,6 @@
hitsound = null //To prevent tap.ogg playing, as the item lacks of force
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BACK|ITEM_SLOT_BELT
throw_speed = 3
throw_range = 7
attack_verb_continuous = list("HONKS")
attack_verb_simple = list("HONK")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/camera_bug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
icon_state = "camera_bug"
w_class = WEIGHT_CLASS_TINY
inhand_icon_state = "camera_bug"
throw_speed = 4
throw_speed = 1.5
throw_range = 20
item_flags = NOBLUDGEON

Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/devices/chameleonproj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
throwforce = 5
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
var/can_use = 1
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/devices/multitool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
force = 5
w_class = WEIGHT_CLASS_SMALL
tool_behaviour = TOOL_MULTITOOL

throwforce = 0
throw_range = 7
throw_speed = 3

drop_sound = 'sound/items/handling/multitool_drop.ogg'
pickup_sound = 'sound/items/handling/multitool_pickup.ogg'
custom_materials = list(/datum/material/iron=50, /datum/material/glass=20)
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/devices/radio/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BELT
throw_speed = 3
throw_range = 7
w_class = WEIGHT_CLASS_SMALL
custom_materials = list(/datum/material/iron=75, /datum/material/glass=25)
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/devices/scanners/gas_analyzer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
flags_1 = CONDUCT_1
item_flags = NOBLUDGEON
slot_flags = ITEM_SLOT_BELT

throwforce = 0
throw_speed = 3
throw_range = 7

tool_behaviour = TOOL_ANALYZER
custom_materials = list(/datum/material/iron=30, /datum/material/glass=20)
grind_results = list(/datum/reagent/mercury = 5, /datum/reagent/iron = 5, /datum/reagent/silicon = 5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
slot_flags = ITEM_SLOT_BELT
throwforce = 3
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 7
custom_materials = list(/datum/material/iron=200)
var/mode = SCANNER_VERBOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
slot_flags = ITEM_SLOT_BELT
throwforce = 3
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 7
custom_materials = list(/datum/material/iron=200)
var/list/discovered = list() //hit a dna console to update the scanners database
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/devices/scanners/slime_scanner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
w_class = WEIGHT_CLASS_SMALL
flags_1 = CONDUCT_1
throwforce = 0
throw_speed = 3
throw_range = 7
custom_materials = list(/datum/material/iron=30, /datum/material/glass=20)

Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/devices/traitordevices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ effective or pretty fucking useless.
icon_state = "batterer"
throwforce = 5
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 7
flags_1 = CONDUCT_1
inhand_icon_state = "electronic"
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/dna_injector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
worn_icon_state = "pen"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_TINY

Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/door_seal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
flags_1 = CONDUCT_1
resistance_flags = FIRE_PROOF | ACID_PROOF
force = 5

throwforce = 5
throw_speed = 2
throw_range = 1

w_class = WEIGHT_CLASS_NORMAL
custom_materials = list(/datum/material/iron=5000,/datum/material/plasma=500)
/// how long the seal takes to place on the door
Expand Down
4 changes: 3 additions & 1 deletion code/game/objects/items/dualsaber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

force = 3
force_wielded = 34

throwforce = 5
throw_speed = 3
throw_speed = 1.5
throw_range = 5

block_chance = 75
block_sound = 'sound/weapons/block/block_energy.ogg'
sharpness = SHARP_EDGED
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/extinguisher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
flags_1 = CONDUCT_1
throwforce = 10
w_class = WEIGHT_CLASS_NORMAL
throw_speed = 2
throw_range = 7
force = 10
stamina_damage = 25
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/grenades/_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'

throw_speed = 3
throw_range = 7
stamina_damage = 0
stamina_cost = 0
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/grenades/festive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
w_class = WEIGHT_CLASS_SMALL
inhand_icon_state = "flare"
throw_speed = 3
throw_range = 7
det_time = 30

Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/grenades/ghettobomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
inhand_icon_state = "flashbang"
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
throw_speed = 3
throw_range = 7
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BELT
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/handcuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
slot_flags = ITEM_SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 5
custom_materials = list(/datum/material/iron=500)
breakouttime = 1 MINUTES
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/holosign_creator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
force = 0
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
throw_speed = 3
throw_range = 7
item_flags = NOBLUDGEON
var/list/signs
Expand Down
3 changes: 1 addition & 2 deletions code/game/objects/items/holy_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
force = 18
throw_speed = 3
throw_range = 4
throwforce = 10
slot_flags = ITEM_SLOT_BELT
Expand Down Expand Up @@ -543,7 +542,7 @@
slot_flags = ITEM_SLOT_HEAD
icon = 'icons/obj/clothing/hats.dmi'
force = 0
throw_speed = 4
throw_speed = 1.5
throw_range = 7
throwforce = 30
sharpness = SHARP_EDGED
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/implants/implantcase.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
inhand_icon_state = "implantcase"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 2
throw_range = 5
w_class = WEIGHT_CLASS_TINY
custom_materials = list(/datum/material/glass=500)
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/implants/implanter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
inhand_icon_state = "syringe_0"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
custom_materials = list(/datum/material/iron=600, /datum/material/glass=200)
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/implants/implantpad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
inhand_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
var/obj/item/implantcase/case = null
Expand Down
Loading

0 comments on commit b514af7

Please sign in to comment.