Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Множество мелких улучшений гранат, взрывов и всякого такого прочего. #12254

59 changes: 58 additions & 1 deletion code/controllers/subsystem/explosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ SUBSYSTEM_DEF(explosions)
var/cost_low_mov_atom = 0
var/cost_med_mov_atom = 0
var/cost_high_mov_atom = 0
var/cost_throw_turf = 0

var/list/lowturf = list()
var/list/medturf = list()
var/list/highturf = list()
var/list/flameturf = list()
var/list/throwturf = list()

var/list/low_mov_atom = list()
var/list/med_mov_atom = list()
Expand All @@ -47,6 +49,7 @@ SUBSYSTEM_DEF(explosions)
msg += "LO:[round(cost_low_mov_atom, 1)]|"
msg += "MO:[round(cost_med_mov_atom, 1)]|"
msg += "HO:[round(cost_high_mov_atom, 1)]|"
msg += "TO:[round(cost_throw_turf, 1)]|"

msg += "} "

Expand All @@ -55,6 +58,7 @@ SUBSYSTEM_DEF(explosions)
msg += "MT:[medturf.len]|"
msg += "HT:[highturf.len]|"
msg += "FT:[flameturf.len]||"
msg += "TT:[throwturf.len]||"

msg += "LO:[low_mov_atom.len]|"
msg += "MO:[med_mov_atom.len]|"
Expand Down Expand Up @@ -236,6 +240,8 @@ SUBSYSTEM_DEF(explosions)
if(EXPLODE_LIGHT)
SSexplosions.lowturf += explode

SSexplosions.throwturf += list(list(explode, epicenter, severity))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

странно ли что отброс не зависит от силы взрыва?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зависит. Сила взрыва это северити.
Разброс зависит от северити разрушения турфа, всё ок.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

меня немного воротит от того что эпицент хранится для кучи разных турфов при том что он всего один. почему нельзя откидывать предметы в ex_act?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть ли причина опять игнорировать тг? Там, например, предусматривается влияние нескольких взрывов на объект, прежде чем передавать в контроллер

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У них там кринж, я сделаю лучше. Сейчас сделаю учитывание нескольких взрывов. И оно будет круче!
:)


if(prob(40) && dist < flame_range && !isspaceturf(explode) && !explode.density)
flameturf += explode

Expand Down Expand Up @@ -427,6 +433,7 @@ SUBSYSTEM_DEF(explosions)
Master.laggy_byond_map_update_incoming()

if(currentpart == SSEXPLOSIONS_MOVABLES)
currentpart = SSEXPLOSIONS_THROWS

timer = TICK_USAGE_REAL
var/list/local_high_mov_atom = high_mov_atom
Expand Down Expand Up @@ -454,5 +461,55 @@ SUBSYSTEM_DEF(explosions)
continue
EX_ACT(movable_thing, EXPLODE_LIGHT)
cost_low_mov_atom = MC_AVERAGE(cost_low_mov_atom, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))


if(currentpart == SSEXPLOSIONS_THROWS)
timer = TICK_USAGE_REAL
var/list/local_throwturfs = throwturf
throwturf = list()

for(var/list/throwlist in local_throwturfs)
var/turf/affected = throwlist[1]
var/turf/epicenter = throwlist[2]
var/severitypower = throwlist[3]

var/throwpower = 1
switch(severitypower)
if(EXPLODE_LIGHT)
throwpower = 5
if(EXPLODE_HEAVY)
throwpower = 15
if(EXPLODE_DEVASTATE)
throwpower = 30

var/opposite_to_epicenter
var/epicentered = FALSE
if((epicenter.x == affected.x) && (epicenter.y == affected.y) && (epicenter.z == affected.z))
epicentered = TRUE
else
opposite_to_epicenter = locate(clamp(affected.x - (epicenter.x - affected.x) * throwpower, 0, 255), clamp(affected.y - (epicenter.y - affected.y) * throwpower, 0, 255), affected.z) //180 degree to epicenter

for(var/atom/movable/I in affected.contents)
if(I.anchored || QDELETED(I))
continue

