Skip to content

Commit

Permalink
yea
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Sep 22, 2024
1 parent 71a3bef commit 4137a82
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
#define COMSIG_TRANSFORMING_ON_TRANSFORM "transforming_on_transform"
/// Return COMPONENT_NO_DEFAULT_MESSAGE to prevent the transforming component from displaying the default transform message / sound.
#define COMPONENT_NO_DEFAULT_MESSAGE (1<<0)

#define COMSIG_ITEM_FORCE_TRANSFORM "item_force_transform"
6 changes: 6 additions & 0 deletions code/datums/components/transforming.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
var/obj/item/item_parent = parent

RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(on_attack_self))
RegisterSignal(parent, COMSIG_ITEM_FORCE_TRANSFORM, PROC_REF(force_transform))
if(item_parent.sharpness || sharpness_on)
RegisterSignal(parent, COMSIG_ITEM_SHARPEN_ACT, PROC_REF(on_sharpen))

Expand Down Expand Up @@ -222,3 +223,8 @@
if(force_on + increment > max)
return COMPONENT_BLOCK_SHARPEN_MAXED
sharpened_bonus = increment

/datum/component/transforming/proc/force_transform(obj/item/source)
if(isnum(transform_cooldown_time))
COOLDOWN_START(src, transform_cooldown, transform_cooldown_time)
set_inactive(soruce)
46 changes: 10 additions & 36 deletions code/game/objects/items/melee/bladeatheon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,23 @@
/obj/item/melee/fimbo_stick
name = "fimbo"

/obj/item/melee/sword/pedang
/obj/item/melee/charged/pedang
name = "pedang"
desc = "an electrically-charged fencing sword."
icon = 'icons/obj/weapon/sword.dmi'
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
icon_state = "suns-tsword"

force = 0
var/active_force = 10
pickup_sound = 'sound/items/unsheath.ogg'
drop_sound = 'sound/items/handling/metal_drop.ogg'
hitsound = 'sound/weapons/bladeslice.ogg'

var/obj/item/stock_parts/cell/cell
var/preload_cell_type = /obj/item/stock_parts/cell/pedang //if not empty the sabre starts with this type of cell
var/cell_hit_cost = 1000
allowed_cells = list(/obj/item/stock_parts/cell/pedang)
preload_cell_type = /obj/item/stock_parts/cell/pedang //if not empty the sabre starts with this type of cell
cell_hit_cost = 1000

var/activate_sound = "sparks"

/obj/item/stock_parts/cell/pedang
name = "compact pedang cell"

/obj/item/melee/sword/pedang/Initialize()
. = ..()
if(preload_cell_type)
if(ispath(preload_cell_type, /obj/item/stock_parts/cell/pedang))
cell = new preload_cell_type(src)

AddComponent( \
/datum/component/transforming, \
force_on = active_force, \
)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))

/obj/item/melee/sword/pedang/proc/on_transform()
SIGNAL_HANDLER

playsound(src, activate_sound, 75, TRUE, -1)

/obj/item/melee/sword/pedang/Destroy()
if(cell)
QDEL_NULL(cell)
return ..()

/obj/item/melee/sword/pedang/examine(mob/user)
. = ..()
if(cell)
. += span_notice("\The [src] is [round(cell.percent())]% charged.")
else
. += span_warning("\The [src] does not have a power source installed.")

87 changes: 87 additions & 0 deletions code/game/objects/items/melee/charged.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/obj/item/melee/charged
force = 0
var/active_force = 10

var/obj/item/stock_parts/cell/cell
var/allowed_cells = list()
var/preload_cell_type = /obj/item/stock_parts/cell/melee //if not empty the sabre starts with this type of cell
var/cell_hit_cost = 1000
var/activate_sound = "sparks"

/obj/item/melee/charged/Initialize()
. = ..()
if(preload_cell_type)
if(preload_cell_type in allowed_cells)
cell = new preload_cell_type(src)

/obj/item/melee/charged/ComponentInitialize()
AddComponent( \
/datum/component/transforming, \
force_on = active_force, \
)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))

/obj/item/melee/charged/Destroy()
if(cell)
QDEL_NULL(cell)
return ..()

/obj/item/melee/charged/proc/on_transform()
SIGNAL_HANDLER

playsound(src, activate_sound, 75, TRUE, -1)

