Skip to content

Commit

Permalink
Adds melee damage to guns (#2382)
Browse files Browse the repository at this point in the history
does a thing

should fix autofire

updates banquet

updates force multiplier

a
  • Loading branch information
Coxswain-Navigator authored Sep 14, 2024
1 parent aafafb2 commit daa8725
Show file tree
Hide file tree
Showing 25 changed files with 261 additions and 56 deletions.
22 changes: 13 additions & 9 deletions ModularTegustation/tegu_items/extraction/egosurgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var/maximum_energy = 5
var/target_item = null
var/current_progress = 0
var/random_sound_list = list( //Random surgery sound for every step
var/random_sound_list = list( // Random surgery sound for every step
'sound/items/jaws_pry.ogg',
'sound/items/drill_use.ogg',
'sound/items/welder.ogg',
Expand All @@ -24,8 +24,8 @@
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_WORK_COMPLETED, PROC_REF(WorkCharge))
RegisterSignal(SSdcs, COMSIG_GLOB_ORDEAL_END, PROC_REF(OrdealCharge))
if(SSlobotomy_corp.next_ordeal_level > 2) //next_ordeal_level is 2 at roundstart
maximum_energy = (5 + (5 * (SSlobotomy_corp.next_ordeal_level - 2))) //The math is weird on this - next_ordeal_level is the ordeal AFTER the one about to spawn, so 2 higher.
if(SSlobotomy_corp.next_ordeal_level > 2) // next_ordeal_level is 2 at roundstart
maximum_energy = (5 + (5 * (SSlobotomy_corp.next_ordeal_level - 2))) // The math is weird on this - next_ordeal_level is the ordeal AFTER the one about to spawn, so 2 higher.

/obj/item/extraction/upgrade_tool/Destroy()
UnregisterSignal(SSdcs, COMSIG_GLOB_WORK_COMPLETED)
Expand Down Expand Up @@ -59,7 +59,7 @@
/obj/item/extraction/upgrade_tool/pre_attack(atom/A, mob/living/user, params)
. = ..()
if(!tool_checks(user))
return FALSE //You can't do any special interactions
return FALSE // You can't do any special interactions
if(energy < 1)
to_chat(user, span_warning("The [src] is out of energy!"))
return FALSE
Expand All @@ -85,14 +85,14 @@

if(istype(A, /obj/item/ego_weapon))
var/obj/item/ego_weapon/theweapon = A
if(theweapon.force_multiplier >= 1.09) //Should prevent weirdness with numbers like 19.9999
if(theweapon.force_multiplier >= 1.09) // Should prevent weirdness with numbers like 19.9999
to_chat(user, span_warning("You can't modify this any further!"))
return
target_item = theweapon
ToolPrepare(user)
else if(istype(A, /obj/item/gun/ego_gun))
var/obj/item/gun/ego_gun/thegun = A
if(thegun.projectile_damage_multiplier >= 1.09) //Should prevent weirdness with numbers like 19.9999
if(thegun.projectile_damage_multiplier >= 1.09) // Should prevent weirdness with numbers like 19.9999
to_chat(user, span_warning("You can't modify this any further!"))
return
target_item = thegun
Expand All @@ -113,7 +113,7 @@
if(!target_item)
return
to_chat(user, span_warning("You continue to attempt to modify [target_item]!"))
playsound(get_turf(user), "[pick(random_sound_list)]", 50, TRUE) //I should probably give each sound custom text but its funnier to leave it to the player's imagination
playsound(get_turf(user), "[pick(random_sound_list)]", 50, TRUE) // I should probably give each sound custom text but its funnier to leave it to the player's imagination

/obj/item/extraction/upgrade_tool/proc/ToolProgress(mob/user)
if(!target_item)
Expand All @@ -135,11 +135,15 @@
return
if(istype(target_item, /obj/item/ego_weapon))
var/obj/item/ego_weapon/theweapon = target_item
theweapon.force_multiplier = (clamp(theweapon.force_multiplier + 0.05, 0, 1.2))
theweapon.force_multiplier = (clamp(theweapon.force_multiplier + 0.05, 0, 1.2)) // Add 0.05 or 5% to the force multiplier

else if(istype(target_item, /obj/item/gun/ego_gun))
var/obj/item/gun/ego_gun/thegun = target_item
thegun.projectile_damage_multiplier = (clamp(thegun.projectile_damage_multiplier + 0.05, 0, 1.2))
var/old_multiplier = thegun.force_multiplier
thegun.force_multiplier = (clamp(thegun.force_multiplier + 0.05, 0, 1.2))
var/difference = thegun.force_multiplier - old_multiplier
if(difference > 0)
thegun.projectile_damage_multiplier *= (1 + difference) // Sure we COULD just set it equal to force_multiplier but that would break some guns
to_chat(user, span_warning("You successfully improve [target_item]!"))
target_item = null
current_progress = 0
Expand Down
8 changes: 2 additions & 6 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@
if(I.force)
var/justice_mod = 1 + (get_modified_attribute_level(user, JUSTICE_ATTRIBUTE)/100)
var/damage = I.force * justice_mod
if(istype(I, /obj/item/ego_weapon))
var/obj/item/ego_weapon/theweapon = I
damage *= theweapon.force_multiplier
damage *= I.force_multiplier
apply_damage(damage, I.damtype, white_healable = TRUE)
if(I.damtype in list(RED_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE))
if(prob(33))
Expand All @@ -303,9 +301,7 @@
log_combat(user, src, "attacked", I)
var/justice_mod = 1 + (get_modified_attribute_level(user, JUSTICE_ATTRIBUTE)/100)
var/damage = I.force * justice_mod
if(istype(I, /obj/item/ego_weapon))
var/obj/item/ego_weapon/theweapon = I
damage *= theweapon.force_multiplier
damage *= I.force_multiplier
take_damage(damage, I.damtype, attack_dir = get_dir(src, user))
return TRUE

Expand Down
8 changes: 2 additions & 6 deletions code/datums/ai/sanity/_sanityloss_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,7 @@
..()
retaliate(user)
var/aggro = I.force
if(istype(I, /obj/item/ego_weapon))
var/obj/item/ego_weapon/EW = I
aggro *= EW.force_multiplier
aggro *= I.force_multiplier
if(ishuman(user))
aggro *= 1 + get_modified_attribute_level(user, JUSTICE_ATTRIBUTE) * 0.01
RegisterAggroValue(user, aggro, I.damtype)
Expand Down Expand Up @@ -779,9 +777,7 @@
var/mob/living/carbon/human/H = I.thrownby
retaliate(H)
var/aggro = I.throwforce * (1 + get_modified_attribute_level(H, JUSTICE_ATTRIBUTE) * 0.01)
if(istype(I, /obj/item/ego_weapon))
var/obj/item/ego_weapon/EW = I
aggro *= EW.force_multiplier
aggro *= I.force_multiplier
RegisterAggroValue(H, aggro, I.damtype)
return

Expand Down
2 changes: 2 additions & 0 deletions code/datums/components/fullauto.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
return
if(get_dist(source.mob, _target) < 2) //Adjacent clicking.
return
if(source.mob.next_move > world.time) //Too busy doing something else to fire
return

if(isnull(location)) //Clicking on a screen object.
if(_target.plane != CLICKCATCHER_PLANE) //The clickcatcher is a special case. We want the click to trigger then, under it.
Expand Down
10 changes: 10 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
/// What Color its swing animation is
var/swingcolor

/// How many deciseconds between attacks, times ten.
var/attack_speed = 1
/// A multiplier added to force through various means. Used primarily for weapon upgrades.
var/force_multiplier = 1

/obj/item/Initialize()

if(attack_verb_continuous)
Expand Down Expand Up @@ -354,6 +359,11 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
add_fingerprint(usr)
return ..()

/obj/item/attack(mob/M, mob/user)
. = ..()
if(attack_speed && attack_speed != 1)
user.changeNext_move(CLICK_CD_MELEE * attack_speed)

/obj/item/attack_hand(mob/user)
. = ..()
if(.)
Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/items/ego_weapons/_ego_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
drag_slowdown = 1
swingstyle = WEAPONSWING_SMALLSWEEP
var/list/attribute_requirements = list()
var/attack_speed = 1
var/special
var/force_multiplier = 1

/// Is CleanUp proc running?
var/cleaning = FALSE
Expand All @@ -36,8 +34,6 @@
if(!CanUseEgo(user))
return FALSE
. = ..()
if(attack_speed && attack_speed != 1)
user.changeNext_move(CLICK_CD_MELEE * attack_speed)

if(charge && attack_charge_gain)
HandleCharge(1, target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
desc = "a template for fullstop."
icon_state = "fullstop"
inhand_icon_state = "fullstop"
force = 14
ammo_type = /obj/item/ammo_casing/caseless/fullstop //Does 10 damage
weapon_weight = WEAPON_HEAVY
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
Expand All @@ -17,6 +18,7 @@
desc = "A heavy rifle. Guns like these are expensive in the City. You could buy a whole other weapon of good quality with the money for this one's bullets."
icon_state = "fullstop"
inhand_icon_state = "fullstop"
force = 20
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
shotsleft = 30
autofire = 0.12 SECONDS
Expand All @@ -33,6 +35,8 @@
desc = "A fullstop pistol. Looks familiar."
icon_state = "fullstoppistol"
inhand_icon_state = "fullstopsniper"
force = 12
attack_speed = 0.5
shotsleft = 17
fire_delay = 5
reloadtime = 1.3 SECONDS
Expand All @@ -48,6 +52,7 @@
desc = "A sniper rifle. Despite the cost and heavy regulations, you could still kill someone stealthily from a good distance with this."
icon_state = "fullstopsniper"
inhand_icon_state = "fullstopsniper"
force = 20
fire_sound = 'sound/weapons/gun/sniper/shot.ogg'
zoom_amt = 10 //Long range, enough to see in front of you, but no tiles behind you.
zoomable = TRUE
Expand All @@ -67,6 +72,8 @@
desc = "An expensive pistol. Keep your hands steady. It's not over yet."
icon_state = "fullstopdeagle"
inhand_icon_state = "fullstopdeagle"
force = 17
attack_speed = 0.5
weapon_weight = WEAPON_LIGHT
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
projectile_damage_multiplier = 4
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/ego_weapons/non_abnormality/kcorp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
inhand_icon_state = "kpistol"
lefthand_file = 'ModularTegustation/Teguicons/lc13_left.dmi'
righthand_file = 'ModularTegustation/Teguicons/lc13_right.dmi'
force = 8
ammo_type = /obj/item/ammo_casing/caseless/ego_kcorp
fire_delay = 5
shotsleft = 12
Expand All @@ -109,6 +110,7 @@
desc = "A lime green machinepistol used by Kcorp."
icon_state = "ksmg"
inhand_icon_state = "ksmg"
force = 17
fire_sound = 'sound/weapons/gun/smg/mp7.ogg'
autofire = 0.08 SECONDS
fire_delay = 1
Expand All @@ -127,6 +129,7 @@
desc = "A short grenade launcher used by Kcorp."
icon_state = "kgrenade"
inhand_icon_state = "kgrenade"
force = 17
ammo_type = /obj/item/ammo_casing/caseless/ego_knade
fire_delay = 7
shotsleft = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

/obj/item/ego_weapon/city/lcorp/proc/IncreaseAttributes(mob/living/user, obj/item/egoshard/egoshard)
damtype = egoshard.damage_type
force = (egoshard.base_damage) //base damage
force = egoshard.base_damage //base damage
for(var/atr in attribute_requirements)
attribute_requirements[atr] = egoshard.stat_requirement
to_chat(user, span_warning("The requirements to equip [src] have increased!"))
Expand All @@ -65,6 +65,7 @@
name = "l-corp combat baton"
icon_state = "baton"
desc = "A baton issued by L-Corp to those who cannot utilize E.G.O."
swingstyle = WEAPONSWING_LARGESWEEP
hitsound = 'sound/weapons/fixer/generic/baton1.ogg'
force = 22

Expand All @@ -84,6 +85,7 @@
name = "l-corp club"
icon_state = "club"
desc = "A heavy club issued by L-Corp to those who cannot utilize E.G.O."
swingstyle = WEAPONSWING_LARGESWEEP
hitsound = 'sound/weapons/fixer/generic/club2.ogg'
force = 35 //Still less DPS, replaces baseball bat
attack_speed = 1.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

/obj/item/gun/ego_gun/city/lcorp/proc/IncreaseAttributes(mob/living/user, obj/item/egoshard/egoshard)
damtype = egoshard.damage_type
force = (egoshard.base_damage * 0.7) //70% of base damage which is to be expected of guns. Currently all guns override this with their own values.
tier = egoshard.tier
for(var/atr in attribute_requirements)
attribute_requirements[atr] = egoshard.stat_requirement
Expand Down Expand Up @@ -116,6 +117,8 @@
inhand_icon_state = "pistol"
special = "This weapon has pinpoint accuracy when dual wielded."
ammo_type = /obj/item/ammo_casing/caseless/lcorp/pistol
attack_speed = 0.5
force = 6
fire_delay = 10
shotsleft = 7
reloadtime = 2.1 SECONDS
Expand All @@ -134,13 +137,19 @@
damage = 11
damage_tier = list(11,20,30,55,90)

/obj/item/gun/ego_gun/city/lcorp/pistol/IncreaseAttributes(mob/living/user, obj/item/egoshard/egoshard)
..()
force = (egoshard.base_damage * 0.42) // 2 attacks per attack cycle due to being a pistol

/obj/item/gun/ego_gun/city/lcorp/automatic_pistol
name = "l-corp automatic pistol"
desc = "A rapid-fire pistol issued by L-Corp to those who cannot utilize E.G.O."
icon_state = "automatic"
inhand_icon_state = "automatic"
w_class = WEIGHT_CLASS_NORMAL
ammo_type = /obj/item/ammo_casing/caseless/lcorp/automatic
attack_speed = 0.5
force = 6
fire_sound = 'sound/weapons/gun/pistol/shot.ogg'
vary_fire_sound = FALSE
shotsleft = 20
Expand All @@ -157,6 +166,10 @@
damage = 2
damage_tier = list(2,4,6,9,15)

/obj/item/gun/ego_gun/city/lcorp/automatic_pistol/IncreaseAttributes(mob/living/user, obj/item/egoshard/egoshard)
..()
force = (egoshard.base_damage * 0.42) // 2 attacks per attack cycle due to being a pistol

///////////////////
//CLERK EQUIPMENT//
///////////////////
Expand All @@ -170,6 +183,8 @@
worn_icon_state = "gun"
lefthand_file = 'icons/mob/inhands/weapons/guns_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/guns_righthand.dmi'
attack_speed = 0.5
force = 6
w_class = WEIGHT_CLASS_NORMAL
ammo_type = /obj/item/ammo_casing/caseless/ego_clerk
burst_size = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
inhand_icon_state = "lccb_pistol"
icon = 'icons/obj/limbus_weapons.dmi'
fire_sound = 'sound/weapons/gun/pistol/shot.ogg'
force = 8
attack_speed = 0.5
weapon_weight = WEAPON_LIGHT
ammo_type = /obj/item/ammo_casing/caseless/fullstop
shotsleft = 13
Expand All @@ -19,6 +21,8 @@
icon_state = "lccb_burstpistol"
inhand_icon_state = "lccb_pistol"
icon = 'icons/obj/limbus_weapons.dmi'
force = 8
attack_speed = 0.5
fire_sound = 'sound/weapons/gun/pistol/shot.ogg'
weapon_weight = WEAPON_LIGHT
ammo_type = /obj/item/ammo_casing/caseless/fullstop
Expand All @@ -35,6 +39,8 @@
inhand_icon_state = "lccb_magnum"
icon = 'icons/obj/limbus_weapons.dmi'
fire_sound = 'sound/weapons/gun/pistol/shot.ogg'
force = 8
attack_speed = 0.5
weapon_weight = WEAPON_HEAVY
ammo_type = /obj/item/ammo_casing/caseless/fullstop
projectile_damage_multiplier = 6 //60 damage per bullet
Expand All @@ -49,6 +55,7 @@
icon_state = "lccb_smg"
inhand_icon_state = "lccb_smg"
icon = 'icons/obj/limbus_weapons.dmi'
force = 14
fire_sound = 'sound/weapons/gun/smg/mp7.ogg'
ammo_type = /obj/item/ammo_casing/caseless/fullstop
spread = 30
Expand All @@ -63,6 +70,7 @@
icon_state = "lccb_shotgun"
inhand_icon_state = "lccb_shotgun"
icon = 'icons/obj/limbus_weapons.dmi'
force = 14
ammo_type = /obj/item/ammo_casing/caseless/thumbshell //Does 8 shells at 5 damage, total 40
projectile_damage_multiplier = 0.5 //5 damage per bullet
fire_delay = 10
Expand Down
6 changes: 4 additions & 2 deletions code/game/objects/items/ego_weapons/non_abnormality/rats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
desc = "It's a brick."
special = "Fits into an EGO belt."
icon_state = "ratbrick"
force = 5
force = 6
throwforce = 50
attack_speed = 0.8
attack_verb_continuous = list("bricks", "smashes", "shatters")
Expand Down Expand Up @@ -87,9 +87,11 @@
return TRUE

/obj/item/gun/ego_gun/pistol/rats/afterattack(atom/target, mob/living/user, flag, params)
if(flag && (user.a_intent == INTENT_HARM || forced_melee)) // Don't want to take damage when just using melee
return ..()
if(prob(50))
to_chat(user,span_warning("You pinch your fingers in the weapon."))
user.apply_damage(10, RED_DAMAGE, null, user.run_armor_check(null, BLACK_DAMAGE))
return FALSE
..()
return ..()

Loading

0 comments on commit daa8725

Please sign in to comment.