if(epicentered)
//Self-sacrifice mechanics
var/covered = FALSE
for(var/atom/movable/Cover in epicenter.contents)
if(ishuman(Cover) && prob(50))
var/mob/living/carbon/human/H = Cover
if(!H.lying)
continue
opposite_to_epicenter = Cover
covered = TRUE
break
Comment on lines +495 to +505
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это интересная идея, но место плохое - стоит сразу где-то в части самого взрыва propagate_blastwave смотреть, чем в более абстратном контроллере, который просто последствия процессит.


if(!covered)
var/angle = rand(1, 360)
var/radius = throwpower * 2
opposite_to_epicenter = locate(affected.x + round(radius * cos(angle), 1), affected.y + round(radius * sin(angle), 1), affected.z) //random direction

I.throw_at(opposite_to_epicenter, 5*throwpower/I.w_class, throwpower/I.w_class)
cost_throw_turf = MC_AVERAGE(cost_throw_turf, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))

currentpart = SSEXPLOSIONS_TURFS
5 changes: 5 additions & 0 deletions code/controllers/subsystem/throwing.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define MAX_THROWING_DIST 512 // 2 z-levels on default width
#define MAX_TICKS_TO_MAKE_UP 3 //how many missed ticks will we attempt to make up for this run.
#define THROWDAMAGE_FINE_TUNE 1 //Throwdamage multiplier

SUBSYSTEM_DEF(throwing)
name = "Throwing"
Expand Down Expand Up @@ -51,6 +52,7 @@
var/init_dir
var/maxrange
var/speed
var/throwmomentum
var/mob/thrower
var/diagonals_first
var/dist_travelled = 0
Expand All @@ -71,6 +73,7 @@
src.init_dir = init_dir
src.maxrange = maxrange
src.speed = speed
src.throwmomentum = speed * thrownthing.w_class * THROWDAMAGE_FINE_TUNE

Check warning on line 76 in code/controllers/subsystem/throwing.dm

View workflow job for this annotation

GitHub Actions / DreamChecker

field access requires static type: "w_class"
src.thrower = thrower
src.diagonals_first = diagonals_first
src.callback = callback
Expand Down Expand Up @@ -203,3 +206,5 @@
if (AM.density && !AM.throwpass)
finialize(null, AM)
return TRUE

#undef THROWDAMAGE_FINE_TUNE
2 changes: 2 additions & 0 deletions code/datums/outfits/misc/responders.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
backpack_contents = list(
/obj/item/weapon/storage/firstaid/tactical,
/obj/item/weapon/storage/box/flashbangs,
/obj/item/weapon/storage/box/shrapnel,
/obj/item/device/flashlight/seclite,
/obj/item/weapon/plastique,
/obj/item/weapon/tank/emergency_oxygen/double,
Expand Down Expand Up @@ -274,6 +275,7 @@
/obj/item/weapon/tank/emergency_oxygen/double,
/obj/item/weapon/storage/firstaid/small_firstaid_kit/space,
/obj/item/device/flashlight/seclite,
/obj/item/weapon/storage/box/bolas,
/obj/item/weapon/plastique,
/obj/item/weapon/grenade/empgrenade,
/obj/item/ammo_box/shotgun/beanbag,
Expand Down
10 changes: 7 additions & 3 deletions code/defines/obj/weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@
sharp = 1
edge = 1
desc = "Could probably be used as ... a throwing weapon?"
w_class = SIZE_TINY
w_class = SIZE_MIDGET
force = 5.0
throwforce = 8.0
throw_range = 2
throw_speed = 0.5
item_state = "shard-glass"
g_amt = 3750
hitsound = 'sound/weapons/bladeslice.ogg'
Expand Down Expand Up @@ -234,8 +236,8 @@
/obj/item/weapon/shard/phoron
name = "phoron shard"
desc = "A shard of phoron glass. Considerably tougher then normal glass shards. Apparently not tough enough to be a window."
force = 8.0
throwforce = 15.0
force = 6
throwforce = 9
icon_state = "phoronlarge"
item_state_world = "phoronlarge_world"
item_state_base = "phoron"
Expand All @@ -261,6 +263,8 @@
item_state_base = "shrapnel"
desc = "A bunch of tiny bits of shattered metal."
on_step_sound = 'sound/effects/metalstep.ogg'
force = 7
throwforce = 10

/obj/item/weapon/SWF_uplink
name = "station-bounced radio"
Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@
else if(isobj(AM))
var/obj/O = AM
if(O.throwforce)
take_damage(O.throwforce)
take_damage(O.throwforce * throwingdatum.throwmomentum)
check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST))
return

Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
full_w_class = SIZE_TINY
throw_speed = 4
throw_range = 20
shrapnel_type = null