/obj/item/melee/charged/proc/deductcharge(chrgdeductamt)
if(cell)
//Note this value returned is significant, as it will determine
//if a stun is applied or not
. = cell.use(chrgdeductamt)
if(turned_on && cell.charge < cell_hit_cost)
//we're below minimum, turn off
SEND_SIGNAL(src, COSMIG_ITEM_FORCE_TRANSFORM, src)
update_appearance()
playsound(src, activate_sound, 75, TRUE, -1)

/obj/item/melee/charged/update_icon_state()
if(turned_on)
icon_state = "[initial(icon_state)]_on"
return ..()
if(!cell)
icon_state = "[initial(icon_state)]_nocell"
return ..()
icon_state = "[initial(icon_state)]"
return ..()

/obj/item/melee/charged/examine(mob/user)
. = ..()
if(cell)
. += span_notice("\The [src] is [round(cell.percent())]% charged.")
else
. += span_warning("\The [src] does not have a power source installed.")

/obj/item/melee/charged/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stock_parts/cell))
var/obj/item/stock_parts/cell/C = W
if(cell)
to_chat(user, span_notice("[src] already has a cell!"))
else
if(C.maxcharge < cell_hit_cost)
to_chat(user, span_notice("[src] requires a higher capacity cell."))
return
if(!user.transferItemToLoc(W, src))
return
cell = W
to_chat(user, span_notice("You install a cell in [src]."))
update_appearance()
else
return ..()

/obj/item/melee/charged/screwdriver_act(mob/living/user, obj/item/I)
. = ..()
if(cell && can_remove_cell)
cell.update_appearance()
cell.forceMove(get_turf(src))
cell = null
to_chat(user, span_notice("You remove the cell from [src]."))
turned_on = FALSE
update_appearance()
36 changes: 14 additions & 22 deletions code/game/objects/items/melee/knife.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
item_flags = EYE_STAB
tool_behaviour = TOOL_KNIFE


/obj/item/melee/knife/ComponentInitialize()
. = ..()
set_butchering()
Expand Down Expand Up @@ -165,34 +164,27 @@
flags_1 = CONDUCT_1
force = 3
w_class = WEIGHT_CLASS_SMALL
sharpness = IS_BLUNT
throwforce = 5
throw_speed = 3
throw_range = 6
custom_materials = list(/datum/material/iron=12000)
hitsound = 'sound/weapons/genhit.ogg'
attack_verb = list("stubbed", "poked")
resistance_flags = FIRE_PROOF
var/extended = 0

/obj/item/melee/knife/switchblade/attack_self(mob/user)
extended = !extended
playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, TRUE)
if(extended)
force = 20
w_class = WEIGHT_CLASS_NORMAL
throwforce = 23
icon_state = "switchblade_on"
attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'
sharpness = IS_SHARP
else
force = 3
w_class = WEIGHT_CLASS_SMALL
throwforce = 5
icon_state = "switchblade"
attack_verb = list("stubbed", "poked")
hitsound = 'sound/weapons/genhit.ogg'
sharpness = IS_BLUNT

/obj/item/melee/knife/switchblade/ComponentInitialize()
. = ..()
AddComponent( \
/datum/component/transforming, \
force_on = 20, \
throwforce_on = 23, \
throw_speed_on = 4, \
sharpness_on = IS_SHARP, \
hitsound_on = 'sound/weapons/bladeslice.ogg', \
w_class_on = WEIGHT_CLASS_NORMAL, \
attack_verb_on = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut"), \
)

/obj/item/melee/knife/letter_opener
name = "letter opener"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/melee/stunbaton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
user.do_attack_animation(M)
return
else
to_chat(user, span_danger("The baton is still charging!"))
to_chat(user, span_danger("The [src] is still charging!"))
else
M.visible_message(span_warning("[user] prods [M] with [src]. Luckily it was off."), \
span_warning("[user] prods you with [src]. Luckily it was off."))
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/melee/sword.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_BACK
w_class = WEIGHT_CLASS_BULKY
obj_flags = UNIQUE_RENAME
block_chance = 25
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
sharpness = IS_SHARP
Expand Down
1 change: 1 addition & 0 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,7 @@
#include "code\game\objects\items\implants\implantuplink.dm"
#include "code\game\objects\items\melee\bladeatheon.dm"
#include "code\game\objects\items\melee\chainsaw.dm"
#include "code\game\objects\items\melee\charged.dm"
#include "code\game\objects\items\melee\dualsaber.dm"
#include "code\game\objects\items\melee\energy.dm"
#include "code\game\objects\items\melee\energyhalberd.dm"
Expand Down

0 comments on commit 4137a82

Please sign in to comment.