var/self_delay = SKILL_TASK_TOUGH
var/other_delay = 40
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/nanopaste.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
amount = 10
var/delay = 1 SECOND
required_skills = list(/datum/skill/engineering = SKILL_LEVEL_TRAINED)
shrapnel_type = null

/obj/item/stack/nanopaste/attack(mob/living/M, mob/user, def_zone)
var/skill_delay = apply_skill_bonus(user, delay, required_skills, multiplier = -0.25)
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
qualities = list(
QUALITY_PRYING = 0.5
)
shrapnel_type = /obj/item/weapon/shard/shrapnel

/obj/item/stack/rods/update_icon()
var/amount = get_amount()
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/stacks/sheets/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
origin_tech = "materials=1"
var/created_window = /obj/structure/window/thin
required_skills = list(/datum/skill/construction = SKILL_LEVEL_NOVICE)
shrapnel_type = /obj/item/weapon/shard
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можешь еще тайп в
/obj/item/stack/sheet/glass/after_throw
и
/obj/item/stack/sheet/rglass/after_throw

закинуть вместо текущего хардкода спавна осколков

не знаю, есть ли у других стеков такой механ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут не понял. Мне нужен был один механ для всех видов стаков. Чтобы и стекло и фороновое стекло и усиленное стекло и металл и слитки и пласталь и провода и роды и плитки пола и стеклянные плитки пола - давали осколки.


/obj/item/stack/sheet/glass/cyborg
name = "glass"
Expand Down Expand Up @@ -172,6 +173,8 @@
origin_tech = "materials=2"
required_skills = list(/datum/skill/construction = SKILL_LEVEL_TRAINED)

shrapnel_type = /obj/item/weapon/shard

/obj/item/stack/sheet/rglass/cyborg
name = "reinforced glass"
desc = "Glass which seems to have rods or something stuck in them."
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/stacks/sheets/leather.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
singular_name = "wet leather piece"
icon_state = "sheet-wetleather"
origin_tech = ""
shrapnel_type = null
var/wetness = 30 //Reduced when exposed to high temperautres
var/drying_threshold_temperature = 500 //Kelvin to start drying

Expand All @@ -90,6 +91,7 @@
singular_name = "leather piece"
icon_state = "sheet-leather"
origin_tech = "materials=2"
shrapnel_type = null



Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/sheets/light.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
throw_range = 20
flags = CONDUCT
max_amount = 60
shrapnel_type = /obj/item/weapon/shard

/obj/item/stack/light_w/attackby(obj/item/I, mob/user, params)
if(iscutter(I))
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/stacks/sheets/mineral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ var/global/list/datum/stack_recipe/silver_recipes = list ( \
origin_tech = "materials=1"
sheettype = "sandstone"
can_be_wall = TRUE
shrapnel_type = null


/obj/item/stack/sheet/mineral/sandstone/atom_init()
Expand All @@ -115,6 +116,7 @@ var/global/list/datum/stack_recipe/silver_recipes = list ( \
perunit = 3750
sheettype = "diamond"
can_be_wall = TRUE
shrapnel_type = /obj/item/weapon/shard


/obj/item/stack/sheet/mineral/diamond/atom_init()
Expand Down Expand Up @@ -148,6 +150,7 @@ var/global/list/datum/stack_recipe/silver_recipes = list ( \
sheettype = "phoron"
is_fusion_fuel = TRUE
can_be_wall = TRUE
shrapnel_type = null


/obj/item/stack/sheet/mineral/phoron/atom_init()
Expand All @@ -162,6 +165,7 @@ var/global/list/datum/stack_recipe/silver_recipes = list ( \
icon_state = "sheet-plastic"
origin_tech = "materials=3"
perunit = 2000
shrapnel_type = null

/obj/item/stack/sheet/mineral/plastic/cyborg
name = "plastic sheets"
Expand Down
13 changes: 13 additions & 0 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ var/global/list/datum/stack_recipe/metal_recipes = list (
flags = CONDUCT
origin_tech = "materials=1"

/obj/item/stack/sheet/metal/attackby(obj/item/I, mob/user, params)
if(iscutter(I))
var/list/resources_to_use = list()
resources_to_use[src] = 1
if(!use_multi(user, resources_to_use))
return
new /obj/item/weapon/shard/shrapnel(user.loc)
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно сделать чуточку красивее

if()
   ...
  return
  
return ..()

return ..()

/obj/item/stack/sheet/metal/cyborg
name = "metal"
desc = "Sheets made out off metal. It has been dubbed Metal Sheets."
Expand Down Expand Up @@ -167,6 +177,7 @@ var/global/list/datum/stack_recipe/wood_recipes = list (
singular_name = "wood plank"
icon_state = "sheet-wood"
origin_tech = "materials=1;biotech=1"
shrapnel_type = null

/obj/item/stack/sheet/wood/cyborg
name = "wooden plank"
Expand Down Expand Up @@ -202,6 +213,7 @@ var/global/list/datum/stack_recipe/old_cloth_recipes = list (
singular_name = "cloth roll"
icon_state = "sheet-cloth"
origin_tech = "materials=2"
shrapnel_type = null

/obj/item/stack/sheet/cloth/atom_init(mapload, new_amount = null, merge = FALSE, force_old = FALSE, old_chance = 33)
recipes = cloth_recipes
Expand Down Expand Up @@ -243,6 +255,7 @@ var/global/list/datum/stack_recipe/cardboard_recipes = list ( \
singular_name = "cardboard sheet"
icon_state = "sheet-card"
origin_tech = "materials=1"
shrapnel_type = null

/obj/item/stack/sheet/cardboard/atom_init()
recipes = cardboard_recipes
Expand Down
10 changes: 10 additions & 0 deletions code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
var/full_w_class = SIZE_SMALL // The weight class the stack should have at amount > 2/3rds max_amount
var/is_fusion_fuel

var/shrapnel_type = /obj/item/weapon/shard/shrapnel
DarthSidiousPalpatine marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/stack/atom_init(mapload, new_amount = null, merge = FALSE)
. = ..()

Expand All @@ -46,6 +48,14 @@

return ..()

/obj/item/stack/ex_act(severity)
if(shrapnel_type)
for(var/i in 1 to get_amount())
if(prob(20))
new shrapnel_type(loc)

..(severity)

/obj/item/stack/proc/update_weight()
if(amount <= (max_amount * (1 / 3)))
w_class = clamp(full_w_class - 2, SIZE_MINUSCULE, full_w_class)
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/stacks/telecrystal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
full_w_class = SIZE_SMALL
max_amount = 50

shrapnel_type = /obj/item/weapon/shard

/obj/item/stack/telecrystal/attack(atom/target, mob/user, proximity, params)
if(target == user) //You can't go around smacking people with crystals to find out if they have an uplink or not.
for(var/obj/item/weapon/implant/uplink/I in target)
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/tiles/light.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
var/on = 1
var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken
turf_type = /turf/simulated/floor/light
shrapnel_type = /obj/item/weapon/shard

/obj/item/stack/tile/light/atom_init()
. = ..()
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/stacks/tiles/tile_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
max_amount = 60
origin_tech = "biotech=1"
turf_type = /turf/simulated/floor/grass
shrapnel_type = null

/*
* Wood
Expand All @@ -45,6 +46,7 @@
flags = CONDUCT
max_amount = 60
turf_type = /turf/simulated/floor/wood
shrapnel_type = null

/*
* Carpets
Expand All @@ -62,6 +64,7 @@
flags = CONDUCT
max_amount = 60
turf_type = /turf/simulated/floor/carpet
shrapnel_type = null
var/carpet_icon_state = "carpet"

/obj/item/stack/tile/carpet/black
Expand Down